admin管理员组文章数量:1321074
Say I have the following interface in idris:
interface I a b where
x : a
y : b
And then I try to define the following function:
x' : I a b => a
x' = x
But then I get this error:
Error: While processing right hand side of x'. Can't find an implementation for I a ?b.
Main:06:6--06:7
02 | x : a
03 | y : b
04 |
05 | x' : I a b => a
06 | x' = x
^
How do I specify to idris that x
is the x from I a b
and not the x from I a ?b
?
Say I have the following interface in idris:
interface I a b where
x : a
y : b
And then I try to define the following function:
x' : I a b => a
x' = x
But then I get this error:
Error: While processing right hand side of x'. Can't find an implementation for I a ?b.
Main:06:6--06:7
02 | x : a
03 | y : b
04 |
05 | x' : I a b => a
06 | x' = x
^
How do I specify to idris that x
is the x from I a b
and not the x from I a ?b
?
1 Answer
Reset to default 1Found the answer! b
is essentially an implicit argument to x
so you can set it just like you would for a function:
x' : I a b => a
x' = x { b = b }
本文标签: How to specify the interface from which an object comes from in idrisStack Overflow
版权声明:本文标题:How to specify the interface from which an object comes from in idris - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742092071a2420328.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论