module RSAGL.FRP.FRPModel
(Enabled,
Disabled,
Capability,
FRPModel(..),
FRP1,
FRPX,
FRPContext,
FRP1Context,
IODisabled,
Switch,
SimpleSwitch)
where
import RSAGL.FRP.RecombinantState
class RSAGL_FRP_FRPMODEL a where
data Enabled
data Disabled
class (RSAGL_FRP_FRPMODEL a) => Capability a where
instance RSAGL_FRP_FRPMODEL Enabled where
instance Capability Enabled where
instance RSAGL_FRP_FRPMODEL Disabled where
instance Capability Disabled where
class (RSAGL_FRP_FRPMODEL frp,Eq (ThreadIDOf frp)) => FRPModel frp where
type ThreadingOf frp :: *
type ThreadIDOf frp :: *
type StateOf frp :: *
type SwitchInputOf frp :: *
type SwitchOutputOf frp :: *
type InputOutputOf frp :: *
type Unwrap frp :: *
instance RSAGL_FRP_FRPMODEL () where
instance FRPModel () where
type ThreadingOf () = Disabled
type ThreadIDOf () = ()
type StateOf () = ()
type SwitchInputOf () = ()
type SwitchOutputOf () = ()
type InputOutputOf () = Disabled
type Unwrap () = ()
data Switch k t s io i o m
instance (RSAGL_FRP_FRPMODEL m, Capability k) =>
RSAGL_FRP_FRPMODEL (Switch k t s io i o m) where
instance (RSAGL_FRP_FRPMODEL m, Eq t, Capability k) =>
FRPModel (Switch k t s io i o m) where
type ThreadingOf (Switch k t s io i o m) = k
type ThreadIDOf (Switch k t s io i o m) = t
type StateOf (Switch k t s io i o m) = s
type SwitchInputOf (Switch k t s io i o m) = i
type SwitchOutputOf (Switch k t s io i o m) = o
type InputOutputOf (Switch k t s io i o m) = io
type Unwrap (Switch k t s io i o m) = m
type FRP1 s i o = Switch Disabled () s Enabled i o ()
type FRPX t s i o = FRPContext t i o (FRP1 s i [(t,o)])
type FRPContext t i o m = Switch Enabled
t
(SubState (StateOf m))
(InputOutputOf m)
i
o
m
type FRP1Context i o m = Switch Disabled
(ThreadIDOf m)
(StateOf m)
(InputOutputOf m)
i
o
m
type IODisabled i o m = Switch (ThreadingOf m)
(ThreadIDOf m)
(StateOf m)
Disabled
i
o
m
type SimpleSwitch k t s i o m = Switch k t s Enabled i o m