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

TinyApp.Interactive

Description

Build interactice apps that reacts to each keystroke and renders text Requires `ghc-options: -threaded`

Synopsis

Documentation

data Event Source #

Event the application can receive

Constructors

Key Key [Modifier] 

data Key Source #

Representes keys that can be pressed

Instances

Instances details
Read Key Source # 
Instance details

Defined in TinyApp.Interactive

Show Key Source # 
Instance details

Defined in TinyApp.Interactive

Methods

showsPrec :: Int -> Key -> ShowS #

show :: Key -> String #

showList :: [Key] -> ShowS #

Eq Key Source # 
Instance details

Defined in TinyApp.Interactive

Methods

(==) :: Key -> Key -> Bool #

(/=) :: Key -> Key -> Bool #

Ord Key Source # 
Instance details

Defined in TinyApp.Interactive

Methods

compare :: Key -> Key -> Ordering #

(<) :: Key -> Key -> Bool #

(<=) :: Key -> Key -> Bool #

(>) :: Key -> Key -> Bool #

(>=) :: Key -> Key -> Bool #

max :: Key -> Key -> Key #

min :: Key -> Key -> Key #

data Modifier Source #

Modifiers keys

Constructors

MShift 
MCtrl 
MMeta 
MAlt 

Instances

Instances details
Read Modifier Source # 
Instance details

Defined in TinyApp.Interactive

Show Modifier Source # 
Instance details

Defined in TinyApp.Interactive

Eq Modifier Source # 
Instance details

Defined in TinyApp.Interactive

Ord Modifier Source # 
Instance details

Defined in TinyApp.Interactive

data Sandbox state Source #

Defines an interactive application that is not allowed to perform arbitrary IO while executing.

Constructors

Sandbox 

Fields

  • initialize :: state

    Initial state

  • render :: state -> String

    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.

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

    Process the event given the current state Returns the next state and whether to continue or not the program

data ContinueExit Source #

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

Constructors

Continue 
Exit 

Instances

Instances details
Show ContinueExit Source # 
Instance details

Defined in TinyApp.Interactive

Eq ContinueExit Source # 
Instance details

Defined in TinyApp.Interactive

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

Executes the application.

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

Executes the application returning its final state.