git.iko.soy/rowtype-yoga/purescript-native
on cd4c708 help sign in
16 lines 444 B history raw
1module Main where
3import Prelude
4import Control.Monad.Eff.Console (log)
6data Auto s i o = Auto { state :: s, step :: s -> i -> o }
8type SomeAuto i o = forall r. (forall s. Auto s i o -> r) -> r
10exists :: forall s i o. s -> (s -> i -> o) -> SomeAuto i o
11exists = \state step f -> f (Auto { state: state, step: step })
13run :: forall i o. SomeAuto i o -> i -> o
14run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)
16main = log "Done"