Re: [Haskell-cafe] Hiding "growing" state using existentials.

2011-08-16 Thread Tom Schouten
On 08/16/2011 09:23 AM, Stephen Tetley wrote: > {- > I don't think parametric monads will solve your problem though, as you > want a product of the states as the result of bind. Are you really > sure you want this behavior?, I'd imagine it breaks the monad laws > anyway. > -} It seems that the pr

Re: [Haskell-cafe] Hiding "growing" state using existentials.

2011-08-16 Thread Stephen Tetley
You can't define (>>=) if your state type changes: (>>=) :: m a -> (a -> m b) -> m c Whereas, your bind is effectively three different parametric types: _bind :: m1 a -> (a -> m2 b) -> m3 b You can use parametric monads to represent state changing within a monad. Oleg Kiselyov has tutorials on

[Haskell-cafe] Hiding "growing" state using existentials.

2011-08-15 Thread Tom Schouten
Dear Cafe, I'm building an abstraction for representing sequences as difference equations, storing initial values and update equation. I have something that resembles a Monad, but has an extra state parameter s that "grows" on _join or _bind, so I can't simply create an instance Monad (Sig s).