on master help sign in
Revert "Use case rather than let"
85b2230Matthew Pickering
src/Data/Generics/Internal/VL/Lens.hs+2−2
@@ -50,8 +50,8 @@ set l x = l .~ x
50lens2lensvl :: ALens a b s t -> Lens s t a b
50lens2lensvl :: ALens a b s t -> Lens s t a b
51lens2lensvl (ALens _get _set) =
51lens2lensvl (ALens _get _set) =
52 \f x ->
52 \f x ->
53− case _get x of
53+ let (c, a) = oneShot _get (inline x)
54− (c, a) -> (_set . (c, )) <$> f a
54+ in oneShot (_set . (c, )) <$> f (inline a)
55{-# INLINE lens2lensvl #-}
55{-# INLINE lens2lensvl #-}
56
56
57ravel :: (ALens a b a b -> ALens a b s t)
57ravel :: (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
49type GHasPosition' i s a = GHasPosition i s s a a
49type GHasPosition' i s a = GHasPosition i s s a a
50
50
51instance (GHasPosition i l l' a b, GHasPosition i r r' a b) => GHasPosition i (l :+: r) (l' :+: r') a b where
51instance (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)
53 {-# INLINE gposition #-}
53 {-# INLINE gposition #-}
54
54
55instance GHasPosition i s t a b => GHasPosition i (M1 D meta s) (M1 D meta t) a b where
55instance 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)
57 {-# INLINE gposition #-}
57 {-# INLINE gposition #-}
58
58
59instance
59instance
60 ( IndexList (i - 1) as bs a b
60 ( IndexList (i - 1) as bs a b
61 , GIsList () f g as bs
61 , GIsList () f g as bs
62 ) => GHasPosition i (M1 C meta f) (M1 C meta g) a b where
62 ) => 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))
64 {-# INLINE gposition #-}
64 {-# INLINE gposition #-}
65
65
66type family Size f :: Nat where
66type family Size f :: Nat where