packages feed

finite-typelits 0.1.4.1 → 0.1.4.2

raw patch · 2 files changed

+5/−3 lines, 2 filesdep ~base

Dependency ranges changed: base

Files

finite-typelits.cabal view
@@ -1,5 +1,5 @@ name:                finite-typelits-version:             0.1.4.1+version:             0.1.4.2 synopsis:            A type inhabited by finitely many values, indexed by type-level naturals. description:         A type inhabited by finitely many values, indexed by type-level naturals. homepage:            https://github.com/mniip/finite-typelits
src/Data/Finite/Internal.hs view
@@ -7,7 +7,7 @@ -- Stability   :  experimental -- Portability :  portable ---------------------------------------------------------------------------------{-# LANGUAGE KindSignatures, DataKinds #-}+{-# LANGUAGE KindSignatures, DataKinds, DeriveGeneric #-} module Data.Finite.Internal     (         Finite(Finite),@@ -18,6 +18,7 @@  import GHC.Read import GHC.TypeLits+import GHC.Generics import Control.DeepSeq import Control.Monad import Data.Ratio@@ -28,7 +29,8 @@ -- -- prop> getFinite x < natVal x -- prop> getFinite x >= 0-newtype Finite (n :: Nat) = Finite Integer deriving (Eq, Ord)+newtype Finite (n :: Nat) = Finite Integer+                          deriving (Eq, Ord, Generic)  -- | Convert an 'Integer' into a 'Finite', throwing an error if the input is out of bounds. finite :: KnownNat n => Integer -> Finite n