intellij-frege
intellij-frege copied to clipboard
Unresolved reference ':'
It appears that the colon cons operator is not recognized (?) in
main = do
println $ 1 : []
even though the code compiles and runs fine
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?
the infix operator is declared in PreludeBase line 104 ...
the colon will be rewritten as "Cons" in Mangle.fr line 76
mangled ":" = "Cons"
Okay, thanks! I'll take a look at that.
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.
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.