on master help sign in
CHANGELOG.md+3
since splitsnapshots
unifiedsplit
@@ -4,6 +4,9 @@
4
4
5# CHANGELOG
5# CHANGELOG
6
6
7+## 0.1.2
8+### Added KnownPeano
9+
7## 0.1.1
10## 0.1.1
8### Fixed
11### Fixed
9* Compilable with ghc-8.0.1
12* Compilable with ghc-8.0.1
example/Main.hs+1
@@ -37,4 +37,5 @@ main = do
37 print $ prefixConstr p2
37 print $ prefixConstr p2
38 print $ prefixConstr p3
38 print $ prefixConstr p3
39 print $ uniqConstr p2
39 print $ uniqConstr p2
40+ print $ peanoVal (Proxy :: Proxy (FromNat 100))
40 -- print $ uniqConstr p3 -- < ElementIsNotUniqInList Int '[Int, Bool, Int]
41 -- print $ uniqConstr p3 -- < ElementIsNotUniqInList Int '[Int, Bool, Int]
src/TypeFun/Data/Peano.hs+5−3
@@ -1,5 +1,6 @@
1module TypeFun.Data.Peano
1module TypeFun.Data.Peano
2 ( N(..)
2 ( N(..)
3+ , KnownPeano(..)
3 , ToNat
4 , ToNat
4 , FromNat
5 , FromNat
5 , (:+:)
6 , (:+:)
@@ -7,14 +8,15 @@ module TypeFun.Data.Peano
7 , (:*:)
8 , (:*:)
8 ) where
9 ) where
9
10
10−import Data.Typeable
11+import Data.Typeable
11−import GHC.Generics (Generic)
12+import GHC.Generics (Generic)
12−import GHC.TypeLits
13+import GHC.TypeLits
13
14
14data N = Z | S N
15data N = Z | S N
15 deriving ( Eq, Ord, Read, Show
16 deriving ( Eq, Ord, Read, Show
16 , Generic, Typeable )
17 , Generic, Typeable )
17
18
19+-- | @since 0.1.2
18class KnownPeano (p :: N) where
20class KnownPeano (p :: N) where
19 peanoVal :: proxy p -> Integer
21 peanoVal :: proxy p -> Integer
20
22
type-fun.cabal+1−1
@@ -1,5 +1,5 @@
1name: type-fun
1name: type-fun
2−version: 0.1.1
2+version: 0.1.2
3synopsis: Collection of widely reimplemented type families
3synopsis: Collection of widely reimplemented type families
4license: BSD3
4license: BSD3
5license-file: LICENSE
5license-file: LICENSE