type-fun 0.1.2 → 0.1.3
raw patch · 3 files changed
+22/−11 lines, 3 files
Files
- CHANGELOG.md +4/−0
- src/TypeFun/Data/List.hs +16/−10
- type-fun.cabal +2/−1
CHANGELOG.md view
@@ -4,6 +4,10 @@ # CHANGELOG +## 0.1.3+### Fixed+* Buildability with GHC-8.10 (by enobayram)+ ## 0.1.2 ### Added KnownPeano
src/TypeFun/Data/List.hs view
@@ -45,13 +45,13 @@ , subListId ) where -import Data.Type.Bool-import GHC.Exts-import GHC.TypeLits-import TypeFun.Data.Eq-import TypeFun.Data.Maybe-import TypeFun.Data.Peano-import Unsafe.Coerce+import Data.Type.Bool+import GHC.Exts+import GHC.TypeLits+import TypeFun.Data.Eq+import TypeFun.Data.Maybe+import TypeFun.Data.Peano+import Unsafe.Coerce ------------------------------------------------------------------------ -- NOTE: Errors type classes. These type classes are not in separate --@@ -108,12 +108,16 @@ '[] :++: b = b (a ': as) :++: b = a ': (as :++: b) +data Dict c where Dict :: c => Dict c+ appendId :: forall proxy l r . proxy l -> (l ~ (l :++: '[]) => r) -> r-appendId = unsafeCoerce id+appendId _ r = case obvious of Dict -> r+ where obvious :: Dict (l ~ (l :++: '[]))+ obvious = unsafeCoerce (Dict :: Dict (l ~ l)) type IndexOf a s = FromJust (IndexOfMay a s) @@ -162,7 +166,7 @@ Count a (a ': as) = 'S (Count a as) Count a (b ': as) = Count a as --- | Constanints that first argument is a sublist of second. Reduces+-- | Constrains that first argument is a sublist of second. Reduces -- to __(Elem a1 b, Elem a2 b, Elem a3 b, ...)__ type family SubList (a :: [k]) (b :: [k]) :: Constraint where SubList '[] bs = ()@@ -172,7 +176,9 @@ :: forall proxy l r . proxy l -> (SubList l l => r) -> r-subListId _ = unsafeCoerce id+subListId _ r = case obvious of Dict -> r+ where obvious :: Dict (SubList l l)+ obvious = unsafeCoerce (Dict :: Dict ()) type family NotSubList (a :: [k]) (b :: [k]) :: Constraint where NotSubList '[] bs = ()
type-fun.cabal view
@@ -1,5 +1,5 @@ name: type-fun-version: 0.1.2+version: 0.1.3 synopsis: Collection of widely reimplemented type families license: BSD3 license-file: LICENSE@@ -22,6 +22,7 @@ , DeriveDataTypeable , DeriveGeneric , FlexibleInstances+ , GADTs , MultiParamTypeClasses , PolyKinds , RankNTypes