[Haskell-cafe] A voyage of undiscovery

Ross Mellgren rmm-haskell at z.odi.ac
Thu Jul 16 15:42:56 EDT 2009


It's not where -- let also works

let { foo Prelude> let { foo x = x } in (foo 1, foo True)
(1,True)

Can you send the code you're trying that doesn't work?

-Ross

On Jul 16, 2009, at 3:40 PM, Andrew Coppin wrote:

> Robert Greayer wrote:
>> f0 _ = (foo True, foo 'x') where foo = id
>>
>> is well-typed.
>>
>
> Really? That actually works? How interesting... This suggests to me  
> that where-clauses also do strange things to the type system.
>
>> whereas
>>
>> f1 foo = (foo True, foo 'x')
>>
>> requires 'foo' to be polymorphic in its first argument.  This does
>> require a higher rank type, which can't be inferred:
>>
>> You could type f1 as
>> f1 :: (forall a . a -> a)  -> (Bool, Char)
>>
>> and apply it to 'id'.
>>
>> Or you could type it as something like:
>> f1 :: (forall a . a -> ()) -> ((),())
>>
>> and apply it to 'const ()'
>
> ...all of which is beyond Haskell-98, which is what I am limiting  
> myself to at present.
>
> (Actually, even that is a lie. I don't have type-classes yet...)
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list