on master help sign in
Revert "Use case rather than let"

This reverts commit 97aaeac19298d545e235d1227ff5998feb6dd5b1.

commit85b22306e3045a8936aea57377854ed42be3c61e authorMatthew Pickering <matthewtpickering@gmail.com> dateWed 24 Jan 2018, 11:48 (9 years ago) parent762db01
2 files changed+5−5
src/Data/Generics/Internal/VL/Lens.hs+2−2 src/Data/Generics/Product/Internal/Positions.hs+3−3
src/Data/Generics/Internal/VL/Lens.hs+2−2
@@ -50,8 +50,8 @@ set l x = l .~ x
5050lens2lensvl :: ALens a b s t -> Lens s t a b
5151lens2lensvl (ALens _get _set) =
5252 \f x ->
53− case _get x of
54− (c, a) -> (_set . (c, )) <$> f a
53+ let (c, a) = oneShot _get (inline x)
54+ in oneShot (_set . (c, )) <$> f (inline a)
5555{-# INLINE lens2lensvl #-}
5656
5757ravel :: (ALens a b a b -> ALens a b s t)
src/Data/Generics/Product/Internal/Positions.hs+3−3
@@ -49,18 +49,18 @@ class GHasPosition (i :: Nat) (s :: Type -> Type) (t :: Type -> Type) a b | s i
4949type GHasPosition' i s a = GHasPosition i s s a a
5050
5151instance (GHasPosition i l l' a b, GHasPosition i r r' a b) => GHasPosition i (l :+: r) (l' :+: r') a b where
52− gposition = sumIso . choosing (gposition @i) (gposition @i)
52+ gposition = \x -> sumIso (choosing (gposition @i) (gposition @i) x)
5353 {-# INLINE gposition #-}
5454
5555instance GHasPosition i s t a b => GHasPosition i (M1 D meta s) (M1 D meta t) a b where
56− gposition = mLens . gposition @i
56+ gposition x = mLens (gposition @i x)
5757 {-# INLINE gposition #-}
5858
5959instance
6060 ( IndexList (i - 1) as bs a b
6161 , GIsList () f g as bs
6262 ) => GHasPosition i (M1 C meta f) (M1 C meta g) a b where
63− gposition = mIso . glist @() . point @(i - 1)
63+ gposition x = mIso (glist @() (point @(i - 1) x))
6464 {-# INLINE gposition #-}
6565
6666type family Size f :: Nat where