Frege / frege-repl

Frege REPL
78 stars 17 forks source link

Difference in behavior with inline and multi-line definition with type annotation #13

Closed mmhelloworld closed 10 years ago

mmhelloworld commented 10 years ago
frege> type F = (forall b. [b] -> [b]) -> Int
type alias F :: ?

frege> g :: F -> Int; g f = undefined
4: application of g will diverge.
4: Type [b]->[b]
inferred from  g is not as polymorphic as
expected type  forall b.[b] -> [b]

frege> :{
> g :: F -> Int
> g f = undefined
> :}
function g :: ((forall b.[b] -> [b]) -> Int) -> Int
mmhelloworld commented 10 years ago

Fixed with https://github.com/Frege/frege-interpreter/commit/04a9019d7a8270e04a54afe57c766e05deddfdc4 .

Both command line REPL and online REPL now support the following:

frege> type F = (forall b. [b] -> [b]) -> Int
type alias F :: ?

frege> g :: F -> Int; g f = undefined
function g :: ((forall b.[b] -> [b]) -> Int) -> Int