packages feed

lens 4.12 → 4.12.1

raw patch · 10 files changed

+75/−23 lines, 10 filesdep ~vector

Dependency ranges changed: vector

Files

CHANGELOG.markdown view
@@ -1,3 +1,9 @@+4.12.1+------+* The `Simple` type alias is now poly-kinded. This lets you use `Simple Field1 s a` and the like in constraints.+* Added `HasTypes` to `Language.Haskell.TH.Lens`.+* Support for `vector-0.11.0` which changes `Stream` to `Bundle`+ 4.12 ---- * `reflection 2` support.
lens.cabal view
@@ -1,6 +1,6 @@ name:          lens category:      Data, Lenses, Generics-version:       4.12+version:       4.12.1 license:       BSD3 cabal-version: >= 1.8 license-file:  LICENSE@@ -208,7 +208,7 @@     transformers              >= 0.2      && < 0.5,     transformers-compat       >= 0.4      && < 1,     unordered-containers      >= 0.2      && < 0.3,-    vector                    >= 0.9      && < 0.11,+    vector                    >= 0.9      && < 0.12,     void                      >= 0.5      && < 1    exposed-modules:
src/Control/Lens/Cons.hs view
@@ -457,8 +457,8 @@ -- >>> Vector.empty ^? _last -- Nothing ----- >>> Vector.fromList "abcde" & _last .~ 'Q'--- fromList "abcdQ"+-- >>> (Vector.fromList "abcde" & _last .~ 'Q') == Vector.fromList "abcdQ"+-- True -- -- @ -- '_last' :: 'Traversal'' [a] a
src/Control/Lens/Traversal.hs view
@@ -6,6 +6,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE Trustworthy #-}  #ifndef MIN_VERSION_containers #define MIN_VERSION_containers(x,y,z) 1
src/Control/Lens/Type.hs view
@@ -6,6 +6,9 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE KindSignatures #-}+#if __GLASGOW_HASKELL__ >= 706+{-# LANGUAGE PolyKinds #-}+#endif ------------------------------------------------------------------------------- -- | -- Module      :  Control.Lens.Type
src/Data/Vector/Generic/Lens.hs view
@@ -4,6 +4,10 @@ #ifdef TRUSTWORTHY {-# LANGUAGE Trustworthy #-} #endif++#ifndef MIN_VERSION_vector+#define MIN_VERSION_vector(x,y,z) 1+#endif ------------------------------------------------------------------------------- -- | -- Module      :  Data.Vector.Generic.Lens@@ -45,10 +49,15 @@ import Control.Lens.Internal.List (ordinalNub) import Data.Monoid import Data.Vector.Generic as V hiding (zip, filter, indexed)-import Data.Vector.Fusion.Stream (Stream) import Data.Vector.Generic.New (New) import Prelude hiding ((++), length, null, head, tail, init, last, map, reverse) +#if MIN_VERSION_vector(0,11,0)+import Data.Vector.Fusion.Bundle (Bundle)+#else+import Data.Vector.Fusion.Stream (Stream)+#endif+ -- $setup -- >>> import Data.Vector as Vector @@ -61,11 +70,11 @@ -- Attempting to return a longer or shorter vector will result in -- violations of the 'Lens' laws. ----- >>> Vector.fromList [1..10] ^. sliced 2 5--- fromList [3,4,5,6,7]+-- >>> Vector.fromList [1..10] ^. sliced 2 5 == Vector.fromList [3,4,5,6,7]+-- True ----- >>> Vector.fromList [1..10] & sliced 2 5 . mapped .~ 0--- fromList [1,2,0,0,0,0,0,8,9,10]+-- >>> (Vector.fromList [1..10] & sliced 2 5 . mapped .~ 0) == Vector.fromList [1,2,0,0,0,0,0,8,9,10]+-- True sliced :: Vector v a        => Int -- ^ @i@ starting index        -> Int -- ^ @n@ length@@ -75,16 +84,16 @@  -- | Similar to 'toListOf', but returning a 'Vector'. ----- >>> toVectorOf both (8,15) :: Vector.Vector Int--- fromList [8,15]+-- >>> (toVectorOf both (8,15) :: Vector.Vector Int) == Vector.fromList [8,15]+-- True toVectorOf :: Vector v a => Getting (Endo [a]) s a -> s -> v a toVectorOf l s = fromList (toListOf l s) {-# INLINE toVectorOf #-}  -- | Convert a list to a 'Vector' (or back.) ----- >>> [1,2,3] ^. vector :: Vector.Vector Int--- fromList [1,2,3]+-- >>> ([1,2,3] ^. vector :: Vector.Vector Int) == Vector.fromList [1,2,3]+-- True -- -- >>> Vector.fromList [0,8,15] ^. from vector -- [0,8,15]@@ -92,14 +101,25 @@ vector = iso fromList V.toList {-# INLINE vector #-} +#if MIN_VERSION_vector(0,11,0)+-- | Convert a 'Vector' to a finite 'Bundle' (or back.)+asStream :: (Vector v a, Vector v b) => Iso (v a) (v b) (Bundle v a) (Bundle v b)+#else -- | Convert a 'Vector' to a finite 'Stream' (or back.) asStream :: (Vector v a, Vector v b) => Iso (v a) (v b) (Stream a) (Stream b)+#endif asStream = iso stream unstream {-# INLINE asStream #-} +#if MIN_VERSION_vector(0,11,0)+-- | Convert a 'Vector' to a finite 'Bundle' from right to left (or+-- back.)+asStreamR :: (Vector v a, Vector v b) => Iso (v a) (v b) (Bundle v a) (Bundle v b)+#else -- | Convert a 'Vector' to a finite 'Stream' from right to left (or -- back.) asStreamR :: (Vector v a, Vector v b) => Iso (v a) (v b) (Stream a) (Stream b)+#endif asStreamR = iso streamR unstreamR {-# INLINE asStreamR #-} 
src/Data/Vector/Lens.hs view
@@ -44,11 +44,11 @@ -- Attempting to return a longer or shorter vector will result in -- violations of the 'Lens' laws. ----- >>> Vector.fromList [1..10] ^. sliced 2 5--- fromList [3,4,5,6,7]+-- >>> Vector.fromList [1..10] ^. sliced 2 5 == Vector.fromList [3,4,5,6,7]+-- True ----- >>> Vector.fromList [1..10] & sliced 2 5 . mapped .~ 0--- fromList [1,2,0,0,0,0,0,8,9,10]+-- >>> (Vector.fromList [1..10] & sliced 2 5 . mapped .~ 0) == Vector.fromList [1,2,0,0,0,0,0,8,9,10]+-- True sliced :: Int -- ^ @i@ starting index        -> Int -- ^ @n@ length        -> Lens' (Vector a) (Vector a)@@ -57,22 +57,22 @@  -- | Similar to 'toListOf', but returning a 'Vector'. ----- >>> toVectorOf both (8,15)--- fromList [8,15]+-- >>> toVectorOf both (8,15) == Vector.fromList [8,15]+-- True toVectorOf :: Getting (Endo [a]) s a -> s -> Vector a toVectorOf l s = fromList (toListOf l s) {-# INLINE toVectorOf #-}  -- | Convert a list to a 'Vector' (or back) ----- >>> [1,2,3] ^. vector--- fromList [1,2,3]+-- >>> [1,2,3] ^. vector == Vector.fromList [1,2,3]+-- True -- -- >>> [1,2,3] ^. vector . from vector -- [1,2,3] ----- >>> Vector.fromList [0,8,15] ^. from vector . vector--- fromList [0,8,15]+-- >>> Vector.fromList [0,8,15] ^. from vector . vector == Vector.fromList [0,8,15]+-- True vector :: Iso [a] [b] (Vector a) (Vector b) vector = iso fromList toList {-# INLINE vector #-}
src/GHC/Generics/Lens.hs view
@@ -77,6 +77,8 @@   reviewer x = Left x {-# INLINE _L1 #-} +-- | You can access fields of `data (f :*: g) p` by using it's `Field1` and `Field2` instances+ _R1 :: Prism' ((f :+: g) a) (g a) _R1 = prism remitter reviewer   where
src/Language/Haskell/TH/Lens.hs view
@@ -300,6 +300,24 @@   name f (InfixC l n r)        = (\n' -> InfixC l n' r) <$> f n   name f (ForallC bds ctx con) = ForallC bds ctx <$> name f con +-- | Contains some amount of `Type`s inside+class HasTypes t where+  -- | Traverse all the types+  types :: Traversal' t Type++instance HasTypes Type where+  types = id++instance HasTypes Con where+  types f (NormalC n t)      = NormalC n <$> traverse (_2 (types f)) t+  types f (RecC n t)         = RecC n <$> traverse (_3 (types f)) t+  types f (InfixC t1 n t2) = InfixC <$> _2 (types f) t1+                                       <*> pure n <*> _2 (types f) t2+  types f (ForallC vb ctx con)    = ForallC vb ctx <$> types f con++instance HasTypes t => HasTypes [t] where+  types = traverse . types+ -- | Provides for the extraction of free type variables, and alpha renaming. class HasTypeVars t where   -- | When performing substitution into this traversal you're not allowed
tests/doctests.hsc view
@@ -16,7 +16,9 @@ module Main where  import Build_doctests (deps)+#if __GLASGOW_HASKELL__ < 710 import Control.Applicative+#endif import Control.Monad import Data.List import System.Directory