on master help sign in
Merge pull request #4032 from msmorgan/feature/morphism-casts

Data.Morphisms: add casts between compatible morphisms

commit7e957d8bb000a02b1dd60a693755bb465f5c27a1 authorAhmad Salim Al-Sibahi <asal@itu.dk> dateThu 5 Oct 2017, 20:53 (9 years ago) parentc97bf3f48a8923
1 file changed+12
libs/base/Data/Morphisms.idr+12
libs/base/Data/Morphisms.idr+12
@@ -40,3 +40,15 @@ infixr 1 ~>
4040
4141(~>) : Type -> Type -> Type
4242a ~> b = Morphism a b
43+
44+Cast (Endomorphism a) (Morphism a a) where
45+ cast (Endo f) = Mor f
46+
47+Cast (Morphism a a) (Endomorphism a) where
48+ cast (Mor f) = Endo f
49+
50+Monad m => Cast (Morphism a (m b)) (Kleislimorphism m a b) where
51+ cast (Mor f) = Kleisli f
52+
53+Cast (Kleislimorphism m a b) (Morphism a (m b)) where
54+ cast (Kleisli f) = Mor f