git.iko.soy/semi-iso-optics
on master help sign in
Add siunit.
commit1963cb7adb5e956328a559480347fea6820a789b authorPaweł Nowak <pawel834@gmail.com> dateThu 13 Nov 2014, 08:40 (12 years ago) parentadf1083
1 file changed+9−1
Data/SemiIsoFunctor.hs+9−1
Data/SemiIsoFunctor.hs+9−1
@@ -63,7 +63,15 @@ class SemiIsoFunctor f where
6363--
6464-- > TODO (they should be fine)
6565class SemiIsoFunctor f => SemiIsoApply f where
66+ siunit :: f ()
67+ siunit = sipure id
68+
6669 sipure :: ASemiIso' a () -> f a
70+ sipure ai = ai /$/ siunit
71+
72+ sipureCo :: ASemiIso' () a -> f a
73+ sipureCo ai = ai `simapCo` siunit
74+
6775 (/*/) :: f a -> f b -> f (a, b)
6876
6977 (/*) :: f a -> f () -> f a
@@ -72,7 +80,7 @@ class SemiIsoFunctor f => SemiIsoApply f where
7280 (*/) :: f () -> f b -> f b
7381 f */ g = unit . swapped /$/ f /*/ g
7482
75− {-# MINIMAL sipure, (/*/) #-}
83+ {-# MINIMAL (siunit | sipure), (/*/) #-}
7684
7785-- | Equivalent of 'Alternative' for 'SemiIsoFunctor'.
7886--