Frege / frege-repl

Frege REPL
78 stars 17 forks source link

Top level definition fails when it shouldn't #15

Closed Ingo60 closed 9 years ago

Ingo60 commented 9 years ago

See the transcript:

ingo@obonto:~$ repl
Welcome to Frege 3.21.586-g026e8d7 (Oracle Corporation Java HotSpot(TM) 64-Bit Server VM, 1.7.0_51)

frege> :{
test :: Num a => a -> String
test 2 = "two"
:}

function test :: Num a => a -> String
[WARNING: 4]: guard (fromInt 2 `Eq.==` 2) may evaluate to false.

Fine, so far.

frege> but :: Num a => a -> String; but 2 = "two"
[ERROR: 5]: type `Int` is not as polymorphic as suggested in the annotation where just `a` is announced.
[HINT: 5]: The inferred type must be at least as polymorphic as the annotated one.
[ERROR: 5]: type error in  expression but type is   a used as   Int

This is exactly the same, just given in one line. Why is it treated differently?

And the following is also ok:

frege> let but :: Num a => a -> String; but 2 = "two" in but 2.0
two
mmhelloworld commented 9 years ago

All the above snippets work fine with the latest REPL. Your version is not up-to date, maybe? The snippets work fine in the online REPL too.

Ingo60 commented 9 years ago

Hmmm, sorry for that then. The version I use is from Nov 2 (as indicated by the unpacked files).

Can you make available the newer release for download?

mmhelloworld commented 9 years ago

The release was already available under 1.0.3-SNAPSHOT release. I had been updating the jar under the same version since it was a snapshot. I have now made a new release 1.1 here: https://github.com/Frege/frege-repl/releases/download/1.1/frege-repl-1.1.zip.

Ingo60 commented 9 years ago

Ok, thank you, Marimuthu. Since my internet connection is quite slow at times I usually look twice before I download something. And because the date was "Nov 2" I though it wouldn't help anyway, so didn't try.

Next time I shall simply build the HEAD before complaining :)