[Haskell-cafe] Re: Error message reform

Tillmann Rendel rendel at cs.au.dk
Sat May 30 08:04:32 EDT 2009


wren ng thornton wrote:
> (Though it doesn't necessarily generalize to cover similar messages like:
> 
>     Prelude> :t (\x -> x) :: a -> b
>     <interactive>:1:7:
>         Couldn't match expected type `b' against inferred type `a'
>           `b' is a rigid type variable bound by
>           the polymorphic type `forall a b. a -> b' at <interactive>:1:0
>           `a' is a rigid type variable bound by
>           the polymorphic type `forall a b. a -> b' at <interactive>:1:0
>         In the expression: x
> )

I find this slightly more complicated case quite confusing with the 
current wording:

   Prelude> :t (\x -> x) :: (a -> b) -> (a -> a)
   <interactive>:1:7:
       Couldn't match expected type `a' against inferred type `b'
         `a' is a rigid type variable bound by
             an expression type signature at <interactive>:1:14
         `b' is a rigid type variable bound by
             an expression type signature at <interactive>:1:19
       In the expression: x
       In the expression: (\ x -> x) :: (a -> b) -> (a -> a)

This message suggests that ghc has inferred type b for x.

   Tillmann


More information about the Haskell-Cafe mailing list