Hi

>  The top match of hoogle "(a -> b) -> b" is the inexact match
>
>  Control.Monad.State.Class.gets :: MonadState s m => (s -> a) -> m a
>
>  (which cannot be made to unify with (a -> b) -> b) instead of
>
>  Control.Monad.Cont.runCont (undefined :: Cont r a) :: (a -> r) -> r
>
>  which does.

What if the type of gets was :: (s -> a) -> m a? Would you then think
it was the right choice of ordering? In runCont you are effectively
deleting an argument to get equality, in gets you are simply unifying
"a" and "m a". Since m a is just wrapped in a container (monad in this
case), its entirely feasible the person wanted the monadic version.

The reason Hoogle sees gets without the type class is because
MonadState is a multi-parameter type class, and hence not Haskell 98.
Hoogle simply ignores all MPTC's while doing matching. This will be
fixed in Hoogle 4.

Thanks

Neil
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to