
23 Jul
2009
23 Jul
'09
9:13 a.m.
On Jul 22, 7:44 pm, Felipe Lessa
type TypeOfF a = a -> Maybe (TypeOfF' a) newtype TypeOfF' a = F {unF :: TypeOfF a}
An interesting observation is that "ListT ((->) a) ()" would also do the job. If one would want to also generalize "filter" this way, a more appropriate type would be "ListT ((->) a) Bool", which could still be used for the generalized takeWhile, dropWhile, etc. You need to import Control.Monad.Reader for the Monad instance of "(-
) a". ListT here isn't the one from mtl, but rather the one from "http:// www.haskell.org/haskellwiki/ListT_done_right" or from the "generator" package in hackage.