Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Attrs = HashMap Text (Freedom, Value)
- data Update b c where
- Id :: Update a a
- Compose :: Compose b c -> Update b c
- Arr :: (b -> c) -> Update b c
- First :: Update b c -> Update (b, d) (c, d)
- Zero :: Update b c
- Plus :: Update b c -> Update b c -> Update b c
- Check :: (a -> Bool) -> Update (Box a) ()
- Load :: Text -> Update () (Box Value)
- UseOrSet :: Text -> Update (Box Value) (Box Value)
- Update :: Text -> Update (Box Value) (Box Value)
- Run :: (a -> IO b) -> Update (Box a) (Box b)
- Template :: Update (Box Text) (Box Text)
- data Compose a c = Compose' (Update b c) (Update a b)
- runUpdate :: Attrs -> Update () a -> IO (Attrs, a)
- execUpdate :: Attrs -> Update () a -> IO a
- evalUpdate :: Attrs -> Update () a -> IO Attrs
- tryEvalUpdate :: Attrs -> Update () a -> IO (Either SomeException Attrs)
- type JSON a = (ToJSON a, FromJSON a)
- data UpdateFailed
- data UpdateRes a b
- = UpdateReady (UpdateReady b)
- | UpdateNeedMore (a -> IO (UpdateReady b))
- data UpdateReady b
- runBox :: Box a -> IO a
- data Box a = Box {}
- type BoxedAttrs = HashMap Text (Freedom, Box Value)
- unboxAttrs :: BoxedAttrs -> IO Attrs
- boxAttrs :: Attrs -> BoxedAttrs
- data Freedom
- runUpdate' :: BoxedAttrs -> Update a b -> IO (UpdateRes a b)
- decodeBox :: FromJSON a => Text -> Box Value -> Box a
- decodeValue :: FromJSON a => Text -> Value -> IO a
- renderTemplate :: (Text -> Maybe (Box Text)) -> Text -> Maybe (Box Text)
- template :: Update (Box Text) (Box Text)
- check :: (a -> Bool) -> Update (Box a) ()
- load :: FromJSON a => Text -> Update () (Box a)
- useOrSet :: JSON a => Text -> Update (Box a) (Box a)
- update :: JSON a => Text -> Update (Box a) (Box a)
- run :: (a -> IO b) -> Update (Box a) (Box b)
- run' :: (a -> IO b) -> Update (Box a) (Box b)
- dirty :: Update (Box a) (Box a)
Documentation
data Update b c where Source #
Id :: Update a a | |
Compose :: Compose b c -> Update b c | |
Arr :: (b -> c) -> Update b c | |
First :: Update b c -> Update (b, d) (c, d) | |
Zero :: Update b c | |
Plus :: Update b c -> Update b c -> Update b c | |
Check :: (a -> Bool) -> Update (Box a) () | |
Load :: Text -> Update () (Box Value) | |
UseOrSet :: Text -> Update (Box Value) (Box Value) | |
Update :: Text -> Update (Box Value) (Box Value) | |
Run :: (a -> IO b) -> Update (Box a) (Box b) | |
Template :: Update (Box Text) (Box Text) |
runUpdate :: Attrs -> Update () a -> IO (Attrs, a) Source #
Run an Update
and return the new attributes and result.
tryEvalUpdate :: Attrs -> Update () a -> IO (Either SomeException Attrs) Source #
data UpdateFailed Source #
Instances
Show UpdateFailed Source # | |
Defined in Niv.Update showsPrec :: Int -> UpdateFailed -> ShowS # show :: UpdateFailed -> String # showList :: [UpdateFailed] -> ShowS # |
UpdateReady (UpdateReady b) | |
UpdateNeedMore (a -> IO (UpdateReady b)) |
data UpdateReady b Source #
Instances
Functor UpdateReady Source # | |
Defined in Niv.Update fmap :: (a -> b) -> UpdateReady a -> UpdateReady b # (<$) :: a -> UpdateReady b -> UpdateReady a # |
unboxAttrs :: BoxedAttrs -> IO Attrs Source #
boxAttrs :: Attrs -> BoxedAttrs Source #
runUpdate' :: BoxedAttrs -> Update a b -> IO (UpdateRes a b) Source #
Runs an update, trying to evaluate the Box
es as little as possible.
This is a hairy piece of code, apologies ¯_(ツ)_/¯
In most cases I just picked the first implementation that compiled