Skip to content

Thimoteus/purescript-simple-repl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published