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
The dropAnnotation' case is awkward however, because we know SOP.AllZip2 Annotate' (SOP.Code a) (SOP.Code b), but we need something that relates SOP.Code b and SOP.Code a (rather than the other way around). In the end I wrote the below; perhaps we could/should give this a place in the lib somewhere?
Code
classcyx=>Inv (c::l->k->Constraint) (x::k) (y::l)
instancecyx=>Inv (c::l->k->Constraint) (x::k) (y::l)
dataDict2 (c::k->k->Constraint) (x::k) (y::k) whereDict2::cxy=>Dict2cxyinvZip::forallkc (xs:: [k]) (ys:: [k]).SOP.AllZipcxsys=>Proxyc->Proxyys->Proxyxs->Dict2 (SOP.AllZip (Invc)) ysxs
invZip _ _ _ = go SOP.shape SOP.shape
wherego::forallxs'ys'.SOP.AllZipcxs'ys'=>SOP.Shapexs'->SOP.Shapeys'->Dict2 (SOP.AllZip (Invc)) ys'xs'
go SOP.ShapeNilSOP.ShapeNil=Dict2
go (SOP.ShapeCons xs) (SOP.ShapeCons ys) =case go xs ys ofDict2->Dict2zipImplies::forallkcd (xs:: [k]) (ys:: [k]).SOP.AllZipcxsys=>Proxyc->Proxyd->Proxyxs->Proxyys-> (forallxy.cxy=>Proxyx->Proxyy->Dict2dxy)
->Dict2 (SOP.AllZipd) xsys
zipImplies _ _ _ _ f = go SOP.shape SOP.shape
wherego::forallxs'ys'.SOP.AllZipcxs'ys'=>SOP.Shapexs'->SOP.Shapeys'->Dict2 (SOP.AllZipd) xs'ys'
go SOP.ShapeNilSOP.ShapeNil=Dict2
go (SOP.ShapeCons xs) (SOP.ShapeCons ys) =case (f (Proxy@(SOP.Headxs')) (Proxy@(SOP.Headys')), go xs ys) of
(Dict2, Dict2) ->Dict2invAllZip::forallk (c::k->k->Constraint) (xss:: [[k]]) (yss:: [[k]]).SOP.AllZip (Inv (SOP.AllZipc)) xssyss=>Proxyc->Proxyxss->Proxyyss->Dict2 (SOP.AllZip (SOP.AllZip (Invc))) xssyss
invAllZip pc pxss pyss =
zipImplies
(Proxy@(Inv (SOP.AllZipc)))
(Proxy@(SOP.AllZip (Invc)))
pxss
pyss
(invZip pc)
invZip2::forallkc (xss:: [[k]]) (yss:: [[k]]).SOP.AllZip2cxssyss=>Proxyc->Proxyyss->Proxyxss->Dict2 (SOP.AllZip2 (Invc)) yssxss
invZip2 pc pyss pxss =case invZip (Proxy@(SOP.AllZipc)) pyss pxss ofDict2->case invAllZip pc pyss pxss ofDict2->Dict2htransInv_SOP::forallkcfg (xss:: [[k]]) (yss:: [[k]]).SOP.AllZip2cyssxss=>Proxyc-> (forallxy.cyx=>fx->gy)
->SOPfxss->SOPgyss
htransInv_SOP pc f =case invZip2 pc (Proxy@xss) (Proxy@yss) ofDict2->SOP.htrans (Proxy@(Invc)) f
The text was updated successfully, but these errors were encountered:
edsko
added a commit
to BeFunctional/haskell-foreign-rust
that referenced
this issue
Mar 23, 2023
Motivation
Not sure where this belongs, and in exactly what shape, but I had a class
for which I support generic deriving:
The
dropAnnotation'
case is awkward however, because we knowSOP.AllZip2 Annotate' (SOP.Code a) (SOP.Code b)
, but we need something that relatesSOP.Code b
andSOP.Code a
(rather than the other way around). In the end I wrote the below; perhaps we could/should give this a place in the lib somewhere?Code
The text was updated successfully, but these errors were encountered: