tinyapp-0.2.0.0: Library to build tiny apps in Haskell
Safe HaskellSafe-Inferred
LanguageGHC2021

TinyApp.Repl

Description

Build REPL apps

Synopsis

Documentation

data ContinueExit Source #

Signals whether the application should continue asking input from the user or exit.

Constructors

Continue 
Exit 

Instances

Instances details
Show ContinueExit Source # 
Instance details

Defined in TinyApp.Repl

Eq ContinueExit Source # 
Instance details

Defined in TinyApp.Repl

data Sandbox state Source #

Defines a REPL application that is not allowed to perform arbitrary IO while executing.

Constructors

Sandbox 

Fields

  • initialize :: state

    Initial state

  • prompt :: state -> String

    The prompt to show. It can depend on the state

  • update :: String -> state -> (state, String, ContinueExit)

    Process the user input given the current state Returns the next state, the output and whether to continue or not the program

runRepl :: Sandbox s -> IO () Source #

Executes the REPL application.

runRepl' :: forall s. Sandbox s -> IO s Source #

Executes the REPL application returning its final state.