hw-excess 0.2.0.0 → 0.2.0.2
raw patch · 2 files changed
+75/−60 lines, 2 filesdep −storable-recorddep ~QuickCheckdep ~basedep ~hspecPVP ok
version bump matches the API change (PVP)
Dependencies removed: storable-record
Dependency ranges changed: QuickCheck, base, hspec, hw-bits, hw-prim, hw-rankselect-base, safe, vector
API changes (from Hackage documentation)
Files
- hw-excess.cabal +62/−48
- src/HaskellWorks/Data/Excess/Triplet.hs +13/−12
hw-excess.cabal view
@@ -1,53 +1,67 @@-name: hw-excess-version: 0.2.0.0-synopsis: Excess-description: Please see README.md-homepage: http://github.com/haskell-works/hw-excess#readme-license: BSD3-license-file: LICENSE-author: John Ky-maintainer: newhoggy@gmail.com-copyright: 2016 John Ky-category: Data, Conduit-build-type: Simple-extra-source-files: README.md-cabal-version: >= 1.22--library- hs-source-dirs: src- exposed-modules: HaskellWorks.Data.Excess- , HaskellWorks.Data.Excess.Excess0- , HaskellWorks.Data.Excess.Excess1- , HaskellWorks.Data.Excess.MinMaxExcess0- , HaskellWorks.Data.Excess.MinMaxExcess1- , HaskellWorks.Data.Excess.Triplet- build-depends: base >= 4 && < 5- , hw-bits >= 0.4.0.0- , hw-prim >= 0.4.0.0- , hw-rankselect-base >= 0.2.0.0- , safe- , storable-record- , vector+-- This file has been generated from package.yaml by hpack version 0.18.1.+--+-- see: https://github.com/sol/hpack - default-language: Haskell2010- ghc-options: -Wall -O2 -msse4.2+name: hw-excess+version: 0.2.0.2+synopsis: Excess+description: Please see README.md+category: Data, Conduit+homepage: http://github.com/haskell-works/hw-excess#readme+bug-reports: https://github.com/haskell-works/hw-excess/issues+author: John Ky+maintainer: newhoggy@gmail.com+copyright: 2016 John Ky+license: BSD3+license-file: LICENSE+tested-with: GHC == 8.4.2, GHC == 8.2.2, GHC == 8.0.2, GHC == 7.10.3+build-type: Simple+cabal-version: >= 1.10 -test-suite hw-excess-test- type: exitcode-stdio-1.0- hs-source-dirs: test- main-is: Spec.hs- other-modules: HaskellWorks.Data.Excess.MinMaxExcess0Spec- , HaskellWorks.Data.Excess.MinMaxExcess1Spec- build-depends: base >= 4 && < 5- , hspec- , hw-bits >= 0.4.0.0- , hw-prim >= 0.4.0.0- , hw-excess- , QuickCheck- , vector- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall- default-language: Haskell2010+extra-source-files:+ README.md source-repository head- type: git+ type: git location: https://github.com/haskell-works/hw-excess++library+ hs-source-dirs:+ src+ ghc-options: -Wall -O2 -msse4.2+ build-depends:+ base >=4.8 && <5+ , hw-bits >=0.4.0.0 && < 0.8+ , hw-prim >=0.4.0.0 && < 0.7+ , vector >= 0.12 && < 0.13+ , hw-rankselect-base >=0.2.0.0 && < 0.4+ , safe >= 0.2 && < 0.4+ exposed-modules:+ HaskellWorks.Data.Excess+ HaskellWorks.Data.Excess.Excess0+ HaskellWorks.Data.Excess.Excess1+ HaskellWorks.Data.Excess.MinMaxExcess0+ HaskellWorks.Data.Excess.MinMaxExcess1+ HaskellWorks.Data.Excess.Triplet+ other-modules:+ Paths_hw_excess+ default-language: Haskell2010++test-suite hw-excess-test+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ hs-source-dirs:+ test+ ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N+ build-depends:+ base >=4.8 && <5+ , hw-bits >=0.4.0.0 && < 0.8+ , hw-prim >=0.4.0.0 && < 0.7+ , vector >= 0.12 && < 0.13+ , hspec >= 2.3 && < 2.6+ , hw-excess+ , QuickCheck >= 2.10 && < 2.12+ other-modules:+ HaskellWorks.Data.Excess.MinMaxExcess0Spec+ HaskellWorks.Data.Excess.MinMaxExcess1Spec+ default-language: Haskell2010
src/HaskellWorks/Data/Excess/Triplet.hs view
@@ -4,11 +4,10 @@ ( Triplet(..) ) where -import Control.Applicative (liftA3)+import Control.Applicative (pure)+import Foreign.Ptr (castPtr) import Foreign.Storable (Storable (..)) -import qualified Foreign.Storable.Record as Store- data Triplet = Triplet { tripletMinExcess :: !Int , tripletAllExcess :: !Int@@ -16,13 +15,15 @@ } deriving (Eq, Show) instance Storable Triplet where- sizeOf = Store.sizeOf storeTriple- alignment = Store.alignment storeTriple- peek = Store.peek storeTriple- poke = Store.poke storeTriple+ sizeOf _ = sizeOf (0 :: Int) * 3+ alignment _ = alignment (0 :: Int)+ peek p = do let q = castPtr p+ a <- peek q+ b <- peekElemOff q 1+ c <- peekElemOff q 2+ pure (Triplet a b c)+ poke p t = do let q = castPtr p+ poke q (tripletMinExcess t)+ pokeElemOff q 1 (tripletAllExcess t)+ pokeElemOff q 2 (tripletMaxExcess t) -storeTriple :: Store.Dictionary Triplet-storeTriple = Store.run $ liftA3 Triplet- (Store.element tripletMinExcess)- (Store.element tripletAllExcess)- (Store.element tripletMaxExcess)