@@ -4,8 +4,9 @@
44-- it can be used.
55module Automaton where
66
7+import open Basics
78import Signal (lift,foldp)
8−import List (reverse)
9+import open List
910import Maybe (Just, Nothing)
1011
1112data Automaton a b = Step (a -> (Automaton a b, b))
@@ -15,7 +16,7 @@ data Automaton a b = Step (a -> (Automaton a b, b))
1516run : Automaton a b -> b -> Signal a -> Signal b
1617run auto base inputs =
1718 let step a (Step f, _) = f a
18− in lift (\(x,y) -> y) <| foldp step (auto,base) inputs
19+ in lift (\(x,y) -> y) (foldp step (auto,base) inputs)
1920
2021-- Step an automaton forward once with a given input.
2122step : a -> Automaton a b -> (Automaton a b, b)
@@ -35,7 +36,7 @@ g <<< f = f >>> g
3536-- Combine a list of automatons into a single automaton that produces a list.
3637combine : [Automaton a b] -> Automaton a [b]
3738combine autos =
38− Step (\a -> let (autos', bs) = unzip $ map (step a) autos
39+ Step (\a -> let (autos', bs) = unzip (map (step a) autos)
3940 in (combine autos', bs))
4041
4142-- Create an automaton with no memory. It just applies the given function to