Skip to content

Instantly share code, notes, and snippets.

@Lysxia
Last active September 18, 2019 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lysxia/96c9dd35601f41bf385309dffb1bbfec to your computer and use it in GitHub Desktop.
Save Lysxia/96c9dd35601f41bf385309dffb1bbfec to your computer and use it in GitHub Desktop.
class GFunctor (p :: c -> c -> *) (q :: d -> d -> *) (f :: c -> Exp d)
where
gfmap :: p x y -> q (f @@ x) (f @@ y)
instance (GFunctor p q f, GFunctor q r g) => GFunctor p r (g . f) where
gfmap = gfmap @q @r @g . gfmap @p @q @f
data (.) :: (d -> Exp e) -> (c -> Exp d) -> (c -> Exp e)
type instance Eval ((f . g) x) = Eval (f (Eval (g x))
instance GFunctor (->) (->) (Pure1 (->)) where ...
instance GFunctor (->) (->) (Pure1 ((,) x))) where ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment