koka
koka copied to clipboard
Unresolved implicit parameter
Discussed in https://github.com/koka-lang/koka/discussions/467
Originally posted by woojamon February 8, 2024
May I ask why the show
function is not implicity resolved in the example below?
// main.kk
type myType
MyCase(value:int)
fun show(result:error<myType>) : pure string
match result
Ok(m) -> "MyCase"
Error(x) -> exn/show(x)
fun eq(left:error<myType>, right:error<myType>) : pure bool
match (left,right)
(Ok(_),Ok(_)) -> True
(Error(l), Error(r)) -> l.message == r.message
_ -> False
pub fun myFun(p1:a, p2:a, ?eq:(a,a) -> pure bool, ?show:a -> pure string)
"hello"
fun main()
myFun(Ok(MyCase(1)),Ok(MyCase(2)))
main.kk(19,36): error: cannot resolve implicit parameter context : myFun(Ok(MyCase(1)),Ok(MyCase(2))) parameter : ?show : (error<myType>) -> pure string candidates: ... hint : add a (implicit) parameter to the function signature?
This seems like a bug