Problems with instance arguments in Agda

人走茶凉 提交于 2019-12-05 21:58:15

There was a recent email by Nils Anders Danielsson at the agda-dev mailing list precisely about this. I cannot find it online, so here is a quote:

Conor uses lots of instance arguments in "How to Keep Your Neighbours in Order". However, his code was written using the old variant of the instance arguments, and fails to check now. I managed to make the code work again using some small tweaks, and wonder if we could get away with even less:

I replaced

record One : Set where constructor it

with

record One : Set where
  instance
    constructor it.

This seems fine with me.

I replaced

_:-_ : forall {P T} -> <P P P> -> (P => T) -> T
! :- t = t

with

_:-_ : forall {P T} -> <P P P> -> (P => T) -> T
! {{prf = p}} :- t = t {{p = p}},

because "Instance search can only be used to find elements in a named type". Similarly, in two cases I replaced a module parameter

(L : REL P)

with

(L' : REL P) (let L = Named L'),

where Named is a named type family:

data Named {P : Set} (A : REL P) : REL P where
  named : forall {x} -> A x -> Named A x
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!