-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
Take the following example, which serves to demonstrate higher rank functions:
foo :: (forall a.[a]->[a]) -> ([Int], [Bool])
foo f = (f [1,2], f [true,false])
This code checks just fine in the compiler. However, in the online REPL it gives nonsensical messages:
frege> bar :: (forall b.[b]->[b]) -> ([Int], [Bool]); bar f = (f [0x1,0x2], [true, false])
4: Type [b]->[b]
inferred from bar is not as polymorphic as
expected type forall b.[b] -> [b]
I also tried this with :{, :}, no difference.
An interesting aspect is that the alternate definition does work:
frege> foo (f::forall a.[a]->[a]) = (f [1,2], f [true,false])
frege> foo reverse
([2, 1], [false, true])
Metadata
Metadata
Assignees
Labels
No labels