Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. peek :: forall a. H.ChildF ListSlot ListQueryP a -> H.ParentDSL State (ListStateP g) Query ListQueryP g ListSlot Unit
  2. peek = coproduct peekList peekTicker <<< H.runChildF
  3.  
  4. peekList :: forall a. ListQuery a -> H.ParentDSL State (ListStateP g) Query ListQueryP g ListSlot Unit
  5. peekList _ =
  6. -- we're not actually interested in peeking on the list.
  7. -- instead of defining a function like this, an alternative would be to use
  8. -- `(const (pure unit))` in place of `peekList` in the `coproduct` function
  9. pure unit
  10.  
  11. peekTicker :: forall a. H.ChildF TickSlot TickQuery a -> H.ParentDSL State (ListStateP g) Query ListQueryP g ListSlot Unit
  12. peekTicker (H.ChildF _ (Tick _)) = H.modify (st -> { count: st.count + 1 })
  13. peekTicker _ = pure unit
  14.  
  15. peek = coproduct peekList (const (pure unit))
  16.  
  17. peekList :: forall a. H.ChildF ListSlot ListQuery a -> H.ParentDSL State (ListStateP g) Query ListQueryP g ListSlot Unit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement