[Haskell-cafe] Parsec float
derek.a.elkins at gmail.com
Sat May 30 14:42:49 EDT 2009
On Sat, May 30, 2009 at 1:12 PM, Jason Dusek <jason.dusek at gmail.com> wrote:
> 2009/05/30 Bartosz Wójcik <bartek at sudety.it>:
>> ...reading RWH I could not memorize what those liftM funtions
> The basic one, `liftM`, means `fmap`, though specialized for
> functors that are monads.
> Prelude Control.Monad> :t liftM
> liftM :: forall a b (m :: * -> *). (Monad m) => (a -> b) -> m a -> m b
> Prelude Control.Monad> :t fmap
> fmap :: forall a b (f :: * -> *). (Functor f) => (a -> b) -> f a -> f b
> I think we have `liftM` either to help the inferencer or due
> to the absence of a `(Functor m)` constraint in the definition
> of the `Monad` typeclass.
It's the latter effectively. liftM doesn't make anything easier for
the type checker. liftM simply has a different type than fmap, not a
more specialized one, but even if Monad did have a Functor constraint,
liftM would still never lead to any ambiguity being resolved.
More information about the Haskell-Cafe