summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormniip <>2018-07-11 18:40:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-07-11 18:40:00 (GMT)
commitee0bdee24d8d05dbb08a48d6d391c3f366ec1279 (patch)
tree776da7a0bf6926b86cf40c2deff5334b89430339
parent82f982540c027628d15c30e37755c0a29bb6254a (diff)
version 0.1.4.10.1.4.1
-rw-r--r--finite-typelits.cabal2
-rw-r--r--src/Data/Finite.hs2
-rw-r--r--src/Data/Finite/Internal.hs6
3 files changed, 4 insertions, 6 deletions
diff --git a/finite-typelits.cabal b/finite-typelits.cabal
index a7e5ad3..f3d6fdf 100644
--- a/finite-typelits.cabal
+++ b/finite-typelits.cabal
@@ -1,5 +1,5 @@
name: finite-typelits
-version: 0.1.4.0
+version: 0.1.4.1
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
diff --git a/src/Data/Finite.hs b/src/Data/Finite.hs
index a983e5e..d9a628b 100644
--- a/src/Data/Finite.hs
+++ b/src/Data/Finite.hs
@@ -52,7 +52,7 @@ finiteProxy _ = finite
finites :: KnownNat n => [Finite n]
finites = results
where
- results = Finite <$> [0 .. (natVal (head results) - 1)]
+ results = Finite `fmap` [0 .. (natVal (head results) - 1)]
-- | Same as 'finites' but with a proxy argument to avoid type signatures.
finitesProxy :: KnownNat n => proxy n -> [Finite n]
diff --git a/src/Data/Finite/Internal.hs b/src/Data/Finite/Internal.hs
index 7cc2fc0..e666f5a 100644
--- a/src/Data/Finite/Internal.hs
+++ b/src/Data/Finite/Internal.hs
@@ -7,7 +7,7 @@
-- Stability : experimental
-- Portability : portable
--------------------------------------------------------------------------------
-{-# LANGUAGE KindSignatures, DataKinds, DeriveGeneric #-}
+{-# LANGUAGE KindSignatures, DataKinds #-}
module Data.Finite.Internal
(
Finite(Finite),
@@ -18,7 +18,6 @@ module Data.Finite.Internal
import GHC.Read
import GHC.TypeLits
-import GHC.Generics
import Control.DeepSeq
import Control.Monad
import Data.Ratio
@@ -29,8 +28,7 @@ import Text.ParserCombinators.ReadPrec
--
-- prop> getFinite x < natVal x
-- prop> getFinite x >= 0
-newtype Finite (n :: Nat) = Finite Integer
- deriving (Eq, Ord, Generic)
+newtype Finite (n :: Nat) = Finite Integer deriving (Eq, Ord)
-- | Convert an 'Integer' into a 'Finite', throwing an error if the input is out of bounds.
finite :: KnownNat n => Integer -> Finite n