GHC error message on type mismatch

Roman Cheplyaka roma at ro-che.info
Fri Nov 8 07:17:03 UTC 2013


* Daniel Trstenjak <daniel.trstenjak at gmail.com> [2013-11-08 05:54:49+0100]
> Perhaps:
> 
> Couldn't match type `A' with `B´
>     Real  type: B
>     Given type: A
> 
> 
> Or instead of 'Given', like others have suggested: 'Provided' or 'Supplied'.

So far in this thread I haven't seen any suggestions better than status
quo.

E.g.:

  Prelude> (undefined :: Int -> Bool) (undefined :: Bool)

  <interactive>:2:29:
      Couldn't match expected type `Int' with actual type `Bool'
      In the first argument of `undefined :: Int -> Bool', namely
        `(undefined :: Bool)'
      In the expression: (undefined :: Int -> Bool) (undefined :: Bool)
      In an equation for `it':
          it = (undefined :: Int -> Bool) (undefined :: Bool)

This one is quite clear — the compiler expected an argument of type Int,
but it was of type Bool.

Now replace this with Real and Given. Well, Bool for the function
argument is both Real and Given (I gave it this type, and it became its
real type). And calling Int either Real or Given doesn't make any sense.

Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20131108/2dfa831e/attachment.sig>


More information about the Glasgow-haskell-users mailing list