Your filter type isn't a Monad.
In particular
bind :: (a - EitherT e (State FilterState) a) - (a - b - EitherT e
(State FilterState) b) - b - EitherT e (State FilterState) b
can't be implemented, as you have no place to grab an 'a' to pass to the
initial computation.
If you fix the input type,
On Oct 9, 2011 11:17 PM, David Barbour dmbarb...@gmail.com wrote:
If you really want the input type to be part of the Filter type
definition, you'll need to use arrows instead of monads.
I wouldn't say that. You just need an extra type parameter. That doesn't
mean it can't be a monad. In fact,
Hi David,
Thanks for the reply.
In trying to follow your advice, I arrived at this code:
17 newtype Filter e a = F {
18 runFilter :: EitherT e (State FilterState) a
19 } deriving (Monad, MonadState FilterState)
20
21 applyFilter :: Filter e a - FilterState - a - (Either e a,
On Sun, Oct 9, 2011 at 7:57 PM, Captain Freako capn.fre...@gmail.comwrote:
21 applyFilter :: Filter e a - FilterState - a - (Either e a,
FilterState)
22 applyFilter f s x = runState (runEitherT (runFilter f)) s
I still don't understand how I'm supposed to feed the input, `x', into the
Hi all,
I'm trying to use the State Monad to help implement a digital filter:
17 newtype Filter e a = F {
18 runFilter :: a - EitherT e (State FilterState) a
19 } deriving (Monad, MonadState FilterState)
but I'm getting these compiler errors:
Filter.hs:19:14:
Can't make a derived
On Sat, Oct 8, 2011 at 4:28 PM, Captain Freako capn.fre...@gmail.comwrote:
17 newtype Filter e a = F {
* 18 runFilter :: EitherT e (State FilterState) a
** * 19 } deriving (Monad, MonadState FilterState)
it compiles, but I can't figure out how I'd feed the input to the filter,
in
On Sat, Oct 08, 2011 at 04:28:34PM -0700, Captain Freako wrote:
Hi all,
I'm trying to use the State Monad to help implement a digital
filter:
(a - EitherT e (State FilterState) a) is definitely not monadic.
There is an 'a' in a negative position (to the left of an odd number
of arrows) so it