[PL-sem-jr] Next Wednesday (5/18): Winskel Ch 5 discussion (5:30pm, WVH 366)
Sam Caldwell
samc at ccs.neu.edu
Tue May 17 18:52:27 EDT 2016
Reminder: this is tomorrow.
On Thu, May 12, 2016 at 2:03 AM, Benjamin Greenman <types at ccs.neu.edu>
wrote:
> RE: today's discussion of when Haskell's type inference fails, here a
> little program that won't compile
>
> foo f a b = f (bar a) (bar b)
>
> bar x = if x <= 1 then x else foo (+) (x - 1) (x - 2)
>
> main = return $ foo (\ x y -> ()) 1 2
>
>
> The error message is about the return type of foo. Haskell wants (+) to
> return something compatible with the Unit type.
> The problem is that unification breaks down for higher-order polymorphic
> types.
>
> OCaml has the same problem (attached, with comments by Drew Weymouth --
> who wrote the original program).
> It's not a bug. We were just worried at the time.
>
>
> (A smaller Haskell program that type inference fails on is `main = return
> $ read "1"` )
>
> On Wed, May 11, 2016 at 6:25 PM, Sam Caldwell <samc at ccs.neu.edu> wrote:
>
>> read and bring your questions!
>>
>> _______________________________________________
>> Pl-sem-jr mailing list
>> Pl-sem-jr at lists.ccs.neu.edu
>> https://lists.ccs.neu.edu/bin/listinfo/pl-sem-jr
>>
>>
>
-------------- next part --------------
HTML attachment scrubbed and removed
More information about the Pl-sem-jr
mailing list