Skip to content

Instantly share code, notes, and snippets.

@fogti
Created September 15, 2023 09:21
Show Gist options
  • Save fogti/d0644c77405bd6451fbf2d33647da571 to your computer and use it in GitHub Desktop.
Save fogti/d0644c77405bd6451fbf2d33647da571 to your computer and use it in GitHub Desktop.
Dependent Profunctor
interface HiProfunctor (0 p : (0 xt : Type) -> (xt -> Type) -> Type) where
dimap : (a, b : Type) -> (c : b -> Type) -> (d : (a -> Type))
-> (ab : (a -> b)) -> ((y : a) -> c (ab y) -> d y)
-> p b c -> p a d
data DepFun : (0 xt : Type) -> (xt -> Type) -> Type where
DF : (0 xt : Type) -> (yt : xt -> Type) -> ((x : xt) -> yt x) -> DepFun xt yt
HiProfunctor DepFun where
dimap a b c d ab acd (DF _ _ bc) = DF a d (\av : a => acd av (bc (ab av)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment