Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module State where
- type State s a = s -> (a, s)
- type CoState s a = (a, s) -> s
- hyloState :: State s a -> (CoState b a) -> s -> b
- hyloState f c = go
- where
- go = c . fmap go . f
- -- (\(x,q') -> c (x,go q')) . f
- --
- type SafeState s a = s -> (a, Maybe s)
- type CoSafeState s a = (a, Maybe s) -> s
- hyloSafeState :: SafeState s a -> (CoSafeState b a) -> s -> b
- hyloSafeState f c = go
- where
- go = c . fmap (fmap go) . f
- --
- type StateSafe s a = s -> Maybe (a, s)
- type CoStateSafe s a = Maybe (a, s) -> s
- hyloStateSafe :: StateSafe s a -> (CoStateSafe b a) -> s -> b
- hyloStateSafe f c = go
- where
- go = c . fmap (fmap go) . f
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement