-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Arrowized functional state machines
--
-- Arrowized functional state machines. This module is inspired by Yampa
-- and the paper Functional Reactive Programming, Continued*
-- written by Henrik Nilsson, Antony Courtney and John Peterson.
@package AFSM
@version 0.1.2.0
module Control.AFSM.Event
-- | Event type, there are 4 different events: event a, no event,
-- error event string and exit event.
data Event a
Event :: a -> Event a
NoEvent :: Event a
ErrEvent :: String -> Event a
ExitEvent :: Event a
instance GHC.Classes.Ord a => GHC.Classes.Ord (Control.AFSM.Event.Event a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Control.AFSM.Event.Event a)
instance GHC.Show.Show a => GHC.Show.Show (Control.AFSM.Event.Event a)
-- | Arrowized functional state machines.
--
-- This module is inspired by Yampa and the paper Functional Reactive
-- Programming, Continued* written by Henrik Nilsson, Antony Courtney
-- and John Peterson.
module Control.AFSM
-- | Event type, there are 4 different events: event a, no event,
-- error event string and exit event.
data Event a
Event :: a -> Event a
NoEvent :: Event a
ErrEvent :: String -> Event a
ExitEvent :: Event a
-- | SM is a type representing a state machine.
data SM a b
-- | SMState is the transition function s: storage, a: input, b:
-- output
type SMState s a b = s -> a -> (SM a b, b)
-- | It is the same with the SM constructor.
newSM :: (SMState s a b) -> s -> SM a b
-- | build a simple SM which have only one SMState.
simpleSM :: (s -> a -> (s, b)) -> s -> SM a b
-- | build a SM which always return b
constSM :: b -> SM a b
idSM :: SM a a
-- | the same with foldl
foldlSM :: (s -> a -> s) -> s -> SM a s
-- | the difference from foldlSM is it output the storage first.
foldlDelaySM :: (s -> a -> s) -> s -> SM a s
-- | delay the input with given value. delaySM = foldlDelaySM (const id)
delaySM :: a -> SM a a
-- | converts SM a b -> SM [a] [b], it is very useful to compose SM a
-- [b] and SM b c to SM a [c].
execSM :: SM a b -> SM [a] [b]
concatSM :: SM a [[b]] -> SM a [b]
-- | execute SM a b with input [a].
exec :: SM a b -> [a] -> (SM a b, [b])
instance Control.Category.Category Control.AFSM.SM
instance Control.Arrow.Arrow Control.AFSM.SM
instance Control.Arrow.ArrowChoice Control.AFSM.SM
instance Control.Arrow.ArrowApply Control.AFSM.SM
instance Control.Arrow.ArrowLoop Control.AFSM.SM
instance GHC.Base.Functor (Control.AFSM.SM a)