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
interface Iface a where
f : a -> ()
g : (() -> a) -> ()
h : ((a -> ()) -> ()) -> ()
the following code should not compile:
interface Iface a where
create : a
Iface (a -> (a, a)) where
create x = (x, x)
dup' : (1 _ : a) -> (a, a)
dup' = create
This is basically the problem of variance, if we consider linear functions a subtype of unrestricted functions then some interfaces are covariant, some contravariant and some invariant, though I'd rather not drag that in, instead I suggest we just make these incompatible.
The text was updated successfully, but these errors were encountered:
Error: While processing right hand side of dup'. Can't find an implementation for Iface ((1 _ : a) -> (a, a)).
test.idr:8:8--8:14
|
8 | dup' = create
| ^^^^^^
While this works for interfaces like:
the following code should not compile:
This is basically the problem of variance, if we consider linear functions a subtype of unrestricted functions then some interfaces are covariant, some contravariant and some invariant, though I'd rather not drag that in, instead I suggest we just make these incompatible.
The text was updated successfully, but these errors were encountered: