singletons 2.4 → 2.4.1
raw patch · 4 files changed
+38/−13 lines, 4 files
Files
- CHANGES.md +5/−0
- singletons.cabal +2/−2
- src/Data/Singletons.hs +1/−0
- src/Data/Singletons/Internal.hs +30/−11
CHANGES.md view
@@ -1,6 +1,11 @@ Changelog for singletons project ================================ +2.4.1+-----+* Restore the `TyCon1`, `TyCon2`, etc. types. It turns out that the new+`TyCon` doesn't work with kind-polymorphic tycons.+ 2.4 --- * Require GHC 8.4.
singletons.cabal view
@@ -1,5 +1,5 @@ name: singletons-version: 2.4+version: 2.4.1 -- Remember to bump version in the Makefile as well cabal-version: >= 1.10 synopsis: A framework for generating singleton types@@ -38,7 +38,7 @@ source-repository this type: git location: https://github.com/goldfirere/singletons.git- tag: v2.4+ tag: v2.4.1 library hs-source-dirs: src
src/Data/Singletons.hs view
@@ -48,6 +48,7 @@ -- ** Defunctionalization TyFun, type (~>),+ TyCon1, TyCon2, TyCon3, TyCon4, TyCon5, TyCon6, TyCon7, TyCon8, TyCon, Apply, type (@@), -- ** Defunctionalized singletons
src/Data/Singletons/Internal.hs view
@@ -181,17 +181,10 @@ type a @@ b = Apply a b infixl 9 @@ --- | Wrapper for converting the normal type-level arrow into a '~>'.--- For example, given:------ > data Nat = Zero | Succ Nat--- > type family Map (a :: a ~> b) (a :: [a]) :: [b]--- > Map f '[] = '[]--- > Map f (x ': xs) = Apply f x ': Map f xs------ We can write:------ > Map (TyCon Succ) [Zero, Succ Zero]+-- | Workhorse for the 'TyCon1', etc., types. This can be used directly+-- in place of any of the @TyConN@ types, but it will work only with+-- /monomorphic/ types. When GHC#14645 is fixed, this should fully supersede+-- the @TyConN@ types. data family TyCon :: (k1 -> k2) -> unmatchable_fun -- That unmatchable_fun should really be a function of k1 and k2, -- but GHC 8.4 doesn't support type family calls in the result kind@@ -211,6 +204,32 @@ ApplyTyCon f x = f x type instance Apply (TyCon f) x = ApplyTyCon f x++-- | Wrapper for converting the normal type-level arrow into a '~>'.+-- For example, given:+--+-- > data Nat = Zero | Succ Nat+-- > type family Map (a :: a ~> b) (a :: [a]) :: [b]+-- > Map f '[] = '[]+-- > Map f (x ': xs) = Apply f x ': Map f xs+--+-- We can write:+--+-- > Map (TyCon1 Succ) [Zero, Succ Zero]+type TyCon1 = (TyCon :: (k1 -> k2) -> (k1 ~> k2))++-- | Similar to 'TyCon1', but for two-parameter type constructors.+type TyCon2 = (TyCon :: (k1 -> k2 -> k3) -> (k1 ~> k2 ~> k3))+type TyCon3 = (TyCon :: (k1 -> k2 -> k3 -> k4) -> (k1 ~> k2 ~> k3 ~> k4))+type TyCon4 = (TyCon :: (k1 -> k2 -> k3 -> k4 -> k5) -> (k1 ~> k2 ~> k3 ~> k4 ~> k5))+type TyCon5 = (TyCon :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6)+ -> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6))+type TyCon6 = (TyCon :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7)+ -> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7))+type TyCon7 = (TyCon :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7 -> k8)+ -> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7 ~> k8))+type TyCon8 = (TyCon :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7 -> k8 -> k9)+ -> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7 ~> k8 ~> k9)) ---------------------------------------------------------------------- ---- Defunctionalized Sing instance and utilities --------------------