packages feed

red-black-record 2.0.0.1 → 2.0.1.0

raw patch · 2 files changed

+11/−10 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Data.RBR.Internal: type Empty = E
- Data.RBR: impossible :: Variant f E -> b
+ Data.RBR: impossible :: Variant f Empty -> b
- Data.RBR: unit :: Record f E
+ Data.RBR: unit :: Record f Empty
- Data.RBR.Internal: impossible :: Variant f E -> b
+ Data.RBR.Internal: impossible :: Variant f Empty -> b
- Data.RBR.Internal: unit :: Record f E
+ Data.RBR.Internal: unit :: Record f Empty

Files

lib/Data/RBR/Internal.hs view
@@ -55,6 +55,8 @@     deriving (Show,Eq)
 
 -- | A map without entries. See also 'unit' and 'impossible'.
+type Empty = E
+
 type EmptyMap = E
 
 --
@@ -122,7 +124,7 @@     go left right = Node left (K (symbolVal (Proxy @k))) right 
 
 {- |
-  Two-place constraint saying that the symbol can be demoted to String. Nothing is required from the value type.
+  Two-place constraint saying that the 'Symbol' can be demoted to String. Nothing is required from the value type.
 
   Defined using the "class synonym" <https://www.reddit.com/r/haskell/comments/ab8ypl/monthly_hask_anything_january_2019/edk1ot3/ trick>.
 -}
@@ -203,7 +205,7 @@ 
 {-| A Record without components is a boring, uninformative type whose single value can be conjured out of thin air.
 -}
-unit :: Record f E
+unit :: Record f Empty
 unit = Empty
 
 {- | An extensible sum-like type with named branches.
@@ -221,7 +223,7 @@ 
 {-| A Variant without branches doesn't have any values. From an impossible thing, anything can come out. 
 -}
-impossible :: Variant f E -> b
+impossible :: Variant f Empty -> b
 impossible v = case v of
 
 {- | Show a 'Variant' in a friendlier way than the default 'Show' instance. The
@@ -1588,12 +1590,6 @@     del' = delR @k @v @left @kx @vx @right  
     win' = winR @k @v @left @kx @vx @right  
 
--- delete :: Ord a => a -> RB a -> RB a
-class Deletable (k :: Symbol) (v :: Type) (t :: Map Symbol Type) where
-    type Delete k v t :: Map Symbol Type
-    delete :: Record f t -> Record f (Delete k v t)
-    winnow :: Variant f t -> Either (Variant f (Delete k v t)) (f v) 
-
 {- | Class that determines if the pair of a 'Symbol' key and a 'Type' can
      be deleted from a type-level tree.
  
@@ -1610,6 +1606,11 @@      If the tree already has the key but with a /different/ type, the deletion
      fails to compile.
  -}
+class Deletable (k :: Symbol) (v :: Type) (t :: Map Symbol Type) where
+    type Delete k v t :: Map Symbol Type
+    delete :: Record f t -> Record f (Delete k v t)
+    winnow :: Variant f t -> Either (Variant f (Delete k v t)) (f v) 
+
 instance (Delable k v t, CanMakeBlack (Del k v t)) => Deletable k v t where
     type Delete k v t = MakeBlack (Del k v t)
     delete r = makeBlackR (del @k @v r) 
red-black-record.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.0
 name:                red-black-record
-version:             2.0.0.1
+version:             2.0.1.0
 synopsis:            Extensible records and variants indexed by a type-level Red-Black tree.
 
 description:         A library that provides extensible records and variants,