intellij-frege icon indicating copy to clipboard operation
intellij-frege copied to clipboard

Unresolved reference ':'

Open Dierk opened this issue 3 years ago • 6 comments

It appears that the colon cons operator is not recognized (?) in

main = do
    println $ 1 : []

even though the code compiles and runs fine

Dierk avatar Jul 07 '21 11:07 Dierk

Yes, I know about this and couldn't figure out how to fix it. The problem is that I couldn't find a place where the colon constructor is defined. Is that true that it's not defined in the usual way and hidden in compiler?

kkarnauk avatar Jul 07 '21 12:07 kkarnauk

the infix operator is declared in PreludeBase line 104 ...

Dierk avatar Jul 07 '21 12:07 Dierk

the colon will be rewritten as "Cons" in Mangle.fr line 76 mangled ":" = "Cons"

Dierk avatar Jul 07 '21 12:07 Dierk

Okay, thanks! I'll take a look at that.

kkarnauk avatar Jul 07 '21 12:07 kkarnauk

BTW: if you run 1:[] in the frege repl http://86.119.43.169:9999 and look at the java code with :java then you see

final public static PreludeBase.TList<Integer> frege_interpreter_var1 = PreludeBase.TList.DCons.<
  Integer
>mk(Thunk.<Integer>lazy(1), PreludeBase.TList.DList.<Integer>mk());

meaning the: is translated to the Cons constructor of Frege's List type.

Dierk avatar Jul 07 '21 13:07 Dierk

Ha, I just came across it again (as it is a quite often-used feature) and checked whether it has been reported before and it was - by me! lol.

Dierk avatar Nov 10 '21 09:11 Dierk