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
fun test(c: char): maybe<char>
val c1 =
match f(c)
Just(c1) ->
c1
Nothing ->
return Nothing // or `return test(c)`
Just(c1)
fun f(c: char): maybe<char>
Just(c)
fun main()
()
Output:
parse-iter.kk(7,16): type error: Nothing does not match the argument types
context : Nothing
term : Nothing
inferred type: forall<a> maybe<a>
expected type: char
Failed to compile parse-iter.kk
Is this expected?
The type checker does not seem to realize that return returns from the function, it doesn't generate a value for the enclosing expression.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Output:
Is this expected?
The type checker does not seem to realize that
return
returns from the function, it doesn't generate a value for the enclosing expression.Beta Was this translation helpful? Give feedback.
All reactions