Sun Aug 21 17:18:40 CEST 2011
Towards 1 / 1 - z
It doesn't seem too hard now to define Num class for the Arrows.
Would it be possible to also define rational functions? That would be
Maybe the Num class is simpler to do through defining Applicative
instance Functor (SigOp i) where
fmap f op = (arr f) . op
instance Applicative (SigOp i) where
pure f = arr $ \_ -> f
(<*>) f a = (arr $ \(f,a) -> f a) . (f &&& a)
instance (Num o, Show (SigOp i o), Eq (SigOp i o)) =>
Num (SigOp i o) where
(+) = liftA2 (+)
(*) = liftA2 (*)
abs = fmap abs
signum = fmap signum
fromInteger = pure . fromInteger
But this is not really what I want.
I want (z + 1) to mean (z + id).
and (z * z) (z . z)
The real problem is that I'm confusing generic state space models
(i.e. non-linear ones) with linear ones that might support a different
notation in terms of z operator polynomials.