From b4b327f6935be27bbc1a9acca60833cb117de317 Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Tue, 24 Mar 2015 15:10:56 +0100 Subject: [PATCH] Add support for `Natural` type --- Data/IntCast.hs | 5 ++++- changelog.md | 6 ++++++ int-cast.cabal | 16 ++++++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Data/IntCast.hs b/Data/IntCast.hs index f76b7d5..e44621d 100644 --- a/Data/IntCast.hs +++ b/Data/IntCast.hs @@ -58,6 +58,7 @@ import Foreign.C.Types import GHC.TypeLits import Data.Bits import Data.Type.Equality +import Numeric.Natural (Natural) -- | (Kind) Meta-information about integral types. -- @@ -79,7 +80,8 @@ data IntBaseTypeK -- information about the value range of an integral type. -- -- This module also provides type family instances for the standard --- Haskell 2010 integral types (including "Foreign.C.Types"). +-- Haskell 2010 integral types (including "Foreign.C.Types") as well +-- as the 'Natural' type. -- -- Here's a simple example for registering a custom type with the -- "Data.IntCast" facilities: @@ -103,6 +105,7 @@ data IntBaseTypeK type family IntBaseType a :: IntBaseTypeK type instance IntBaseType Integer = 'BigIntTag +type instance IntBaseType Natural = 'BigWordTag -- Haskell2010 Basic fixed-width Integer Types type instance IntBaseType Int8 = 'FixedIntTag 8 diff --git a/changelog.md b/changelog.md index 0328802..dc9f787 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +## 0.1.2.0 + + - Add support for GHC 7.10 + + - Add support for `Natural` + ## 0.1.1.0 * Fix `intCastIso` to be reflexive wrt non-fixed integer types diff --git a/int-cast.cabal b/int-cast.cabal index a429da3..4d25a80 100644 --- a/int-cast.cabal +++ b/int-cast.cabal @@ -1,5 +1,5 @@ name: int-cast -version: 0.1.1.0 +version: 0.1.2.0 synopsis: Checked conversions between integral types homepage: https://github.com/hvr/int-cast bug-reports: https://github.com/hvr/int-cast/issues @@ -19,11 +19,6 @@ source-repository head type: git location: https://github.com/hvr/int-cast.git -source-repository this - type: git - location: https://github.com/hvr/int-cast.git - tag: 0.1.1.0 - library default-language: Haskell2010 other-extensions: @@ -32,7 +27,10 @@ library TypeFamilies TypeOperators UndecidableInstances - build-depends: base ==4.7.* + build-depends: base >=4.7 && <4.9 + if !impl(ghc>=7.10) + build-depends: nats >=0.1 && <1.1 + exposed-modules: Data.IntCast test-suite int-cast-test @@ -41,4 +39,6 @@ test-suite int-cast-test hs-source-dirs: test . main-is: Suite.hs ghc-options: -Wall - build-depends: int-cast, base, QuickCheck ==2.6.*, test-framework ==0.8.*, test-framework-quickcheck2 ==0.3.*, nats ==0.1.* + build-depends: int-cast, base, QuickCheck ==2.7.*, test-framework ==0.8.*, test-framework-quickcheck2 ==0.3.* + if !impl(ghc>=7.10) + build-depends: nats