Home

Awesome

purescript-simple-repl Build Status

If it doesn't work, try throwing Aff at it

Usage

By example:

import Node.SimpleRepl (setPrompt, readLine, runRepl, putStrLn)

main :: Effect Unit
main = runRepl do
  setPrompt "> "
  putStrLn "THE DRAMATIC REPL"
  putStrLn ":Q TO QUIT"
  loop
  where
    loop = do
      res <- readLine
      case res of
           ":q" -> pure unit
           ":Q" -> pure unit
           _ -> do
             putStrLn $ toUpper res <> "!!!"
             loop

The main draw of this library is the readLine :: Repl String function.

The point was to make it possible to do something akin to Haskell's getLine :: IO String, since otherwise using just the barebones purescript-node-readline library, user input is handled in a callback that takes the input as its parameter.

Installing

bower i purescript-simple-repl