You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And when I type in the console 6 -> x {x say} call it prints 6, so far so good. But when I type 6, -> x {x say}, and call in separate lines (like in the file), it says I can't find an instantiation of '_::show': _::show<T>, which it should not. It should print 6. It says the same error for "Lambda!".
The text was updated successfully, but these errors were encountered:
Thanks for bringing this to my attention. I was aware of this bug, but unfortunately I haven’t found a great way to solve it yet.
Essentially, each entry in the console is added to the interpreter state as a separate definition, partly so that they can be referenced later as interactive::entryN. When one of these definitions is generic, like -> x { x say } by itself†, the compiler fails to generate an instantiation of that definition for a particular concrete type, so instead of looking up show<Int32> or show<List<Char>>, it tries to look up the generic show<T>, which fails because that’s not a real instance definition.
For now you can work around this by avoiding generic entries in interactive mode, or using a source file, but I’ll bump this up on my to-do list and figure out how to fix it properly.
†NB: This is unrelated to your question, but the type of -> x { x say } is currently slightly wrong as well: it’s inferred as <T> (-> (T -> +IO)), but it should eventually include a trait constraint, something like <T> (-> (T -> +IO)) where (show<T>). This should help the compiler produce a better error message in similar situations.
I have a program
Say lambda.ktn
which contains:It prints
And when I type in the console
6 -> x {x say} call
it prints6
, so far so good. But when I type6
,-> x {x say}
, andcall
in separate lines (like in the file), it saysI can't find an instantiation of '_::show': _::show<T>
, which it should not. It should print6
. It says the same error for"Lambda!"
.The text was updated successfully, but these errors were encountered: