genvalidity-path 0.2.0.2 → 0.3.0.0
raw patch · 3 files changed
+117/−42 lines, 3 filesdep +QuickCheckdep +criteriondep ~basedep ~genvaliditydep ~pathPVP ok
version bump matches the API change (PVP)
Dependencies added: QuickCheck, criterion
Dependency ranges changed: base, genvalidity, path, validity-path
API changes (from Hackage documentation)
Files
- bench/Main.hs +40/−0
- genvalidity-path.cabal +67/−38
- src/Data/GenValidity/Path.hs +10/−4
+ bench/Main.hs view
@@ -0,0 +1,40 @@+{-# LANGUAGE TypeApplications #-}++module Main where++import Criterion.Main+import Test.QuickCheck++import Path++import Data.GenValidity+import Data.GenValidity.Path ()++main :: IO ()+main =+ defaultMain+ [ bench "genValid Path Abs File" . nfIO $+ generate (genValid @(Path Abs File))+ , bench "genValid Path Rel File" . nfIO $+ generate (genValid @(Path Rel File))+ , bench "genValid Path Abs Dir" . nfIO $+ generate (genValid @(Path Abs Dir))+ , bench "genValid Path Rel Dir" . nfIO $+ generate (genValid @(Path Rel Dir))+ , bench "genUnchecked Path Abs File" . nfIO $+ generate (genUnchecked @(Path Abs File))+ , bench "genUnchecked Path Rel File" . nfIO $+ generate (genUnchecked @(Path Rel File))+ , bench "genUnchecked Path Abs Dir" . nfIO $+ generate (genUnchecked @(Path Abs Dir))+ , bench "genUnchecked Path Rel Dir" . nfIO $+ generate (genUnchecked @(Path Rel Dir))+ , bench "genInvalid Path Abs File" . nfIO $+ generate (genInvalid @(Path Abs File))+ , bench "genInvalid Path Rel File" . nfIO $+ generate (genInvalid @(Path Rel File))+ , bench "genInvalid Path Abs Dir" . nfIO $+ generate (genInvalid @(Path Abs Dir))+ , bench "genInvalid Path Rel Dir" . nfIO $+ generate (genInvalid @(Path Rel Dir))+ ]
genvalidity-path.cabal view
@@ -1,44 +1,73 @@-name: genvalidity-path-version: 0.2.0.2-cabal-version: >=1.10-build-type: Simple-license: MIT-license-file: LICENSE-copyright: Copyright: (c) 2016 Tom Sydney Kerckhove-maintainer: syd.kerckhove@gmail.com-homepage: https://github.com/NorfairKing/validity#readme-synopsis: GenValidity support for Path-description:- Please see README.md-category: Testing-author: Tom Sydney Kerckhove+-- This file has been generated from package.yaml by hpack version 0.20.0.+--+-- see: https://github.com/sol/hpack+--+-- hash: 51db4477783d7f7d53e1b108ac534f18db23983d244f08a95b44e14c8c01e13e +name: genvalidity-path+version: 0.3.0.0+synopsis: GenValidity support for Path+description: Please see README.md+category: Testing+homepage: https://github.com/NorfairKing/validity#readme+bug-reports: https://github.com/NorfairKing/validity/issues+author: Tom Sydney Kerckhove+maintainer: syd.kerckhove@gmail.com+copyright: Copyright: (c) 2016-2018 Tom Sydney Kerckhove+license: MIT+license-file: LICENSE+build-type: Simple+cabal-version: >= 1.10+ source-repository head- type: git- location: https://github.com/NorfairKing/validity+ type: git+ location: https://github.com/NorfairKing/validity library- exposed-modules:- Data.GenValidity.Path- build-depends:- base >=4.7 && <5,- validity-path >=0.2 && <0.3,- genvalidity >=0.4 && <0.5,- path >=0.5 && <0.7- default-language: Haskell2010- hs-source-dirs: src+ hs-source-dirs:+ src+ build-depends:+ QuickCheck+ , base >=4.7 && <5+ , genvalidity >=0.5 && <0.6+ , path >=0.5 && <0.7+ , validity-path >=0.3 && <0.4+ exposed-modules:+ Data.GenValidity.Path+ other-modules:+ Paths_genvalidity_path+ default-language: Haskell2010 test-suite genvalidity-path-test- type: exitcode-stdio-1.0- main-is: Spec.hs- build-depends:- base -any,- genvalidity-path -any,- hspec -any,- genvalidity-hspec -any,- path -any- default-language: Haskell2010- hs-source-dirs: test- other-modules:- Data.GenValidity.PathSpec- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -fno-warn-name-shadowing+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ hs-source-dirs:+ test+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -fno-warn-name-shadowing+ build-depends:+ base+ , genvalidity-hspec+ , genvalidity-path+ , hspec+ , path+ other-modules:+ Data.GenValidity.PathSpec+ Paths_genvalidity_path+ default-language: Haskell2010++benchmark genvalidity-path-bench+ type: exitcode-stdio-1.0+ main-is: Main.hs+ hs-source-dirs:+ bench+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -fno-warn-name-shadowing+ build-depends:+ QuickCheck+ , base+ , criterion+ , genvalidity+ , genvalidity-path+ , path+ other-modules:+ Paths_genvalidity_path+ default-language: Haskell2010
src/Data/GenValidity/Path.hs view
@@ -12,17 +12,23 @@ import Path import Path.Internal +import Test.QuickCheck.Gen+ instance GenUnchecked (Path a f) where genUnchecked = Path <$> genUnchecked shrinkUnchecked (Path s) = Path <$> shrinkUnchecked s -instance GenValid (Path Abs File)+instance GenValid (Path Abs File) where+ genValid = (Path . ('/' :) <$> genUnchecked) `suchThat` isValid -instance GenValid (Path Abs Dir)+instance GenValid (Path Abs Dir) where+ genValid = (Path . ('/' :) . (++ "/") <$> genUnchecked) `suchThat` isValid -instance GenValid (Path Rel File)+instance GenValid (Path Rel File) where+ genValid = (Path <$> genUnchecked) `suchThat` isValid -instance GenValid (Path Rel Dir)+instance GenValid (Path Rel Dir) where+ genValid = (Path . (++ "/") <$> genUnchecked) `suchThat` isValid instance GenInvalid (Path Abs File)