git.iko.soy/rowtype-yoga/purescript-native
on 8030607 help sign in
13 lines 417 B history raw
1module Main where
3 data Auto s i o = Auto { state :: s, step :: s -> i -> o }
5 type SomeAuto i o = forall r. (forall s. Auto s i o -> r) -> r
7 exists :: forall s i o. s -> (s -> i -> o) -> SomeAuto i o
8 exists = \state step f -> f (Auto { state: state, step: step })
10 run :: forall i o. SomeAuto i o -> i -> o
11 run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)
13 main = Debug.Trace.trace "Done"