| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Glazier.Window
Description
Functional version of (Elm View/Update & startApp architecture) enabling composable widgets, and a FRP-like framework.
This framework makes it easier to modularize the Elm architecture idea of View/Update: based on the deprecated Elm Architecture version of Jan 2016 https://github.com/evancz/elm-architecture-tutorial/tree/de5682a5a8e4459aed4637533adb25e462f8a2ae
The Elm View/Update is basically as follows:
data Model = Blah....
data Action = DoThis | DoThat deriving Show
-- | update is fired from an event processing loop
update :: Action -> Model -> Model
-- | The widget from view knows how to send Action to a mailbox
view :: Signal Address -> Model -> Html
This module uses isomorphic Window and Gadget resulting in instances can be be composed together into larger Widgets. Original inspiration from https://arianvp.me/lenses-and-prisms-for-modular-clientside-apps/
This framework provides three main combinators:
* Semigroup and Monoid instances for concatenating widgets.
* dispatch is used to re-route the action type.
* implant is used to modify the model type.
- newtype WindowT s m v = WindowT {
- runWindowT :: ReaderT s m v
- type Window s = WindowT s Identity
- _WindowT :: Iso (WindowT s m v) (WindowT s' m' v') (s -> m v) (s' -> m' v')
- _WindowT' :: Iso' (WindowT s m v) (s -> m v)
- mkWindowT' :: (s -> m v) -> WindowT s m v
- runWindowT' :: WindowT s m v -> s -> m v
- belowWindowT :: ((s -> m v) -> s' -> m' v') -> WindowT s m v -> WindowT s' m' v'
- underWindowT :: (ReaderT s m v -> ReaderT s' m' v') -> WindowT s m v -> WindowT s' m' v'
- overWindowT :: (WindowT s m v -> WindowT s' m' v') -> ReaderT s m v -> ReaderT s' m' v'
- aboveWindowT :: (WindowT s m v -> WindowT s' m' v') -> (s -> m v) -> s' -> m' v'
Documentation
newtype WindowT s m v Source #
The Elm view function is basically view :: model -> html
This can be enhanced with monadic effects with ReaderT.
This is named Window instead of View to avoid confusion with view from Control.Lens
Constructors
| WindowT | |
Fields
| |
Instances
| Monad m => MonadReader s (WindowT s m) Source # | |
| MFunctor (WindowT s) Source # | |
| MonadTrans (WindowT s) Source # | |
| Monad m => Monad (WindowT s m) Source # | |
| Functor m => Functor (WindowT s m) Source # | |
| MonadFix m => MonadFix (WindowT s m) Source # | |
| MonadFail m => MonadFail (WindowT s m) Source # | |
| Applicative m => Applicative (WindowT s m) Source # | |
| MonadIO m => MonadIO (WindowT s m) Source # | |
| Alternative m => Alternative (WindowT s m) Source # | |
| MonadPlus m => MonadPlus (WindowT s m) Source # | |
| Monad m => Magnify (WindowT s m) (WindowT t m) s t Source # | |
| (Applicative m, Semigroup v) => Semigroup (WindowT s m v) Source # | |
| (Applicative m, Monoid v) => Monoid (WindowT s m v) Source # | |
| Wrapped (WindowT s0 m0 v0) Source # | |
| (~) * (WindowT s0 m0 v0) t0 => Rewrapped (WindowT s1 m1 v1) t0 Source # | |
| Monad m => Implant (WindowT s m v) (WindowT t m v) s t Source # | |
| type Magnified (WindowT s m) Source # | |
| type Unwrapped (WindowT s0 m0 v0) Source # | |
| type Implanted (WindowT s m v) Source # | |
mkWindowT' :: (s -> m v) -> WindowT s m v Source #
runWindowT' :: WindowT s m v -> s -> m v Source #
belowWindowT :: ((s -> m v) -> s' -> m' v') -> WindowT s m v -> WindowT s' m' v' Source #
aboveWindowT :: (WindowT s m v -> WindowT s' m' v') -> (s -> m v) -> s' -> m' v' Source #