@@ -46,9 +46,6 @@ type Prism s t a b
4646type PrismP s t a b
4747 = forall p . (Choice p) => p a b -> p s t
4848
49−type PrismE s t a b
50− = forall p f. (MRight p, MProfunctor p) => p a b -> p s t
51−
5249type Prism' s a
5350 = Prism s s a a
5451
@@ -61,6 +58,9 @@ type Iso s t a b
6158type IsoE s t a b
6259 = forall p f. (MProfunctor p) => p a b -> p s t
6360
61+type IsoP s t a b
62+ = forall p f. (Profunctor p) => p a b -> p s t
63+
6464-- | Getting
6565(^.) :: s -> ((a -> Const a a) -> s -> Const a s) -> a
6666s ^. l = getConst (l Const s)
@@ -97,14 +97,14 @@ second f (a :*: b)
9797left :: Prism ((a :+: c) x) ((b :+: c) x) (a x) (b x)
9898left = prism L1 $ gsum Right (Left . R1)
9999
100+leftP :: PrismP ((a :+: c) x) ((b :+: c) x) (a x) (b x)
101+leftP = prismP L1 $ gsum Right (Left . R1)
102+
100103right :: Prism ((a :+: b) x) ((a :+: c) x) (b x) (c x)
101104right = prism R1 $ gsum (Left . L1) Right
102105
103−leftE :: PrismE ((a :+: c) x) ((b :+: c) x) (a x) (b x)
104−leftE = prismE L1 $ gsum Right (Left . R1)
105−
106−rightE :: PrismE ((a :+: b) x) ((a :+: c) x) (b x) (c x)
107−rightE = prismE R1 $ gsum (Left . L1) Right
106+rightP :: PrismP ((a :+: b) x) ((a :+: c) x) (b x) (c x)
107+rightP = prismP R1 $ gsum (Left . L1) Right
108108
109109gsum :: (a x -> c) -> (b x -> c) -> ((a :+: b) x) -> c
110110gsum f _ (L1 x) = f x
@@ -114,9 +114,6 @@ combine :: Lens' (s x) a -> Lens' (t x) a -> Lens' ((s :+: t) x) a
114114combine sa _ f (L1 s) = fmap (\a -> L1 (set sa a s)) (f (s ^. sa))
115115combine _ ta f (R1 t) = fmap (\a -> R1 (set ta a t)) (f (t ^. ta))
116116
117−prismE :: (b -> t) -> (s -> Either t a) -> PrismE s t a b
118−prismE bt seta = mdimap (liftFun seta) (EitherFun id bt) . mright
119−
120117prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b
121118prism bt seta eta = dimap (\x -> plus pure id (seta x)) (either id (\x -> fmap bt x)) (right' eta)
122119{-# INLINE prism #-}
@@ -129,8 +126,9 @@ prismP bt seta eta = dimap seta (either id bt) (right' eta)
129126repIso :: (Generic a, Generic b) => Iso a b (Rep a x) (Rep b x)
130127repIso = dimap from (fmap to)
131128
132−repIsoE :: (Generic a, Generic b) => IsoE a b (Rep a x) (Rep b x)
133−repIsoE = ddimap from to
129+-- | A type and its generic representation are isomorphic
130+repIsoP :: (Generic a, Generic b) => IsoP a b (Rep a x) (Rep b x)
131+repIsoP = dimap from to
134132
135133
136134-- | 'M1' is just a wrapper around `f p`
@@ -140,8 +138,8 @@ mIso = dimap unM1 (fmap M1)
140138
141139-- | 'M1' is just a wrapper around `f p`
142140--mIso :: Iso' (M1 i c f p) (f p)
143−mIsoE :: IsoE (M1 i c f p) (M1 i c g p) (f p) (g p)
144−mIsoE = ddimap unM1 M1
141+mIsoP :: IsoP (M1 i c f p) (M1 i c g p) (f p) (g p)
142+mIsoP = dimap unM1 M1
145143
146144-- These are specialised versions of the Isos above. On GHC 8.0.2, having
147145-- these functions eta-expanded allows the optimiser to inline these functions.