git.iko.soy/rowtype-yoga/purescript-native
on 24fdff2 help sign in
15 lines 431 B history raw
1module Main where
3import Prelude
5data Auto s i o = Auto { state :: s, step :: s -> i -> o }
7type SomeAuto i o = forall r. (forall s. Auto s i o -> r) -> r
9exists :: forall s i o. s -> (s -> i -> o) -> SomeAuto i o
10exists = \state step f -> f (Auto { state: state, step: step })
12run :: forall i o. SomeAuto i o -> i -> o
13run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)
15main = Control.Monad.Eff.Console.log "Done"