packages feed

lens 4.0.5 → 4.0.6

raw patch · 17 files changed

+124/−54 lines, 17 files

Files

.travis.yml view
@@ -9,10 +9,8 @@   #   GHCVER=7.4.2   #   MODE="-fsafe" -# Ingore 7.4.2 failures for now because of the doctest GHC panic. matrix:   allow_failures:-    - env: GHCVER=7.4.2     - env: GHCVER=head  before_install:
CHANGELOG.markdown view
@@ -1,3 +1,11 @@+4.0.6+-----+* `makeLenses` attempt to make the accessors it can under existential quantification.+* Added `(&~)`.+* _Experimental_ support for parallel builds on GHC 7.8 with `cabal install lens -fj`. Due to at last one known issue with GHC, it isn't recommended to use this option when rebuilding lens, as a race condition on at least one platform has been seen in the wild.+* Added `RoleAnnotations` for GHC 7.8.1. These rule out a few user-accessible bottoms that could be caused by creative abuse of the new `Coercible` machinery. However, there was no `unsafeCoerce` exposed.+* Removed some impossible cases that required unwritable instances from the example doctypes.+ 4.0.5 ----- * Added `bimapping` to `Control.Lens.Iso`
HLint.hs view
@@ -34,4 +34,4 @@ infixr 2 <~ infixr 2 <<~ -infixl 1 &, <&>, ??+infixl 1 &, &~, <&>, ??
lens.cabal view
@@ -1,6 +1,6 @@ name:          lens category:      Data, Lenses, Generics-version:       4.0.5+version:       4.0.6 license:       BSD3 cabal-version: >= 1.8 license-file:  LICENSE@@ -175,6 +175,11 @@   default: False   manual: True +-- Attempt a parallel build with GHC 7.8+flag j+  default: False+  manual: True+ library   build-depends:     aeson                     >= 0.7      && < 0.8,@@ -318,6 +323,9 @@    if impl(ghc<7.4)     ghc-options: -fno-spec-constr-count++  if flag(j) && impl(ghc>=7.8)+    ghc-options: -j4    ghc-options: -Wall -fwarn-tabs -O2 -fdicts-cheap -funbox-strict-fields -fmax-simplifier-iterations=10   hs-source-dirs: src
src/Control/Lens/Combinators.hs view
@@ -42,6 +42,7 @@   , (%%~)   , (%%=)   , (&)+  , (&~)   , (<&>)   , (??)   , (<%~)
src/Control/Lens/Fold.hs view
@@ -325,14 +325,10 @@ -- 'takingWhile' :: (a -> 'Bool') -> 'Lens'' s a                        -> 'Fold' s a -- * See note below -- 'takingWhile' :: (a -> 'Bool') -> 'Prism'' s a                       -> 'Fold' s a -- * See note below -- 'takingWhile' :: (a -> 'Bool') -> 'Iso'' s a                         -> 'Fold' s a -- * See note below--- 'takingWhile' :: (a -> 'Bool') -> 'Action' m s a                     -> 'MonadicFold' m s a--- 'takingWhile' :: (a -> 'Bool') -> 'MonadicFold' m s a                -> 'MonadicFold' m s a -- 'takingWhile' :: (a -> 'Bool') -> 'IndexedTraversal'' i s a          -> 'IndexedFold' i s a -- * See note below -- 'takingWhile' :: (a -> 'Bool') -> 'IndexedLens'' i s a               -> 'IndexedFold' i s a -- * See note below -- 'takingWhile' :: (a -> 'Bool') -> 'IndexedFold' i s a                -> 'IndexedFold' i s a -- 'takingWhile' :: (a -> 'Bool') -> 'IndexedGetter' i s a              -> 'IndexedFold' i s a--- 'takingWhile' :: (a -> 'Bool') -> 'IndexedAction' i m s a            -> 'IndexedMonadicFold' i m s a--- 'takingWhile' :: (a -> 'Bool') -> 'IndexedMonadicFold' i m s a       -> 'IndexedMonadicFold' i m s a -- @ -- -- /Note:/ When applied to a 'Traversal', 'takingWhile' yields something that can be used as if it were a 'Traversal', but@@ -370,25 +366,15 @@ -- 'droppingWhile' :: (a -> 'Bool') -> 'IndexPreservingLens'' s a         -> 'IndexPreservingFold' s a -- see notes -- 'droppingWhile' :: (a -> 'Bool') -> 'IndexPreservingGetter' s a        -> 'IndexPreservingFold' s a -- 'droppingWhile' :: (a -> 'Bool') -> 'IndexPreservingFold' s a          -> 'IndexPreservingFold' s a--- 'droppingWhile' :: (a -> 'Bool') -> 'IndexPreservingAction' m s a      -> 'IndexPreservingFold' s a -- @ -- -- @--- 'droppingWhile' :: (a -> 'Bool') -> 'IndexPreservingMonadicFold' m s a -> 'IndexPreservingMonadicFold' m s a--- @------ @ -- 'droppingWhile' :: (a -> 'Bool') -> 'IndexedTraversal'' i s a          -> 'IndexedFold' i s a       -- see notes -- 'droppingWhile' :: (a -> 'Bool') -> 'IndexedLens'' i s a               -> 'IndexedFold' i s a       -- see notes -- 'droppingWhile' :: (a -> 'Bool') -> 'IndexedGetter' i s a              -> 'IndexedFold' i s a -- 'droppingWhile' :: (a -> 'Bool') -> 'IndexedFold' i s a                -> 'IndexedFold' i s a--- 'droppingWhile' :: (a -> 'Bool') -> 'IndexedAction' i m s a            -> 'IndexedFold' i s a -- @ ----- @--- 'droppingWhile' :: (a -> 'Bool') -> 'IndexedMonadicFold' i m s a       -> 'IndexedMonadicFold' i m s a--- @--- -- Note: Many uses of this combinator will yield something that meets the types, but not the laws of a valid -- 'Traversal' or 'IndexedTraversal'. The 'Traversal' and 'IndexedTraversal' laws are only satisfied if the -- new values you assign also pass the predicate! Otherwise subsequent traversals will visit fewer elements@@ -2360,8 +2346,6 @@ -- 'itakingWhile' :: (i -> a -> 'Bool') -> 'IndexedTraversal'' i s a    -> 'IndexedFold' i s a -- 'itakingWhile' :: (i -> a -> 'Bool') -> 'IndexedLens'' i s a         -> 'IndexedFold' i s a -- 'itakingWhile' :: (i -> a -> 'Bool') -> 'IndexedGetter' i s a        -> 'IndexedFold' i s a--- 'itakingWhile' :: (i -> a -> 'Bool') -> 'IndexedMonadicFold' i m s a -> 'IndexedMonadicFold' i m s a--- 'itakingWhile' :: (i -> a -> 'Bool') -> 'IndexedAction' i m s a      -> 'IndexedMonadicFold' i m s a -- @ itakingWhile :: (Indexable i p, Profunctor q, Contravariant f, Applicative f)          => (i -> a -> Bool)@@ -2378,8 +2362,6 @@ -- 'idroppingWhile' :: (i -> a -> 'Bool') -> 'IndexedTraversal'' i s a    -> 'IndexedFold' i s a -- see notes -- 'idroppingWhile' :: (i -> a -> 'Bool') -> 'IndexedLens'' i s a         -> 'IndexedFold' i s a -- see notes -- 'idroppingWhile' :: (i -> a -> 'Bool') -> 'IndexedGetter' i s a        -> 'IndexedFold' i s a--- 'idroppingWhile' :: (i -> a -> 'Bool') -> 'IndexedMonadicFold' i m s a -> 'IndexedMonadicFold' i m s a--- 'idroppingWhile' :: (i -> a -> 'Bool') -> 'IndexedAction' i m s a      -> 'IndexedMonadicFold' i m s a -- @ -- -- Applying 'idroppingWhile' to an 'IndexedLens' or 'IndexedTraversal' will still allow you to use it as a
src/Control/Lens/Internal/Action.hs view
@@ -27,9 +27,7 @@  import Control.Applicative import Control.Applicative.Backwards-import Control.Lens.Internal.Indexed import Control.Monad-import Control.Monad.Reader import Data.Functor.Bind import Data.Functor.Contravariant import Data.Functor.Identity@@ -59,16 +57,13 @@   ineffective = Identity #. getConst   {-# INLINE ineffective #-} -instance Effective m r f => Effective (ReaderT Int m) r (Indexing f) where-  effective m = Indexing (\i -> (i+1, effective (runReaderT m i)))-  ineffective i = ReaderT (ineffective . snd . runIndexing i)- ------------------------------------------------------------------------------ -- Effect ------------------------------------------------------------------------------  -- | Wrap a monadic effect with a phantom type argument. newtype Effect m r a = Effect { getEffect :: m r }+-- type role Effect representational nominal phantom  instance Functor (Effect m r) where   fmap _ (Effect m) = Effect m
src/Control/Lens/Internal/Bazaar.hs view
@@ -4,6 +4,9 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-}+#if __GLASGOW_HASKELL__ >= 707+{-# LANGUAGE RoleAnnotations #-}+#endif #ifdef TRUSTWORTHY {-# LANGUAGE Trustworthy #-} #endif@@ -71,6 +74,7 @@ -- -- This is a final encoding of 'Bazaar'. newtype Bazaar p a b t = Bazaar { runBazaar :: forall f. Applicative f => p a (f b) -> f t }+-- type role Bazaar representatonal nominal nominal nominal  -- | This alias is helpful when it comes to reducing repetition in type signatures. --@@ -131,6 +135,9 @@ -- For example. This lets us write a suitably polymorphic and lazy 'Control.Lens.Traversal.taking', but there -- must be a better way! newtype BazaarT p (g :: * -> *) a b t = BazaarT { runBazaarT :: forall f. Applicative f => p a (f b) -> f t }+#if __GLASGOW_HASKELL__ >= 707+type role BazaarT representational nominal nominal nominal nominal+#endif  -- | This alias is helpful when it comes to reducing repetition in type signatures. --@@ -223,6 +230,7 @@ -- -- This is a final encoding of 'Bazaar1'. newtype Bazaar1 p a b t = Bazaar1 { runBazaar1 :: forall f. Apply f => p a (f b) -> f t }+-- type role Bazaar1 representatonal nominal nominal nominal  -- | This alias is helpful when it comes to reducing repetition in type signatures. --@@ -277,6 +285,9 @@ -- For example. This lets us write a suitably polymorphic and lazy 'Control.Lens.Traversal.taking', but there -- must be a better way! newtype BazaarT1 p (g :: * -> *) a b t = BazaarT1 { runBazaarT1 :: forall f. Apply f => p a (f b) -> f t }+#if __GLASGOW_HASKELL__ >= 707+type role BazaarT1 representational nominal nominal nominal nominal+#endif  -- | This alias is helpful when it comes to reducing repetition in type signatures. --
src/Control/Lens/Internal/Context.hs view
@@ -6,6 +6,9 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-}+#if __GLASGOW_HASKELL__ >= 707+{-# LANGUAGE RoleAnnotations #-}+#endif #ifdef TRUSTWORTHY {-# LANGUAGE Trustworthy #-} #endif@@ -139,6 +142,7 @@ -- -- A 'Context' is like a 'Control.Lens.Lens.Lens' that has already been applied to a some structure. data Context a b t = Context (b -> t) a+-- type role Context representational representational representational  instance IndexedFunctor Context where   ifmap f (Context g t) = Context (f . g) t@@ -209,6 +213,7 @@ -- impact on its performance, and which permits the use of an arbitrary 'Conjoined' -- 'Profunctor' newtype Pretext p a b t = Pretext { runPretext :: forall f. Functor f => p a (f b) -> f t }+-- type role Pretext representational nominal nominal nominal  -- | @type 'Pretext'' p a s = 'Pretext' p a a s@ type Pretext' p a = Pretext p a a@@ -271,6 +276,8 @@ -- PretextT ------------------------------------------------------------------------------ ++ -- | This is a generalized form of 'Context' that can be repeatedly cloned with less -- impact on its performance, and which permits the use of an arbitrary 'Conjoined' -- 'Profunctor'.@@ -280,6 +287,12 @@ -- gracefully degrade when applied to a 'Control.Lens.Fold.Fold', 'Control.Lens.Getter.Getter' -- or 'Control.Lens.Action.Action'. newtype PretextT p (g :: * -> *) a b t = PretextT { runPretextT :: forall f. Functor f => p a (f b) -> f t }++#if __GLASGOW_HASKELL__ >= 707+-- really we want PretextT p g a b t to permit the last 3 arguments to be representational iff p and f accept representational arguments+-- but that isn't currently an option in GHC+type role PretextT representational nominal nominal nominal nominal+#endif  -- | @type 'PretextT'' p g a s = 'PretextT' p g a a s@ type PretextT' p g a = PretextT p g a a
src/Control/Lens/Internal/Exception.hs view
@@ -13,7 +13,12 @@ #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707 {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE PolyKinds #-}+{-# LANGUAGE RoleAnnotations #-} #endif++#ifndef MIN_VERSION_base+#define MIN_VERSION_base(x,y,z) 1+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Control.Lens.Internal.Exception@@ -169,6 +174,8 @@ newtype Handling a s (m :: * -> *) = Handling a #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707   deriving Typeable++type role Handling representational nominal nominal #else -- the m parameter exists simply to break the Typeable1 pattern, so we can provide this without overlap. -- here we simply generate a fresh TypeRep so we'll fail to compare as equal to any other TypeRep.
src/Control/Lens/Internal/Magma.hs view
@@ -10,6 +10,9 @@ #ifdef TRUSTWORTHY {-# LANGUAGE Trustworthy #-} #endif+#if __GLASGOW_HASKELL__ >= 707+{-# LANGUAGE RoleAnnotations #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Control.Lens.Internal.Magma@@ -62,6 +65,11 @@   MagmaFmap :: (x -> y) -> Magma i x b a -> Magma i y b a   Magma :: i -> a -> Magma i b b a +#if __GLASGOW_HASKELL__ >= 707+-- note the 3rd argument infers as phantom, but that would be unsound+type role Magma representational nominal nominal nominal+#endif+ instance Functor (Magma i t b) where   fmap f (MagmaAp x y)    = MagmaAp (fmap f x) (fmap f y)   fmap _ (MagmaPure x)    = MagmaPure x@@ -208,7 +216,13 @@ -- | This is used to generate an indexed magma from an unindexed source -- -- By constructing it this way we avoid infinite reassociations where possible.+--+-- In @'TakingWhile' p g a b t@, @g@ has a @nominal@ role to avoid exposing an illegal _|_ via 'Contravariant',+-- while the remaining arguments are degraded to a @nominal@ role by the invariants of 'Magma' data TakingWhile p (g :: * -> *) a b t = TakingWhile Bool t (Bool -> Magma () t b (Corep p a))+#if __GLASGOW_HASKELL__ >= 707+type role TakingWhile nominal nominal nominal nominal nominal+#endif  -- | Generate a 'Magma' with leaves only while the predicate holds from left to right. runTakingWhile :: Corepresentable p => TakingWhile p f a b t -> Magma () t b (Corep p a)
src/Control/Lens/Lens.hs view
@@ -74,7 +74,7 @@   , (<<%@~), (<<%@=)   -- ** General Purpose Combinators   , (&), (<&>), (??)-+  , (&~)   -- * Lateral Composition   , choosing   , chosen@@ -156,7 +156,7 @@ infixr 4 %%@~, <%@~, <<%@~, %%~, <+~, <*~, <-~, <//~, <^~, <^^~, <**~, <&&~, <||~, <<>~, <%~, <<%~, <<.~, <#~, #~, #%~, <#%~, #%%~ infix  4 %%@=, <%@=, <<%@=, %%=, <+=, <*=, <-=, <//=, <^=, <^^=, <**=, <&&=, <||=, <<>=, <%=, <<%=, <<.=, <#=, #=, #%=, <#%=, #%%= infixr 2 <<~-infixl 1 &, <&>, ??+infixl 1 &, <&>, ??, &~  ------------------------------------------------------------------------------- -- Lenses@@ -219,6 +219,23 @@ ilens :: (s -> (i, a)) -> (s -> b -> t) -> IndexedLens i s t a b ilens sia sbt iafb s = sbt s <$> uncurry (indexed iafb) (sia s) {-# INLINE ilens #-}++-- | This can be used to chain lens operations using @op=@ syntax+-- rather than @op~@ syntax for simple non-type-changing cases.+--+-- >>> (10,20) & _1 .~ 30 & _2 .~ 40+-- (30,40)+--+-- >>> (10,20) &~ do _1 .= 30; _2 .= 40+-- (30,40)+--+-- This does not support type-changing assignment, /e.g./+--+-- >>> (10,20) & _1 .~ "hello"+-- ("hello",20)+(&~) :: s -> State s a -> s+s &~ l = execState l s+{-# INLINE (&~) #-}  -- | ('%%~') can be used in one of two scenarios: --
src/Control/Lens/Operators.hs view
@@ -43,6 +43,7 @@   , (%%~)   , (%%=)   , (&)+  , (&~)   , (<&>)   , (??)   , (<%~)
src/Control/Lens/TH.hs view
@@ -898,7 +898,7 @@   where     clauses = map buildClause conList -    buildClause (con@RecC{}, fields) = do+    buildClause (con, fields) | isRecord con = do       f <- newName "_f"       vars <- for (con^..conNamedFields._1) $ \fld ->           if fld `List.elem` fields@@ -908,16 +908,21 @@           fvals = map (appE (varE f) . varE) (catMaybes vars) -- Functor applications           conName = con^.name +          fpat+            | List.null fvals = wildP+            | otherwise       = varP f+           expr             | not isFold && length fields /= 1               = appE (varE 'error) . litE . stringL               $ show lensName ++ ": expected a single matching field in " ++ show conName ++ ", found " ++ show (length fields)             | List.null fields               = [| coerce (pure ()) |]+            | List.null fvals = [| coerce (pure ()) |]             | otherwise               = let add x y = [| $x *> $y |]                 in [| coerce $(List.foldl1 add fvals) |]-      clause [varP f, conP conName cpats] (normalB expr) []+      clause [fpat, conP conName cpats] (normalB expr) []      -- Non-record are never the target of a generated field lens body     buildClause (con, _fields) =@@ -925,6 +930,11 @@       -- expr:    pure c       clause [wildP, recP (con^.name) []] (normalB [| coerce (pure ()) |]) [] +isRecord :: Con -> Bool+isRecord RecC{}          = True+isRecord NormalC{}       = False+isRecord InfixC{}        = False+isRecord (ForallC _ _ c) = isRecord c  makeFieldLensBody :: Bool -> Name -> [(Con, [Name])] -> Maybe Name -> Q Dec makeFieldLensBody isTraversal lensName conList maybeMethodName = case maybeMethodName of@@ -935,7 +945,8 @@     Nothing -> funD lensName clauses   where     clauses = map buildClause conList-    buildClause (con@RecC{}, fields) = do++    buildClause (con, fields) | isRecord con = do       f <- newName "_f"       vars <- for (con^..conNamedFields._1) $ \fld ->           if fld `List.elem` fields@@ -948,6 +959,9 @@           conName = con^.name           recon = conE conName `appsE1` cvals +          fpat+            | List.null fields = wildP+            | otherwise        = varP f           expr             | not isTraversal && length fields /= 1               = appE (varE 'error) . litE . stringL@@ -959,7 +973,7 @@                     step (Just l) r = Just $ infixE (Just l) (varE '(<*>)) (Just r)                 in  fromJust $ List.foldl step Nothing fvals               -- = infixE (Just $ lamE fpats recon) (varE '(<$>)) $ Just $ List.foldl1 (\l r -> infixE (Just l) (varE '(<*>)) (Just r)) fvals-      clause [varP f, conP conName cpats] (normalB expr) []+      clause [fpat, conP conName cpats] (normalB expr) []      -- Non-record are never the target of a generated field lens body     buildClause (con, _fields) = do@@ -1093,6 +1107,13 @@ getLensFields f (RecC cn fs)   = return . catMaybes   $ fs <&> \(fn,_,t) -> f (nameBase fn) <&> \ln -> (mkName ln, (cn,fn,t))+getLensFields f (ForallC tvs cxts con) = fmap (filter p) (getLensFields f con)+  where+  -- Only select fields which do not mention existentially+  -- quantified type variables or variables mentioned in internal class constraints+  prohibitedTypes = tvs^..typeVars ++ cxts^..typeVars+  p field = not (any (\t -> elemOf (_2._3.typeVars) t field) prohibitedTypes)+ getLensFields _ _   = return [] 
src/Control/Lens/Traversal.hs view
@@ -606,10 +606,9 @@ {-# INLINE holesOf #-}  -- | This converts a 'Traversal' that you \"know\" will target one or more elements to a 'Lens'. It can--- also be used to transform a non-empty 'Fold' into a 'Getter' or a non-empty 'MonadicFold' into an--- 'Action'.+-- also be used to transform a non-empty 'Fold' into a 'Getter'. ----- The resulting 'Lens', 'Getter', or 'Action' will be partial if the supplied 'Traversal' returns+-- The resulting 'Lens' or 'Getter' will be partial if the supplied 'Traversal' returns -- no results. -- -- >>> [1,2,3] ^. singular _head@@ -627,10 +626,8 @@ -- @ -- 'singular' :: 'Traversal' s t a a          -> 'Lens' s t a a -- 'singular' :: 'Fold' s a                   -> 'Getter' s a--- 'singular' :: 'MonadicFold' m s a          -> 'Action' m s a -- 'singular' :: 'IndexedTraversal' i s t a a -> 'IndexedLens' i s t a a -- 'singular' :: 'IndexedFold' i s a          -> 'IndexedGetter' i s a--- 'singular' :: 'IndexedMonadicFold' i m s a -> 'IndexedAction' i m s a -- @ singular :: (Conjoined p, Functor f)          => Traversing p f s t a a@@ -645,18 +642,16 @@ {-# INLINE singular #-}  -- | This converts a 'Traversal' that you \"know\" will target only one element to a 'Lens'. It can also be--- used to transform a 'Fold' into a 'Getter' or a 'MonadicFold' into an 'Action'.+-- used to transform a 'Fold' into a 'Getter'. ----- The resulting 'Lens', 'Getter', or 'Action' will be partial if the 'Traversal' targets nothing+-- The resulting 'Lens' or 'Getter' will be partial if the 'Traversal' targets nothing -- or more than one element. -- -- @ -- 'unsafeSingular' :: 'Traversal' s t a b          -> 'Lens' s t a b -- 'unsafeSingular' :: 'Fold' s a                   -> 'Getter' s a--- 'unsafeSingular' :: 'MonadicFold' m s a          -> 'Action' m s a -- 'unsafeSingular' :: 'IndexedTraversal' i s t a b -> 'IndexedLens' i s t a b -- 'unsafeSingular' :: 'IndexedFold' i s a          -> 'IndexedGetter' i s a--- 'unsafeSingular' :: 'IndexedMonadicFold' i m s a -> 'IndexedAction' i m s a -- @ unsafeSingular :: (Conjoined p, Functor f)                => Traversing p f s t a b@@ -793,14 +788,10 @@ -- 'taking' :: 'Int' -> 'Prism'' s a                       -> 'Traversal'' s a -- 'taking' :: 'Int' -> 'Getter' s a                       -> 'Fold' s a -- 'taking' :: 'Int' -> 'Fold' s a                         -> 'Fold' s a--- 'taking' :: 'Int' -> 'Action' m s a                     -> 'MonadicFold' m s a--- 'taking' :: 'Int' -> 'MonadicFold' m s a                -> 'MonadicFold' m s a -- 'taking' :: 'Int' -> 'IndexedTraversal'' i s a          -> 'IndexedTraversal'' i s a -- 'taking' :: 'Int' -> 'IndexedLens'' i s a               -> 'IndexedTraversal'' i s a -- 'taking' :: 'Int' -> 'IndexedGetter' i s a              -> 'IndexedFold' i s a -- 'taking' :: 'Int' -> 'IndexedFold' i s a                -> 'IndexedFold' i s a--- 'taking' :: 'Int' -> 'IndexedAction' i m s a            -> 'IndexedMonadicFold' i m s a--- 'taking' :: 'Int' -> 'IndexedMonadicFold' i m s a       -> 'IndexedMonadicFold' i m s a -- @ taking :: (Conjoined p, Applicative f)         => Int@@ -828,14 +819,10 @@ -- 'dropping' :: 'Int' -> 'Prism'' s a                       -> 'Traversal'' s a -- 'dropping' :: 'Int' -> 'Getter' s a                       -> 'Fold' s a -- 'dropping' :: 'Int' -> 'Fold' s a                         -> 'Fold' s a--- 'dropping' :: 'Int' -> 'Action' m s a                     -> 'MonadicFold' m s a--- 'dropping' :: 'Int' -> 'MonadicFold' m s a                -> 'MonadicFold' m s a -- 'dropping' :: 'Int' -> 'IndexedTraversal'' i s a          -> 'IndexedTraversal'' i s a -- 'dropping' :: 'Int' -> 'IndexedLens'' i s a               -> 'IndexedTraversal'' i s a -- 'dropping' :: 'Int' -> 'IndexedGetter' i s a              -> 'IndexedFold' i s a -- 'dropping' :: 'Int' -> 'IndexedFold' i s a                -> 'IndexedFold' i s a--- 'dropping' :: 'Int' -> 'IndexedAction' i m s a            -> 'IndexedMonadicFold' i m s a--- 'dropping' :: 'Int' -> 'IndexedMonadicFold' i m s a       -> 'IndexedMonadicFold' i m s a -- @ dropping :: (Conjoined p, Applicative f) => Int -> Over p (Indexing f) s t a a -> Over p f s t a a dropping n l pafb s = snd $ runIndexing (l paifb s) 0 where
src/Language/Haskell/TH/Lens.hs view
@@ -3,6 +3,10 @@ {-# LANGUAGE Trustworthy #-} #endif {-# LANGUAGE Rank2Types #-}++#ifndef MIN_VERSION_template_haskell+#define MIN_VERSION_template_haskell(x,y,z) 1+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Language.Haskell.TH.Lens@@ -372,6 +376,7 @@ -- | 'Traversal' of the types of the /named/ fields of a constructor. conNamedFields :: Traversal' Con VarStrictType conNamedFields f (RecC n fs) = RecC n <$> traverse f fs+conNamedFields f (ForallC a b fs) = ForallC a b <$> conNamedFields f fs conNamedFields _ c = pure c  -- Lenses and Prisms@@ -890,7 +895,7 @@ _SpecialiseInstP   = prism remitter reviewer   where-      remitter x = SpecialiseInstP x+      remitter = SpecialiseInstP       reviewer (SpecialiseInstP x) = Right x       reviewer x = Left x @@ -1050,7 +1055,7 @@ tySynEqnPatterns :: Lens' TySynEqn [Type] tySynEqnPatterns = lens g s where    g (TySynEqn xs _)    = xs-   s (TySynEqn _  y) xs = (TySynEqn xs y)+   s (TySynEqn _  y) xs = TySynEqn xs y  tySynEqnResult :: Lens' TySynEqn Type tySynEqnResult = lens g s where@@ -1709,7 +1714,7 @@ _LitT   = prism remitter reviewer   where-      remitter x = LitT x+      remitter = LitT       reviewer (LitT x) = Right x       reviewer x = Left x #endif
tests/templates.hs view
@@ -184,6 +184,7 @@ --   method = id -- mochi :: Iso' (Associated Int) Double +#if __GLASGOW_HASKELL >= 706 declareFields [d|   data DeclaredFields f a     = DeclaredField1 { declaredFieldsA :: f a    , declaredFieldsB :: Int }@@ -196,6 +197,7 @@  declaredFieldsUse2 :: [DeclaredFields [] ()] declaredFieldsUse2 = over (traverse.fieldsB) (+1) [DeclaredField1 [()] 0, DeclaredField2 "" 1]+#endif  data Rank2Tests   = C1 { _r2length :: forall a. [a] -> Int