Module
LineReader.Run
- Package
- purescript-line-reader
- Repository
- ChrisPenner/purescript-line-reader
This module provides an interface to read/write from a console interface using Run effects.
Example usage:
getEssay :: forall e. Aff (readline :: READLINE, console :: CONSOLE, exception :: EXCEPTION | e) (Array String)
getEssay = runLineReader Nothing (getWords 10)
where
getWords :: Int -> Run (aff :: AFF (readline :: READLINE, console :: CONSOLE, exception :: EXCEPTION | e), reader :: READER Interface) (Array String)
getWords n
| n <= 0 = pure []
| otherwise = do
newWords <- question $ ("Please enter at least " <> show n <> "words" :: String)
let splitWords = words newWords
(append splitWords <$> getWords (n - length splitWords))
#runLineReader Source
runLineReader :: forall eff r. (Run (aff :: AFF (console :: CONSOLE, exception :: EXCEPTION, readline :: READLINE | eff), linereader :: LINEREADER, reader :: READER Interface | r)) ~> (Run (aff :: AFF (console :: CONSOLE, exception :: EXCEPTION, readline :: READLINE | eff), reader :: READER Interface | r))
#lineReaderToAff Source
lineReaderToAff :: forall e a r. Maybe (Tuple (Readable r (console :: CONSOLE, exception :: EXCEPTION, readline :: READLINE | e)) (Options InterfaceOptions)) -> Run (aff :: AFF (console :: CONSOLE, exception :: EXCEPTION, readline :: READLINE | e), reader :: READER Interface) a -> Aff (console :: CONSOLE, exception :: EXCEPTION, readline :: READLINE | e) a
Run a Line Reader computation from the Run Monad into the Aff Monad
Re-exports from Node.ReadLine.Aff
#InterfaceOptions Source
data InterfaceOptions
Options passed to readline
's createInterface
#noCompletion Source
noCompletion :: forall eff. Completer eff
A completion function which offers no completions.
#createInterface Source
createInterface :: forall eff r. Readable r (readline :: READLINE | eff) -> Options InterfaceOptions -> Eff (readline :: READLINE | eff) Interface
Builds an interface with the specified options.
- Modules
- LineReader
- LineReader.
Run