Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
The completion types.
Synopsis
- type CompletionFunc = (Text, Text) -> IO (Text, [Completion])
- data Completion = Completion {
- replacement :: Text
- display :: Text
- isFinished :: Bool
Documentation
type CompletionFunc = (Text, Text) -> IO (Text, [Completion]) Source #
A completion function modeled after the one used in Haskeline.
Warning: If you're familiar with the Haskeline version of the
CompletionFunc
type please be sure to read this description
carefully since the two behave differently.
The completion function is called when the user presses the tab key. The current input line is split into two parts based on where the cursor is positioned. Text to the left of the cursor will be the first value in the tuple and text to the right of the cursor will be the second value.
The text returned from the completion function is the text from the
left of the cursor which wasn't used in the completion. It should
also produce a list of possible Completion
values.
In Haskeline, some of these text values are reversed. This is not the case in Byline.
A note about IO
:
Due to the way that Byline uses Haskeline, the completion function
is forced to return an IO
value. It would be better if it could
return a value in the base monad instead. Patches welcome.
data Completion Source #
A type representing a completion match to the user's input.
Completion | |
|
Instances
Eq Completion Source # | |
Defined in System.Console.Byline.Completion (==) :: Completion -> Completion -> Bool # (/=) :: Completion -> Completion -> Bool # | |
Ord Completion Source # | |
Defined in System.Console.Byline.Completion compare :: Completion -> Completion -> Ordering # (<) :: Completion -> Completion -> Bool # (<=) :: Completion -> Completion -> Bool # (>) :: Completion -> Completion -> Bool # (>=) :: Completion -> Completion -> Bool # max :: Completion -> Completion -> Completion # min :: Completion -> Completion -> Completion # | |
Show Completion Source # | |
Defined in System.Console.Byline.Completion showsPrec :: Int -> Completion -> ShowS # show :: Completion -> String # showList :: [Completion] -> ShowS # |