GHC error message on type mismatch

Dan Frumin difrumin at gmail.com
Fri Nov 8 05:30:54 UTC 2013


Hi everyone 

> On 07 Nov 2013, at 23:54, Daniel Trstenjak <daniel.trstenjak at gmail.com> wrote:
> 
> 
> Hi Simon,
> 
>> On Thu, Nov 07, 2013 at 02:02:06PM +0000, Simon Peyton-Jones wrote:
>> The motivation is this. Consider
>> 
>>    f True
>> 
>> where f :: Int -> Char
>> 
>> Then 
>>  f *expects* an argument of type Int
>>  but the *actual* argument has type Bool
>> 
>> Does that help?
> 
> If you would switch the meaning of 'Expected' and 'Actual', than it
> still could make perfectly sense and my brain seems to tend to this
> switched meaning.
> 

Yeah I can see how that may happen. 

f's argument type is *actually* an Int, but it was used in a way that caller *expects* it to have a type Bool

> I think my main issue is the word 'Actual'. I seem to associate
> something more authoritative with this word and not just a wrongly given
> type by the user, and on the other side 'Expected' doesn't feel authoritative
> enough.
> 
> Yes, I think the combination of the words 'Expected' and 'Actual' is
> irritating me and that I'm perceiving 'Actual' as the more authoritative one.
> 
> 
> 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'.
> 
> 
> Greetings,
> Daniel
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


More information about the Glasgow-haskell-users mailing list