@@ -84,38 +84,26 @@ hiddenState base fun = loop base (pure (\(i,s) ->
8484 let (o,s') = fun i s
8585 in (s',o)))
8686
87−(>>>) : Automaton i inter -> Automaton inter o -> Automaton i o
88−(>>>) = before
89−
9087after : Automaton inter o -> Automaton i inter -> Automaton i o
9188after g f = f `before` g
9289
93−(<<<) : Automaton inter o -> Automaton i inter -> Automaton i o
94−(<<<) = after
95−
9690-- AFRP name: second
9791extendUp: Automaton i o -> Automaton (extra,i) (extra,o)
9892extendUp auto =
9993 let swap (a, b) = (b, a)
100− in pure swap >>> extendDown auto >>> pure swap
94+ in pure swap `before` extendDown auto `before` pure swap
10195
10296-- (parallel composition)
103−stack: Automaton i1 o1 -> Automaton i2 o2 -> Automaton (i1,i2) (o1,o2)
104−stack f g = extendDown f >>> extendUp g
97+pair: Automaton i1 o1 -> Automaton i2 o2 -> Automaton (i1,i2) (o1,o2)
98+pair f g = extendDown f `before` extendUp g
10599
106−(***): Automaton i1 o1 -> Automaton i2 o2 -> Automaton (i1,i2) (o1,o2)
107−(***) = stack
108−
109−and : Automaton i o1 -> Automaton i o2 -> Automaton i (o1,o2)
110−and f g =
100+branch : Automaton i o1 -> Automaton i o2 -> Automaton i (o1,o2)
101+branch f g =
111102 let double = pure (\i -> (i,i))
112− in double >>> stack f g
113−
114−(&&&) : Automaton i o1 -> Automaton i o2 -> Automaton i (o1,o2)
115−(&&&) = and
103+ in double `before` pair f g
116104
117105combi: Automaton i o -> Automaton i [o] -> Automaton i [o]
118−combi a1 a2 = (a1 &&& a2) >>> pure (uncurry (::))
106+combi a1 a2 = (a1 `branch` a2) `before` pure (uncurry (::))
119107
120108-- Combine a list of automatons into a single automaton that produces a list.
121109combine : [Automaton i o] -> Automaton i [o]
@@ -123,7 +111,7 @@ combine autos =
123111 let l = length autos
124112 in if l == 0
125113 then pure (\_ -> [])
126− else foldr combi (last autos >>> pure (\a -> [a])) (take (l-1) autos)
114+ else foldr combi (last autos `before` pure (\a -> [a])) (take (l-1) autos)
127115
128116
129117-- Examples of automata