[Haskell-cafe] Bug or feature with -XFlexibleContects?

John Goerzen jgoerzen at complete.org
Wed Apr 30 11:25:05 EDT 2008


Hi,

I noticed something odd yesterday.  I had a function of this type:

divByGeneric :: (Integral a, MonadError (DivByError a) m) =>
                 a -> [a] -> m [a]

If I left off the type signature, ghci (with no command-line parameters) 
would load the file just fine, and :t would give this same type back.  But 
if I put the type signature in there -- even an exact cut and paste from 
ghci's :t -- it would complain that it needs -XFlexibleContexts.

It seems odd to me that ghci can infer a type that is illegal for the way it 
was run.  Thoughts?

This is GHC 6.8.2, BTW.

-- John


More information about the Haskell-Cafe mailing list