Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
UI
Synopsis
- data UI a
- mkUI :: Termbox2 a -> UI a
- runUI :: UI a -> IO a
- newtype Action space effect a = Action {
- work :: forall r. space (a -> effect r) -> effect r
- nil :: Comonad f => Action f m ()
- mount :: Comonad w => Component IO w (Action w) Console -> IO ()
- type BehaviorOf = Cofree
- behavior :: Functor f => (a -> f a) -> a -> BehaviorOf f a
- unwrap :: ComonadCofree f w => w a -> f (w a)
- type Screen w m = Component m w (Action w) Console
- screen :: t -> (t -> UI ()) -> (Event -> a) -> Store t ((a -> IO ()) -> Console)
- modify :: ComonadStore s w => (s -> s) -> Action w m ()
- put :: ComonadStore s w => s -> Action w m ()
- get :: ComonadStore s w => Action w m s
- data Event
- = Resize Int Int
- | KeyboardInput Int
- type With = Day
- (<->) :: f x -> g y -> With f g (x, y)
- glyphCode :: Integral n => Char -> n
- blockGlyph :: Integral n => n
- drawBlock :: Int -> Int -> UI ()
- drawRect :: Int -> Int -> Int -> Int -> UI ()
- screenBorder :: Int -> UI ()
- centerText :: String -> UI ()
- statusText :: String -> UI ()
- width :: UI Int
- height :: UI Int
- type Callback base action = action base () -> base ()
- type Interaction base action view = Callback base action -> view
- type Component base space action view = space (Interaction base action view)
- data Console = Console (UI ()) (Event -> IO ())
- move :: Functor w => (a -> b -> m r) -> Action w m a -> w b -> m r
- type Store s = StoreT s Identity
- store :: (s -> a) -> s -> Store s a
- runStore :: Store s a -> (s -> a, s)
Documentation
DSL based on Termbox2
for UI drawing operations
The decisions to not derive MonadIO
or export the constructor are
deliberate.
newtype Action space effect a Source #
Instances
Comonad w => MonadTrans (Action w) Source # | |
(Comonad w, MonadIO m) => MonadIO (Action w m) Source # | |
Comonad w => Applicative (Action w m) Source # | |
Defined in UI Methods pure :: a -> Action w m a Source # (<*>) :: Action w m (a -> b) -> Action w m a -> Action w m b Source # liftA2 :: (a -> b -> c) -> Action w m a -> Action w m b -> Action w m c Source # (*>) :: Action w m a -> Action w m b -> Action w m b Source # (<*) :: Action w m a -> Action w m b -> Action w m a Source # | |
Functor space => Functor (Action space effect) Source # | |
Comonad w => Monad (Action w m) Source # | |
mount :: Comonad w => Component IO w (Action w) Console -> IO () Source #
Sets up a component for execution and catches exceptions.
type BehaviorOf = Cofree Source #
Cofree
does exactly what we want but has an unintuitive name.
behavior :: Functor f => (a -> f a) -> a -> BehaviorOf f a Source #
coiter
does exactly what we want but has an unintuitive name.
concept: instead of coiter, use Representable and index
type Screen w m = Component m w (Action w) Console Source #
Legible alias for a common component type.
Construct a screen component with a given behavior.
Constructors
Resize Int Int | |
KeyboardInput Int |
blockGlyph :: Integral n => n Source #
screenBorder :: Int -> UI () Source #
centerText :: String -> UI () Source #
statusText :: String -> UI () Source #
type Interaction base action view = Callback base action -> view Source #
type Component base space action view = space (Interaction base action view) Source #
A console view.