@@ -23,7 +23,7 @@ import Control.Lens.Empty
2323import Control.Lens.SemiIso
2424import Data.Tuple.Morph
2525
26−infixl 3 /|/
26+infixl 3 /|/, /?/
2727infixl 4 /$/, ~$/, /$~, ~$~
2828infixl 5 /*/, /*, */
2929infixl 1 //=
@@ -66,17 +66,13 @@ class SemiIsoFunctor f where
6666(/$~) :: (SemiIsoFunctor f, HFoldable b', HFoldable b,
6767 HUnfoldable b', HUnfoldable b, Rep b' ~ Rep b)
6868 => ASemiIso' a b' -> f b -> f a
69−-- TODO GHC 7.10: haddock doesn't work with pattern synynonyms yet
70−-- (SemiIso f g) /$~ h = semiIso f g . morphed /$/ h
71−ai /$~ h = withSemiIso ai $ \f g -> semiIso f g . morphed /$/ h
69+ai /$~ h = cloneSemiIso ai . morphed /$/ h
7270
7371-- | > ai ~$/ f = morphed . ai /$/ f
7472(~$/) :: (SemiIsoFunctor f, HFoldable a', HFoldable a,
7573 HUnfoldable a', HUnfoldable a, Rep a' ~ Rep a)
7674 => ASemiIso' a' b -> f b -> f a
77−-- TODO GHC 7.10: haddock doesn't work with pattern synynonyms yet
78−--(SemiIso f g) ~$/ h = morphed . semiIso f g /$/ h
79−ai ~$/ h = withSemiIso ai $ \f g -> morphed . semiIso f g /$/ h
75+ai ~$/ h = morphed . cloneSemiIso ai /$/ h
8076
8177-- | > ai ~$~ f = morphed . ai . morphed /$/ f
8278(~$~) :: (SemiIsoFunctor f,
@@ -85,9 +81,7 @@ ai ~$/ h = withSemiIso ai $ \f g -> morphed . semiIso f g /$/ h
8581 HFoldable b', HUnfoldable b',
8682 Rep b' ~ Rep b, Rep b' ~ Rep a)
8783 => ASemiIso b' b' b' b' -> f b -> f a
88−-- TODO GHC 7.10: haddock doesn't work with pattern synynonyms yet
89−--(SemiIso f g) ~$~ h = morphed . semiIso f g . morphed /$/ h
90−ai ~$~ h = withSemiIso ai $ \f g -> morphed . semiIso f g . morphed /$/ h
84+ai ~$~ h = morphed . cloneSemiIso ai . morphed /$/ h
9185
9286-- | Equivalent of 'Applicative' for 'SemiIsoFunctor'.
9387--
@@ -137,6 +131,10 @@ class SemiIsoApply f => SemiIsoAlternative f where
137131
138132 {-# MINIMAL siempty, (/|/) #-}
139133
134+-- | Provides an error message in the case of failure.
135+(/?/) :: SemiIsoAlternative f => f a -> String -> f a
136+f /?/ msg = f /|/ sifail msg
137+
140138-- | An analogue of 'Monad' for 'SemiIsoFunctor'.
141139--
142140-- Because of the 'no throwing away' rule bind has to \"return\"