on master help sign in
4 files changed+10−4
since splitsnapshots
unifiedsplit
CHANGELOG.md+3 example/Main.hs+1 src/TypeFun/Data/Peano.hs+5−3 type-fun.cabal+1−1
CHANGELOG.md+3
@@ -4,6 +4,9 @@
44
55# CHANGELOG
66
7+## 0.1.2
8+### Added KnownPeano
9+
710## 0.1.1
811### Fixed
912* Compilable with ghc-8.0.1
example/Main.hs+1
@@ -37,4 +37,5 @@ main = do
3737 print $ prefixConstr p2
3838 print $ prefixConstr p3
3939 print $ uniqConstr p2
40+ print $ peanoVal (Proxy :: Proxy (FromNat 100))
4041 -- print $ uniqConstr p3 -- < ElementIsNotUniqInList Int '[Int, Bool, Int]
src/TypeFun/Data/Peano.hs+5−3
@@ -1,5 +1,6 @@
11module TypeFun.Data.Peano
22 ( N(..)
3+ , KnownPeano(..)
34 , ToNat
45 , FromNat
56 , (:+:)
@@ -7,14 +8,15 @@ module TypeFun.Data.Peano
78 , (:*:)
89 ) where
910
10−import Data.Typeable
11−import GHC.Generics (Generic)
12−import GHC.TypeLits
11+import Data.Typeable
12+import GHC.Generics (Generic)
13+import GHC.TypeLits
1314
1415data N = Z | S N
1516 deriving ( Eq, Ord, Read, Show
1617 , Generic, Typeable )
1718
19+-- | @since 0.1.2
1820class KnownPeano (p :: N) where
1921 peanoVal :: proxy p -> Integer
2022
type-fun.cabal+1−1
@@ -1,5 +1,5 @@
11name: type-fun
2−version: 0.1.1
2+version: 0.1.2
33synopsis: Collection of widely reimplemented type families
44license: BSD3
55license-file: LICENSE