-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Library to build tiny apps in Haskell -- -- Library to build tiny apps in Haskell such a REPLs or text-based -- applications that reacts to keystrokes @package tinyapp @version 0.2.0.0 -- | Build interactice apps that reacts to each keystroke and renders text -- Requires `ghc-options: -threaded` module TinyApp.Interactive -- | Event the application can receive data Event Key :: Key -> [Modifier] -> Event -- | Representes keys that can be pressed data Key KEsc :: Key KChar :: Char -> Key KBS :: Key KEnter :: Key KLeft :: Key KRight :: Key KUp :: Key KDown :: Key KUpLeft :: Key KUpRight :: Key KDownLeft :: Key KDownRight :: Key KCenter :: Key KFun :: Int -> Key KBackTab :: Key KPrtScr :: Key KPause :: Key KIns :: Key KHome :: Key KPageUp :: Key KDel :: Key KEnd :: Key KPageDown :: Key KBegin :: Key KMenu :: Key -- | Modifiers keys data Modifier MShift :: Modifier MCtrl :: Modifier MMeta :: Modifier MAlt :: Modifier -- | Defines an interactive application that is not allowed to perform -- arbitrary IO while executing. data Sandbox state Sandbox :: state -> (state -> String) -> (Event -> state -> (state, ContinueExit)) -> Sandbox state -- | Initial state [initialize] :: Sandbox state -> state -- | What to draw based on the current state. The screen is cleared between -- render calls. Usually use 'n' or *Prelude.unlines* to render multiple -- lines. [render] :: Sandbox state -> state -> String -- | Process the event given the current state Returns the next state and -- whether to continue or not the program [update] :: Sandbox state -> Event -> state -> (state, ContinueExit) -- | Signals whether the application should continue waiting input from the -- user or exit. data ContinueExit Continue :: ContinueExit Exit :: ContinueExit -- | Executes the application. runInteractive :: Sandbox s -> IO () -- | Executes the application returning its final state. runInteractive' :: forall s. Sandbox s -> IO s instance GHC.Classes.Ord TinyApp.Interactive.Key instance GHC.Read.Read TinyApp.Interactive.Key instance GHC.Show.Show TinyApp.Interactive.Key instance GHC.Classes.Eq TinyApp.Interactive.Key instance GHC.Classes.Ord TinyApp.Interactive.Modifier instance GHC.Read.Read TinyApp.Interactive.Modifier instance GHC.Show.Show TinyApp.Interactive.Modifier instance GHC.Classes.Eq TinyApp.Interactive.Modifier instance GHC.Show.Show TinyApp.Interactive.ContinueExit instance GHC.Classes.Eq TinyApp.Interactive.ContinueExit -- | Build REPL apps module TinyApp.Repl -- | Signals whether the application should continue asking input from the -- user or exit. data ContinueExit Continue :: ContinueExit Exit :: ContinueExit -- | Defines a REPL application that is not allowed to perform arbitrary IO -- while executing. data Sandbox state Sandbox :: state -> (state -> String) -> (String -> state -> (state, String, ContinueExit)) -> Sandbox state -- | Initial state [initialize] :: Sandbox state -> state -- | The prompt to show. It can depend on the state [prompt] :: Sandbox state -> state -> String -- | Process the user input given the current state Returns the next state, -- the output and whether to continue or not the program [update] :: Sandbox state -> String -> state -> (state, String, ContinueExit) -- | Executes the REPL application. runRepl :: Sandbox s -> IO () -- | Executes the REPL application returning its final state. runRepl' :: forall s. Sandbox s -> IO s instance GHC.Show.Show TinyApp.Repl.ContinueExit instance GHC.Classes.Eq TinyApp.Repl.ContinueExit