lens 3.7.1.1 → 3.7.1.2
raw patch · 8 files changed
+100/−41 lines, 8 filesdep ~HUnitdep ~QuickCheckdep ~directorybuild-type:Customsetup-changed
Dependency ranges changed: HUnit, QuickCheck, directory, doctest, simple-reflect, test-framework, test-framework-hunit, test-framework-quickcheck2, test-framework-th
Files
- .travis.yml +1/−1
- CHANGELOG.markdown +7/−1
- Setup.lhs +42/−4
- lens.cabal +13/−13
- src/Control/Lens/Each.hs +31/−6
- src/Control/Lens/Internal/Zipper.hs +0/−6
- src/Control/Lens/Iso.hs +0/−6
- tests/doctests.hs +6/−4
.travis.yml view
@@ -1,7 +1,7 @@ language: haskell before_install: # Uncomment whenever hackage is down.- # - mkdir -p ~/.cabal && cp config ~/.cabal/config && cabal update+ - mkdir -p ~/.cabal && cp config ~/.cabal/config && cabal update # Try installing some of the build-deps with apt-get for speed. - ./travis-cabal-apt-install --only-dependencies --force-reinstall $mode
CHANGELOG.markdown view
@@ -1,4 +1,10 @@-3.7.1.1+3.7.1.2 [maintenance release]+-------+* Made the doctest test suite hide all but the exact versions of packages used to build this package to avoid problems with complicated user environments.+* Removed doctests based on `:t` as they are fragile and break across GHC versions.+* Fixed GHC 7.0.4 compatibility by guarding `DefaultSignatures` in `Control.Lens.Each`.++3.7.1.1 [maintenance release] ------- * Removed tests that will (likely) fail in the presence of `hashable` 1.2
Setup.lhs view
@@ -1,7 +1,45 @@ #!/usr/bin/runhaskell-> module Main (main) where+\begin{code}+module Main (main) where -> import Distribution.Simple+import Data.List ( nub )+import Data.Version ( showVersion )+import Distribution.Package ( PackageName(PackageName), PackageId, InstalledPackageId, packageVersion, packageName )+import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks )+import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose )+import Distribution.Verbosity ( Verbosity )+import Distribution.Simple.BuildPaths ( autogenModulesDir )+import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), fromFlag )+import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(libraryConfig, testSuiteConfigs), ComponentLocalBuildInfo(componentPackageDeps) )+import System.FilePath ( (</>) ) -> main :: IO ()-> main = defaultMain+main :: IO ()+main = defaultMainWithHooks simpleUserHooks+ { buildHook = \pkg lbi hooks flags -> do+ generateBuildModule "doctests" (fromFlag (buildVerbosity flags)) lbi+ buildHook simpleUserHooks pkg lbi hooks flags+ -- , haddockHook = \pkg lbi hooks flags -> do+ -- generateBuildModule (fromFlag (haddockVerbosity flags)) lbi+ -- haddockHook simpleUserHooks pkg lbi hooks flags+ }++generateBuildModule :: String -> Verbosity -> LocalBuildInfo -> IO ()+generateBuildModule testSuite verbosity lbi = do+ let dir = autogenModulesDir lbi+ createDirectoryIfMissingVerbose verbosity True dir+ rewriteFile (dir </> "Build_" ++ testSuite ++ ".hs") $ unlines+ [ "module Build_" ++ testSuite ++ " where"+ , "deps :: [String]"+ , "deps = " ++ (show $ formatdeps (testDeps testSuite lbi))+ ]+ where+ formatdeps = map (formatone . snd)+ formatone p = case packageName p of+ PackageName n -> n ++ "-" ++ showVersion (packageVersion p)++testDeps :: String -> LocalBuildInfo -> [(InstalledPackageId, PackageId)]+testDeps testSuite lbi = nub $+ maybe [] componentPackageDeps (lookup testSuite (testSuiteConfigs lbi))+ ++ maybe [] componentPackageDeps (libraryConfig lbi)++\end{code}
lens.cabal view
@@ -1,6 +1,6 @@ name: lens category: Data, Lenses-version: 3.7.1.1+version: 3.7.1.2 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -81,7 +81,7 @@ common haskell types, a wide array of combinators for working them, and more exotic functionality, (/e.g./ getters, setters, indexed folds, isomorphisms). -build-type: Simple+build-type: Custom tested-with: GHC == 7.0.4, GHC == 7.4.1, GHC == 7.6.1 extra-source-files: .travis.yml@@ -311,10 +311,10 @@ build-depends: base, lens,- QuickCheck >= 2.4 && < 2.6,- test-framework >= 0.6 && < 0.9,- test-framework-quickcheck2 >= 0.2 && < 0.4,- test-framework-th >= 0.2 && < 0.4,+ QuickCheck >= 2.4,+ test-framework >= 0.6,+ test-framework-quickcheck2 >= 0.2,+ test-framework-th >= 0.2, transformers test-suite hunit@@ -328,12 +328,12 @@ build-depends: base, containers,- HUnit == 1.2.*,+ HUnit >= 1.2, lens, mtl,- test-framework >= 0.6 && < 0.9,- test-framework-hunit >= 0.2 && < 0.4,- test-framework-th >= 0.2 && < 0.4+ test-framework >= 0.6,+ test-framework-hunit >= 0.2,+ test-framework-th >= 0.2 -- Verify the results of the examples test-suite doctests@@ -343,12 +343,12 @@ base, bytestring, containers,- directory >= 1.0 && < 1.3,- doctest >= 0.9.1 && <= 0.10,+ directory >= 1.0,+ doctest >= 0.9.1, filepath, mtl, parallel,- simple-reflect >= 0.3.1 && < 0.4,+ simple-reflect >= 0.3.1, split, text, unordered-containers,
src/Control/Lens/Each.hs view
@@ -6,6 +6,11 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE FunctionalDependencies #-}++#ifdef DEFAULT_SIGNATURES+{-# LANGUAGE DefaultSignatures #-}+#endif+ #ifndef MIN_VERSION_base #define MIN_VERSION_base(x,y,z) 1 #endif@@ -75,9 +80,12 @@ -- ("HELLO","WORLD") class Each i s t a b | s -> i a, t -> i b, s b -> t, t a -> s where each :: IndexedTraversal i s t a b++#ifdef DEFAULT_SIGNATURES default each :: (Traversable f, s ~ f a, t ~ f b) => IndexedTraversal Int s t a b each = traversed {-# INLINE each #-}+#endif instance (a ~ a', b ~ b') => Each Int (a,a') (b,b') a b where each = Lens.indexed $ \ f ~(a,b) -> (,) <$> f (0 :: Int) a <*> f 1 b@@ -133,12 +141,29 @@ each = Lens.indexed HashMap.traverseWithKey {-# INLINE each #-} -instance Each Int [a] [b] a b-instance Each Int (Identity a) (Identity b) a b-instance Each Int (Maybe a) (Maybe b) a b-instance Each Int (Seq a) (Seq b) a b-instance Each Int (Tree a) (Tree b) a b-instance Each Int (Vector.Vector a) (Vector.Vector b) a b+instance Each Int [a] [b] a b where+ each = traversed+ {-# INLINE each #-}++instance Each Int (Identity a) (Identity b) a b where+ each = traversed+ {-# INLINE each #-}++instance Each Int (Maybe a) (Maybe b) a b where+ each = traversed+ {-# INLINE each #-}++instance Each Int (Seq a) (Seq b) a b where+ each = traversed+ {-# INLINE each #-}++instance Each Int (Tree a) (Tree b) a b where+ each = traversed+ {-# INLINE each #-}++instance Each Int (Vector.Vector a) (Vector.Vector b) a b where+ each = traversed+ {-# INLINE each #-} instance (Prim a, Prim b) => Each Int (Prim.Vector a) (Prim.Vector b) a b where each = Lens.indexed $ \f v -> Prim.fromListN (Prim.length v) <$> withIndex traversed f (Prim.toList v)
src/Control/Lens/Internal/Zipper.hs view
@@ -69,9 +69,6 @@ -- -- You can construct a zipper into *any* data structure with 'zipper'. ----- >>> :t zipper (Just "hello")--- zipper (Just "hello") :: Top :> Maybe [Char]--- -- You can repackage up the contents of a zipper with 'rezip'. -- -- >>> rezip $ zipper 42@@ -139,9 +136,6 @@ -- -- NB: Attempts to move upward from the 'Top' of the 'Zipper' will fail to typecheck. ----- >>> :t zipper ("hello","world") & downward _1 & fromWithin traverse & upward--- zipper ("hello","world") & downward _1 & fromWithin traverse & upward--- :: (Top :> ([Char], [Char])) :> [Char] upward :: (h :> s :> a) -> h :> s upward (Zipper (Snoc h _ un uls k urs) _ ls x rs) = Zipper h un uls ux urs where ux = k (reverseList ls ++ x : rs)
src/Control/Lens/Iso.hs view
@@ -230,18 +230,12 @@ -- | The canonical isomorphism for currying and uncurrying a function. ----- >>> :t fst^.curried--- fst^.curried :: a -> b -> a--- -- @'curried' = 'iso' 'curry' 'uncurry'@ curried :: Iso ((a,b) -> c) ((d,e) -> f) (a -> b -> c) (d -> e -> f) curried = iso curry uncurry {-# INLINE curried #-} -- | The canonical isomorphism for uncurrying and currying a function.------ >>> :t flip (,)^.uncurried--- flip (,)^.uncurried :: (b, a) -> (a, b) -- -- @'uncurried' = 'iso' 'uncurry' 'curry'@ --
tests/doctests.hs view
@@ -1,11 +1,12 @@ module Main where -import Test.DocTest-import System.Directory-import System.FilePath+import Build_doctests (deps) import Control.Applicative import Control.Monad import Data.List+import System.Directory+import System.FilePath+import Test.DocTest main :: IO () main = getSources >>= \sources -> doctest $@@ -13,7 +14,8 @@ : "-idist/build/autogen" : "-optP-include" : "-optPdist/build/autogen/cabal_macros.h"- : sources+ : "-hide-all-packages"+ : map ("-package="++) deps ++ sources getSources :: IO [FilePath] getSources = filter (isSuffixOf ".hs") <$> go "src"