[Haskell-cafe] Trouble using State Monad.

David Barbour dmbarbour at gmail.com
Sun Oct 9 02:27:06 CEST 2011


On Sat, Oct 8, 2011 at 4:28 PM, Captain Freako <capn.freako at gmail.com>wrote:

>
>  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 that case.
>

Input to Filter would be modeled with:  'a -> Filter e b'.

I would rename your 'runFilter' to 'unFilter', then define a function
'runFilter' accepting an initial FilterState.

Regards,

- db
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111008/ca6a3082/attachment.htm>


More information about the Haskell-Cafe mailing list