packages feed

validity 0.12.0.0 → 0.12.0.1

raw patch · 4 files changed

+44/−2 lines, 4 filesdep ~base

Dependency ranges changed: base

Files

CHANGELOG.md view
@@ -1,5 +1,11 @@ # Changelog +## [0.12.0.1] - 2022-04-26++### Added++* Compatibility with `GHC >= 9.0.0`+ ## [0.12.0.0] - 2021-11-20  ### Removed
src/Data/Validity.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-}@@ -99,7 +100,11 @@ import Data.List (intercalate) import Data.List.NonEmpty (NonEmpty ((:|))) import Data.Maybe (fromMaybe)+#if MIN_VERSION_base(4,16,0)+import GHC.Exts (Char (..), isTrue#, ord#, (<=#), (>=#))+#else import GHC.Exts (Char (..), isTrue#, leWord#, ord#, (<=#), (>=#))+#endif import GHC.Generics import GHC.Int (Int16 (..), Int32 (..), Int8 (..)) import GHC.Natural@@ -433,6 +438,11 @@ instance Validity Int where   validate = trivialValidation +#if MIN_VERSION_base(4,16,0)+instance Validity Int8 where validate = trivialValidation+instance Validity Int16 where validate = trivialValidation+instance Validity Int32 where validate = trivialValidation+#else -- | NOT trivially valid on GHC because small number types are represented using a 64bit structure underneath. instance Validity Int8 where   validate (I8# i#) =@@ -456,6 +466,7 @@       [ declare "The contained integer is smaller than 2^31 = 2147483648" $ isTrue# (i# <=# 2147483647#),         declare "The contained integer is greater than or equal to -2^31 = -2147483648" $ isTrue# (i# >=# -2147483648#)       ]+#endif  -- | Trivially valid instance Validity Int64 where@@ -465,6 +476,11 @@ instance Validity Word where   validate = trivialValidation +#if MIN_VERSION_base(4,16,0)+instance Validity Word8 where validate = trivialValidation+instance Validity Word16 where validate = trivialValidation+instance Validity Word32 where validate = trivialValidation+#else -- | NOT trivially valid on GHC because small number types are represented using a 64bit structure underneath. instance Validity Word8 where   validate (W8# w#) =@@ -479,6 +495,7 @@ instance Validity Word32 where   validate (W32# w#) =     declare "The contained integer is smaller than 2^32 = 4294967296" $ isTrue# (w# `leWord#` 4294967295##)+#endif  -- | Trivially valid instance Validity Word64 where
test/Data/ValiditySpec.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE MagicHash #-} @@ -51,30 +52,48 @@     describe "Validity Int8" $ do       it "Says that minBound is valid" $ isValid (minBound :: Int8) `shouldBe` True       it "Says that maxBound is valid" $ isValid (maxBound :: Int8) `shouldBe` True+#if MIN_VERSION_base(4,16,0)+#else       it "Says that Int# 200 is invalid" $ isValid (I8# 200#) `shouldBe` False       it "Says that Int# -200 is invalid" $ isValid (I8# (-200#)) `shouldBe` False+#endif     describe "Validity Int16" $ do       it "Says that minBound is valid" $ isValid (minBound :: Int16) `shouldBe` True       it "Says that maxBound is valid" $ isValid (maxBound :: Int16) `shouldBe` True+#if MIN_VERSION_base(4,16,0)+#else       it "Says that Int# 4000 is invalid" $ isValid (I16# 40000#) `shouldBe` False       it "Says that Int# -4000 is invalid" $ isValid (I16# (-40000#)) `shouldBe` False+#endif     describe "Validity Int32" $ do       it "Says that minBound is valid" $ isValid (minBound :: Int32) `shouldBe` True       it "Says that maxBound is valid" $ isValid (maxBound :: Int32) `shouldBe` True+#if MIN_VERSION_base(4,16,0)+#else       it "Says that Int# 2200000000 is invalid" $ isValid (I32# 2200000000#) `shouldBe` False       it "Says that Int# -2200000000 is invalid" $ isValid (I32# (-2200000000#)) `shouldBe` False+#endif     describe "Validity Word8" $ do       it "Says that minBound is valid" $ isValid (minBound :: Word8) `shouldBe` True       it "Says that maxBound is valid" $ isValid (maxBound :: Word8) `shouldBe` True+#if MIN_VERSION_base(4,16,0)+#else       it "Says that Word# 300 is invalid" $ isValid (W8# 300##) `shouldBe` False+#endif     describe "Validity Word16" $ do       it "Says that minBound is valid" $ isValid (minBound :: Word16) `shouldBe` True       it "Says that maxBound is valid" $ isValid (maxBound :: Word16) `shouldBe` True+#if MIN_VERSION_base(4,16,0)+#else       it "Says that Word# 80000 is invalid" $ isValid (W16# 80000##) `shouldBe` False+#endif     describe "Validity Word32" $ do       it "Says that minBound is valid" $ isValid (minBound :: Word32) `shouldBe` True       it "Says that maxBound is valid" $ isValid (maxBound :: Word32) `shouldBe` True+#if MIN_VERSION_base(4,16,0)+#else       it "Says that Word# 4800000000 is invalid" $ isValid (W32# 4800000000##) `shouldBe` False+#endif   describe "Chars" $ do     describe "Small" $ do       describe "Validity Char" $ do
validity.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack  name:           validity-version:        0.12.0.0+version:        0.12.0.1 synopsis:       Validity typeclass description:    For more info, see <https://github.com/NorfairKing/validity the readme>.                 .