Skip to content

higher rank types are killed? #3

@Ingo60

Description

@Ingo60

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
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions