kinds 0.0.0.0 → 0.0.1.0
raw patch · 2 files changed
+30/−9 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Kind: KindStar :: KindStar
+ Data.Kind: data KindStar
+ Data.Kind: instance Inhabitant KindStar val
+ Data.Kind: instance Kind KindStar
Files
- kinds.cabal +3/−2
- src/Data/Kind.hs +27/−7
kinds.cabal view
@@ -1,5 +1,5 @@ Name: kinds-Version: 0.0.0.0+Version: 0.0.1.0 Cabal-Version: >= 1.2.3 Build-Type: Simple License: BSD3@@ -27,7 +27,8 @@ Library Build-Depends: base >= 3.0 && < 4.1- Extensions: MultiParamTypeClasses+ Extensions: FlexibleInstances+ MultiParamTypeClasses Rank2Types TypeFamilies Exposed-Modules: Data.Kind
src/Data/Kind.hs view
@@ -1,8 +1,8 @@ {-|- Support for subkinds, including subkind polymorphism.+ Support for subkinds of kind @*@, including subkind polymorphism. - Imagine, we had a language extension for declaring subkinds where a subkind declaration would- be written as follows:+ Imagine, we had a language extension for declaring subkinds of kind @*@ where a subkind+ declaration would be written as follows: @ subkind /K/ = /C_1/ => /t_1/ | ... | /C_n/ => /t_n/@@ -25,8 +25,9 @@ subkind /K/ = /C_1/ => /t_1/ | ... | /C_n/ => /t_n/ @ - can be emulated using this module. First, we declare an empty type @Kind/K/@ that- represents the subkind. Then we add the following instance declaration:+ can be emulated using this module. First, we declare a type @Kind/K/@ with a nullary data+ constructor of the same name for representing the subkind. Then we add the following instance+ declaration: @ instance Kind Kind/K/ where@@ -52,7 +53,7 @@ respectively. The above subkind declaration for @Map@ can be emulated with the following code: @- data KindMap+ data KindMap = KindMap   instance Kind KindMap where  @@ -72,11 +73,16 @@ -} module Data.Kind ( + -- * Subkinds in general Kind (type All, closed),- Inhabitant (specialize)+ Inhabitant (specialize), + -- * Kind @*@ as a subkind of itself+ KindStar (KindStar)+ ) where + -- * Subkinds in general -- |The class of subkind representations. class Kind kind where @@ -106,3 +112,17 @@ a new inhabitant, one would have to provide an implementation of @specialize@. -} specialize :: All kind item -> item inhabitant++ -- * Kind @*@ as a subkind of itself+ -- |Represents kind @*@ itself.+ data KindStar = KindStar++ instance Kind KindStar where++ data All KindStar item = AllStar (forall val. item val)++ closed item = AllStar item++ instance Inhabitant KindStar val where++ specialize (AllStar item) = item