[Haskell-cafe] chr/ord?

Yitzchak Gale gale at sefer.org
Wed Apr 29 04:30:27 EDT 2009


Michael Rice wrote:
> -- comb is a combinator for sequencing operations that return Maybe
> comb :: Maybe a -> (a -> Maybe b) -> Maybe b
> comb Nothing  _ = Nothing
> comb (Just x) f = f x

comb is essentially the same as something in the Prelude:
it is just (>>=) specialized to Maybe.

(>>=) :: Monad m => m a -> (a -> m b) -> m b

> Now what am I misunderstanding in the code below?
> lst = [('A',65),('B',66),('C',67),('D',68)]

Brandon S. Allbery wrote:
> ...it defaulted to [(Char,Integer)].  This is a manifestation
> of the Monomorphism Restriction...

While it may be debatable whether the Monomorphism
Restriction is helpful in compiled code, it is unquestionably
a major nuisance at the GHCi prompt, for this and other
reasons.

I highly recommend that you create a .ghci file in your home
directory containing the line:

:set -XNoMonomorphismRestriction

In my opinion, MR should be off by default in GHCi.

-Yitz


More information about the Haskell-Cafe mailing list