packages feed

nat-sized-numbers 0.1.0.0 → 0.2.0.0

raw patch · 3 files changed

+16/−12 lines, 3 files

Files

nat-sized-numbers.cabal view
@@ -1,5 +1,5 @@ name:                nat-sized-numbers-version:             0.1.0.0+version:             0.2.0.0 synopsis:            Variable-sized numbers from type-level nats. description:         Variable-sized numbers from type-level nats. homepage:            https://github.com/oisdk/nat-sized-numbers#readme
src/Numeric/Sized/IntOfSize.hs view
@@ -1,7 +1,8 @@-{-# LANGUAGE DataKinds             #-}-{-# LANGUAGE DeriveGeneric         #-}-{-# LANGUAGE KindSignatures        #-}-{-# LANGUAGE ScopedTypeVariables   #-}+{-# LANGUAGE DataKinds                  #-}+{-# LANGUAGE DeriveGeneric              #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE KindSignatures             #-}+{-# LANGUAGE ScopedTypeVariables        #-}  -- | This module exports the 'IntOfSize' type and associated functions. module Numeric.Sized.IntOfSize@@ -15,6 +16,7 @@ import           Data.Proxy import           GHC.Generics import           GHC.TypeLits+import           Data.Ix  -- $setup -- >>> :set -XDataKinds@@ -26,7 +28,7 @@ -- -128 newtype IntOfSize (n :: Nat) = IntOfSize     { getIntOfSize :: Integer-    } deriving (Generic)+    } deriving (Generic, Ix)  instance KnownNat n =>          Bounded (IntOfSize n) where@@ -121,7 +123,7 @@ allIntsOfSize = f [0 .. maxBound ] (drop 1 [0,-1 .. minBound])   where     f (x:xs) ys = x : f ys xs-    f [] ys = ys+    f [] ys     = ys  instance KnownNat n =>          Show (IntOfSize n) where
src/Numeric/Sized/WordOfSize.hs view
@@ -1,7 +1,8 @@-{-# LANGUAGE DataKinds             #-}-{-# LANGUAGE DeriveGeneric         #-}-{-# LANGUAGE KindSignatures        #-}-{-# LANGUAGE ScopedTypeVariables   #-}+{-# LANGUAGE DataKinds                  #-}+{-# LANGUAGE DeriveGeneric              #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE KindSignatures             #-}+{-# LANGUAGE ScopedTypeVariables        #-}  -- | This module exports the 'WordOfSize' type and associated functions. module Numeric.Sized.WordOfSize@@ -12,6 +13,7 @@ import           Data.Bits import           Data.Coerce import           Data.Function+import           Data.Ix import           Data.Proxy import           GHC.Generics import           GHC.TypeLits@@ -27,7 +29,7 @@ -- 0 newtype WordOfSize (n :: Nat) = WordOfSize     { getWordOfSize :: Natural-    } deriving (Generic)+    } deriving (Generic, Ix)  instance KnownNat n =>          Bounded (WordOfSize n) where