yi-core 0.18.0 → 0.19.0
raw patch · 6 files changed
+23/−10 lines, 6 filesdep ~yi-languagenew-uploader
Dependency ranges changed: yi-language
Files
- src/Parser/Incremental.hs +2/−0
- src/Yi/CompletionTree.hs +4/−1
- src/Yi/Interact.hs +5/−3
- src/Yi/Keymap/Keys.hs +3/−3
- src/Yi/Types.hs +7/−1
- yi-core.cabal +2/−2
src/Parser/Incremental.hs view
@@ -182,6 +182,8 @@ instance Monad (Parser s) where (>>=) = Bind return = pure++instance MonadFail (Parser s) where fail _message = Empt toQ :: Parser s a -> forall h r. ((h,a) -> Steps s r) -> h -> Steps s r
src/Yi/CompletionTree.hs view
@@ -85,7 +85,9 @@ (hasParent, rest) -> over unCompletionTree (M.insert parent (fromList $ map (fromJust . LL.stripPrefix parent) hasParent)) $ fromList rest -- A parent is the prefix and the children are the items with the parent as prefix- where childrenIn list parent = length $ filter (parent `LL.isPrefixOf`) list+ where+ childrenIn :: (ListLike a i, Eq i) => [a] -> a -> Int+ childrenIn list parent = length $ filter (parent `LL.isPrefixOf`) list -- | The largest element of a non-empty structure with respect to the -- given comparison function, Nothing if there are multiple 'largest' elements.@@ -178,6 +180,7 @@ | mempty == ct = [] | otherwise = toList' ct where+ toList' :: (Ord a, ListLike a i) => CompletionTree a -> [a] toList' (CompletionTree ct') | M.null ct' = [mempty] | otherwise = concat $ M.elems $ M.mapWithKey (\k v -> map (k `LL.append`) $ toList' v) ct'
src/Yi/Interact.hs view
@@ -126,9 +126,11 @@ instance Monad (I event w) where return = Returns- fail _ = Fails (>>=) = Binds +instance MonadFail (I event w) where+ fail _ = Fails+ instance Eq w => MonadPlus (I event w) where mzero = Fails mplus = Plus@@ -294,7 +296,7 @@ -- --------------------------------------------------------------------------- -- Derived operations-oneOf :: (Ord event, MonadInteract m w event) => [event] -> m event+oneOf :: (Ord event, MonadInteract m w event, MonadFail m) => [event] -> m event oneOf s = choice $ map event s anyEvent :: (Ord event, MonadInteract m w event) => m event@@ -311,7 +313,7 @@ -- ^ Parses and returns the specified list of events (lazily). events = mapM event -choice :: (MonadInteract m w e) => [m a] -> m a+choice :: (MonadInteract m w e, MonadFail m) => [m a] -> m a -- ^ Combines all parsers in the specified list. choice [] = fail "No choice succeeds" choice [p] = p
src/Yi/Keymap/Keys.hs view
@@ -33,7 +33,7 @@ import Yi.Interact hiding (write) import Yi.Keymap (Action, KeymapM, YiAction, write) -printableChar :: (MonadInteract m w Event) => m Char+printableChar :: (MonadFail m, MonadInteract m w Event) => m Char printableChar = do Event (KASCII c) [] <- anyEvent unless (isPrint c) $@@ -50,7 +50,7 @@ pString :: (MonadInteract m w Event) => String -> m [Event] pString = events . map char -charOf :: (MonadInteract m w Event) => (Event -> Event) -> Char -> Char -> m Char+charOf :: (MonadFail m, MonadInteract m w Event) => (Event -> Event) -> Char -> Char -> m Char charOf modifier l h = do Event (KASCII c) _ <- eventBetween (modifier $ char l) (modifier $ char h) return c@@ -84,7 +84,7 @@ hyperCh = hyper . char -- | @optMod f ev@ produces a 'MonadInteract' that consumes @ev@ or @f ev@-optMod ::(MonadInteract m w Event) => (Event -> Event) -> Event -> m Event+optMod ::(MonadFail m, MonadInteract m w Event) => (Event -> Event) -> Event -> m Event optMod f ev = oneOf [ev, f ev] -- | Convert a special key into an event
src/Yi/Types.hs view
@@ -124,7 +124,7 @@ -- TODO: doc how these are actually user-bindable -- are they? newtype YiM a = YiM {runYiM :: ReaderT Yi IO a}- deriving (Monad, Applicative, MonadReader Yi, MonadBase IO, Typeable, Functor)+ deriving (Monad, Applicative, MonadReader Yi, MonadBase IO, Typeable, Functor, MonadFail) instance MonadState Editor YiM where get = yiEditor <$> (liftBase . readMVar =<< yiVar <$> ask)@@ -171,6 +171,9 @@ , MonadState FBuffer , MonadReader Window ) +instance MonadFail BufferM where+ fail = error+ -- | Currently duplicates some of Vim's indent settings. Allowing a -- buffer to specify settings that are more dynamic, perhaps via -- closures, could be useful.@@ -361,6 +364,9 @@ instance MonadEditor EditorM where askCfg = ask withEditor = id++instance MonadFail EditorM where+ fail = error class (Monad m, MonadState Editor m) => MonadEditor m where askCfg :: m Config
yi-core.cabal view
@@ -1,5 +1,5 @@ name: yi-core-version: 0.18.0+version: 0.19.0 synopsis: Yi editor core library category: Yi homepage: https://github.com/yi-editor/yi#readme@@ -51,7 +51,7 @@ , unix-compat >= 0.1 , unordered-containers >= 0.1.3 , xdg-basedir >= 0.2.1- , yi-language >= 0.18+ , yi-language >= 0.19 , yi-rope >= 0.10 , exceptions if flag(hint)