    {-# OPTIONS_HADDOCK show-extensions #-}

    -- |
    -- Module      :  Yi.Keymap.Vim.Ex.Types
    -- License     :  GPL-2
    -- Maintainer  :  yi-devel@googlegroups.com
    -- Stability   :  experimental
    -- Portability :  portable

    module Yi.Keymap.Vim.Ex.Types where

    import Data.Maybe           (listToMaybe, mapMaybe)
    import Data.Text            (Text, unpack)
    import Yi.Keymap            (Action, YiM)
    import Yi.Keymap.Vim.Common (EventString)

    data ExCommand = ExCommand {
        ExCommand -> YiM [Text]
    cmdComplete :: YiM [Text]
      , ExCommand -> Bool
    cmdIsPure :: Bool
      , ExCommand -> Action
    cmdAction :: Action
      , ExCommand -> Bool
    cmdAcceptsRange :: Bool
      , ExCommand -> Text
    cmdShow :: Text
    }

    instance Show ExCommand where
        show :: ExCommand -> String
    show = Text -> String
    unpack (Text -> String) -> (ExCommand -> Text) -> ExCommand -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ExCommand -> Text
    cmdShow

    data LineRange
        = MarkRange String String -- ^ 'a,'b
        | FullRange               -- ^ %
        | CurrentLineRange

    evStringToExCommand :: [EventString -> Maybe ExCommand] -> EventString -> Maybe ExCommand
    evStringToExCommand :: [EventString -> Maybe ExCommand] -> EventString -> Maybe ExCommand
    evStringToExCommand [EventString -> Maybe ExCommand]
    parsers EventString
    s = [ExCommand] -> Maybe ExCommand
    forall a. [a] -> Maybe a
    listToMaybe ([ExCommand] -> Maybe ExCommand)
    -> ([EventString -> Maybe ExCommand] -> [ExCommand])
    -> [EventString -> Maybe ExCommand]
    -> Maybe ExCommand
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ((EventString -> Maybe ExCommand) -> Maybe ExCommand)
    -> [EventString -> Maybe ExCommand] -> [ExCommand]
    forall a b. (a -> Maybe b) -> [a] -> [b]
    mapMaybe ((EventString -> Maybe ExCommand) -> EventString -> Maybe ExCommand
    forall a b. (a -> b) -> a -> b
    $ EventString
    s) ([EventString -> Maybe ExCommand] -> Maybe ExCommand)
    -> [EventString -> Maybe ExCommand] -> Maybe ExCommand
    forall a b. (a -> b) -> a -> b
    $ [EventString -> Maybe ExCommand]
    parsers