packages feed

data-diverse 2.0.0.0 → 2.0.1.0

raw patch · 4 files changed

+100/−75 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.Diverse.Many.Internal: instance (Data.Diverse.Case.Case (c r n) (x : xs), Data.Diverse.Reiterate.ReiterateN (c r) n (x : xs), Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorN c (n GHC.TypeLits.+ 1) xs) r, r ~ Data.Diverse.TypeLevel.CaseResult (c r n) x) => Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorN c n (x : xs)) r
- Data.Diverse.Many.Internal: instance (Data.Diverse.Many.Internal.CaseAny (c r n) (x : xs), Data.Diverse.Reiterate.ReiterateN (c r) n (x : xs), Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorAnyN c (n GHC.TypeLits.+ 1) xs) r, r ~ Data.Diverse.TypeLevel.CaseResult (c r n) GHC.Prim.Any) => Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorAnyN c n (x : xs)) r
- Data.Diverse.Many.Internal: instance (Data.Diverse.Many.Internal.CaseAny (c r) (x : xs), Data.Diverse.Reiterate.Reiterate (c r) (x : xs), Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorAny c xs) r, r ~ Data.Diverse.TypeLevel.CaseResult (c r) GHC.Prim.Any) => Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorAny c (x : xs)) r
- Data.Diverse.Many.Internal: instance forall k (c :: * -> k -> [GHC.Types.Type] -> *) (n :: k) r. Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorAnyN c n '[]) r
- Data.Diverse.Many.Internal: instance forall k (indices :: [GHC.Types.Nat]) (larger :: [GHC.Types.Type]) (r :: k) (n :: GHC.Types.Nat) x (xs :: [GHC.Types.Type]). Data.Diverse.Reiterate.ReiterateN (Data.Diverse.Many.Internal.CaseAmendN' indices larger r) n (x : xs)
- Data.Diverse.Many.Internal: instance forall k (indices :: [GHC.Types.Nat]) (larger :: [GHC.Types.Type]) (r :: k) (n :: GHC.Types.Nat) z (zs :: [GHC.Types.Type]). Data.Diverse.Reiterate.ReiterateN (Data.Diverse.Many.Internal.CaseAmendN indices larger r) n (z : zs)
- Data.Diverse.Many.Internal: instance forall k (indices :: [GHC.Types.Nat]) (smaller :: [GHC.Types.Type]) (r :: k) (n :: GHC.Types.Nat) x (xs :: [GHC.Types.Type]). Data.Diverse.Reiterate.ReiterateN (Data.Diverse.Many.Internal.CaseSelectN indices smaller r) n (x : xs)
- Data.Diverse.Many.Internal: instance forall k (larger :: [GHC.Types.Type]) (r :: k) x (xs :: [GHC.Types.Type]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Many.Internal.CaseAmend' larger r) (x : xs)
- Data.Diverse.Many.Internal: instance forall k (larger :: [GHC.Types.Type]) (r :: k) z (zs :: [GHC.Types.Type]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Many.Internal.CaseAmend larger r) (z : zs)
- Data.Diverse.Many.Internal: instance forall k (smaller :: [GHC.Types.Type]) (larger :: [GHC.Types.Type]) (r :: k) x (xs :: [GHC.Types.Type]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Many.Internal.CaseSelect smaller larger r) (x : xs)
- Data.Diverse.Which: type SwitchN c r n xs = Reduce (Which xs) (SwitcherN c r n xs)
- Data.Diverse.Which.Internal: instance (Data.Diverse.Case.Case (c r n) (x : x' : xs), Data.Diverse.Reduce.Reduce (Data.Diverse.Which.Internal.Which (x' : xs)) (Data.Diverse.Which.Internal.SwitcherN c r (n GHC.TypeLits.+ 1) (x' : xs)), Data.Diverse.Reiterate.ReiterateN (c r) n (x : x' : xs), r ~ Data.Diverse.TypeLevel.CaseResult (c r n) x) => Data.Diverse.Reduce.Reduce (Data.Diverse.Which.Internal.Which (x : x' : xs)) (Data.Diverse.Which.Internal.SwitcherN c r n (x : x' : xs))
- Data.Diverse.Which.Internal: instance (Data.Diverse.Reduce.Reduce (Data.Diverse.Which.Internal.Which (x : xs)) (Data.Diverse.Which.Internal.Switcher Data.Diverse.Which.Internal.CaseEqWhich GHC.Types.Bool (x : xs)), Data.Diverse.Reduce.Reduce (Data.Diverse.Which.Internal.Which (x : xs)) (Data.Diverse.Which.Internal.Switcher Data.Diverse.Which.Internal.CaseOrdWhich GHC.Types.Ordering (x : xs))) => GHC.Classes.Ord (Data.Diverse.Which.Internal.Which (x : xs))
- Data.Diverse.Which.Internal: instance Data.Diverse.Reduce.Reduce (Data.Diverse.Which.Internal.Which (x : xs)) (Data.Diverse.Which.Internal.Switcher Data.Diverse.Which.Internal.CaseEqWhich GHC.Types.Bool (x : xs)) => GHC.Classes.Eq (Data.Diverse.Which.Internal.Which (x : xs))
- Data.Diverse.Which.Internal: instance Data.Diverse.Reduce.Reduce (Data.Diverse.Which.Internal.Which (x : xs)) (Data.Diverse.Which.Internal.Switcher Data.Diverse.Which.Internal.CaseShowWhich GHC.Show.ShowS (x : xs)) => GHC.Show.Show (Data.Diverse.Which.Internal.Which (x : xs))
- Data.Diverse.Which.Internal: instance Data.Diverse.TypeLevel.MemberAt (Data.Diverse.TypeLevel.KindAtIndex n indices) x tree => Data.Diverse.Case.Case (Data.Diverse.Which.Internal.CaseDiversifyN indices (Data.Diverse.Which.Internal.Which tree) n) (x : branch')
- Data.Diverse.Which.Internal: instance forall k (branch :: [GHC.Types.Type]) (tree :: [GHC.Types.Type]) (r :: k) (tree' :: [GHC.Types.Type]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseReinterpret branch tree r) tree'
- Data.Diverse.Which.Internal: instance forall k (branch :: [GHC.Types.Type]) (tree :: [GHC.Types.Type]) (r :: k) (tree' :: [GHC.Types.Type]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseReinterpret' branch tree r) tree'
- Data.Diverse.Which.Internal: instance forall k (c :: k -> [GHC.Types.Type] -> *) (r :: k). Data.Diverse.Reduce.Reduce (Data.Diverse.Which.Internal.Which '[]) (Data.Diverse.Which.Internal.Switcher c r '[])
- Data.Diverse.Which.Internal: instance forall k (indices :: [GHC.Types.Nat]) (r :: k) (n :: GHC.Types.Nat) (branch' :: [GHC.Types.Type]). Data.Diverse.Reiterate.ReiterateN (Data.Diverse.Which.Internal.CaseDiversifyN indices r) n branch'
- Data.Diverse.Which.Internal: instance forall k (indices :: [GHC.Types.Nat]) (r :: k) (n :: GHC.Types.Nat) (tree' :: [GHC.Types.Type]). Data.Diverse.Reiterate.ReiterateN (Data.Diverse.Which.Internal.CaseReinterpretN' indices r) n tree'
- Data.Diverse.Which.Internal: instance forall k (r :: [GHC.Types.Type]) (branch :: [GHC.Types.Type]) (tree :: k) (branch' :: [GHC.Types.Type]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseDiversify r branch tree) branch'
- Data.Diverse.Which.Internal: instance forall k (r :: k) x (xs :: [GHC.Types.Type]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseEqWhich r) (x : xs)
- Data.Diverse.Which.Internal: instance forall k (r :: k) x (xs :: [GHC.Types.Type]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseOrdWhich r) (x : xs)
- Data.Diverse.Which.Internal: instance forall k (r :: k) x (xs :: [GHC.Types.Type]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseShowWhich r) (x : xs)
- Data.Diverse.Which.Internal: type SwitchN c r n xs = Reduce (Which xs) (SwitcherN c r n xs)
+ Data.Diverse.Many.Internal: instance (Data.Diverse.Case.Case (c r n) (x : xs), Data.Diverse.Reiterate.ReiterateN (c r) n (x : xs), Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorN c (n GHC.TypeNats.+ 1) xs) r, r ~ Data.Diverse.TypeLevel.CaseResult (c r n) x) => Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorN c n (x : xs)) r
+ Data.Diverse.Many.Internal: instance (Data.Diverse.Many.Internal.CaseAny (c r n) (x : xs), Data.Diverse.Reiterate.ReiterateN (c r) n (x : xs), Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorAnyN c (n GHC.TypeNats.+ 1) xs) r, r ~ Data.Diverse.TypeLevel.CaseResult (c r n) GHC.Types.Any) => Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorAnyN c n (x : xs)) r
+ Data.Diverse.Many.Internal: instance (Data.Diverse.Many.Internal.CaseAny (c r) (x : xs), Data.Diverse.Reiterate.Reiterate (c r) (x : xs), Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorAny c xs) r, r ~ Data.Diverse.TypeLevel.CaseResult (c r) GHC.Types.Any) => Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorAny c (x : xs)) r
+ Data.Diverse.Many.Internal: instance forall k (c :: * -> k -> [*] -> *) (n :: k) r. Data.Diverse.AFoldable.AFoldable (Data.Diverse.Many.Internal.CollectorAnyN c n '[]) r
+ Data.Diverse.Many.Internal: instance forall k (indices :: [GHC.Types.Nat]) (larger :: [*]) (r :: k) (n :: GHC.Types.Nat) x (xs :: [*]). Data.Diverse.Reiterate.ReiterateN (Data.Diverse.Many.Internal.CaseAmendN' indices larger r) n (x : xs)
+ Data.Diverse.Many.Internal: instance forall k (indices :: [GHC.Types.Nat]) (larger :: [*]) (r :: k) (n :: GHC.Types.Nat) z (zs :: [*]). Data.Diverse.Reiterate.ReiterateN (Data.Diverse.Many.Internal.CaseAmendN indices larger r) n (z : zs)
+ Data.Diverse.Many.Internal: instance forall k (indices :: [GHC.Types.Nat]) (smaller :: [*]) (r :: k) (n :: GHC.Types.Nat) x (xs :: [*]). Data.Diverse.Reiterate.ReiterateN (Data.Diverse.Many.Internal.CaseSelectN indices smaller r) n (x : xs)
+ Data.Diverse.Many.Internal: instance forall k (larger :: [*]) (r :: k) x (xs :: [*]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Many.Internal.CaseAmend' larger r) (x : xs)
+ Data.Diverse.Many.Internal: instance forall k (larger :: [*]) (r :: k) z (zs :: [*]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Many.Internal.CaseAmend larger r) (z : zs)
+ Data.Diverse.Many.Internal: instance forall k (smaller :: [*]) (larger :: [*]) (r :: k) x (xs :: [*]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Many.Internal.CaseSelect smaller larger r) (x : xs)
+ Data.Diverse.Which: class SwitchN w c r (n :: Nat) xs
+ Data.Diverse.Which: type DiversifyL (ls :: [k]) (branch :: [Type]) (tree :: [Type]) = (Diversify branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls)
+ Data.Diverse.Which: type ReinterpretL (ls :: [k]) (branch :: [Type]) (tree :: [Type]) = (Reinterpret branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls)
+ Data.Diverse.Which: type ReinterpretL' (ls :: [k]) (branch :: [Type]) (tree :: [Type]) = (Reinterpret' branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls)
+ Data.Diverse.Which: type Reinterpreted branch tree branchlessTree = (Reinterpret branch tree, branchlessTree ~ Complement tree branch)
+ Data.Diverse.Which: type ReinterpretedL ls branch tree branchlessTree = (ReinterpretL ls branch tree, branchlessTree ~ Complement tree branch)
+ Data.Diverse.Which.Internal: class SwitchN w c r (n :: Nat) xs
+ Data.Diverse.Which.Internal: instance (Data.Diverse.Case.Case (c r n) (x : x' : xs), Data.Diverse.Reduce.Reduce (Data.Diverse.Which.Internal.Which (x' : xs)) (Data.Diverse.Which.Internal.SwitcherN c r (n GHC.TypeNats.+ 1) (x' : xs)), Data.Diverse.Reiterate.ReiterateN (c r) n (x : x' : xs), r ~ Data.Diverse.TypeLevel.CaseResult (c r n) x) => Data.Diverse.Reduce.Reduce (Data.Diverse.Which.Internal.Which (x : x' : xs)) (Data.Diverse.Which.Internal.SwitcherN c r n (x : x' : xs))
+ Data.Diverse.Which.Internal: instance (Data.Diverse.Which.Internal.Switch Data.Diverse.Which.Internal.CaseEqWhich GHC.Types.Bool (x : xs), Data.Diverse.Which.Internal.Switch Data.Diverse.Which.Internal.CaseOrdWhich GHC.Types.Ordering (x : xs)) => GHC.Classes.Ord (Data.Diverse.Which.Internal.Which (x : xs))
+ Data.Diverse.Which.Internal: instance Data.Diverse.Reduce.Reduce (Data.Diverse.Which.Internal.Which xs) (Data.Diverse.Which.Internal.SwitcherN c r n xs) => Data.Diverse.Which.Internal.SwitchN Data.Diverse.Which.Internal.Which c r n xs
+ Data.Diverse.Which.Internal: instance Data.Diverse.TypeLevel.MemberAt (Data.Diverse.TypeLevel.KindAtIndex n ns) x tree => Data.Diverse.Case.Case (Data.Diverse.Which.Internal.CaseDiversifyN ns (Data.Diverse.Which.Internal.Which tree) n) (x : branch')
+ Data.Diverse.Which.Internal: instance Data.Diverse.Which.Internal.Switch Data.Diverse.Which.Internal.CaseEqWhich GHC.Types.Bool (x : xs) => GHC.Classes.Eq (Data.Diverse.Which.Internal.Which (x : xs))
+ Data.Diverse.Which.Internal: instance Data.Diverse.Which.Internal.Switch Data.Diverse.Which.Internal.CaseShowWhich GHC.Show.ShowS (x : xs) => GHC.Show.Show (Data.Diverse.Which.Internal.Which (x : xs))
+ Data.Diverse.Which.Internal: instance forall k (branch :: [*]) (tree :: [*]) (r :: k) (tree' :: [*]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseReinterpret branch tree r) tree'
+ Data.Diverse.Which.Internal: instance forall k (branch :: [*]) (tree :: [*]) (r :: k) (tree' :: [*]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseReinterpret' branch tree r) tree'
+ Data.Diverse.Which.Internal: instance forall k (c :: k -> [*] -> *) (r :: k). Data.Diverse.Reduce.Reduce (Data.Diverse.Which.Internal.Which '[]) (Data.Diverse.Which.Internal.Switcher c r '[])
+ Data.Diverse.Which.Internal: instance forall k (indices :: [GHC.Types.Nat]) (r :: k) (n :: GHC.Types.Nat) (tree' :: [*]). Data.Diverse.Reiterate.ReiterateN (Data.Diverse.Which.Internal.CaseReinterpretN' indices r) n tree'
+ Data.Diverse.Which.Internal: instance forall k (ns :: [GHC.Types.Nat]) (r :: k) (n :: GHC.Types.Nat) (branch' :: [*]). Data.Diverse.Reiterate.ReiterateN (Data.Diverse.Which.Internal.CaseDiversifyN ns r) n branch'
+ Data.Diverse.Which.Internal: instance forall k (r :: [*]) (branch :: [*]) (tree :: k) (branch' :: [*]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseDiversify r branch tree) branch'
+ Data.Diverse.Which.Internal: instance forall k (r :: k) x (xs :: [*]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseEqWhich r) (x : xs)
+ Data.Diverse.Which.Internal: instance forall k (r :: k) x (xs :: [*]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseOrdWhich r) (x : xs)
+ Data.Diverse.Which.Internal: instance forall k (r :: k) x (xs :: [*]). Data.Diverse.Reiterate.Reiterate (Data.Diverse.Which.Internal.CaseShowWhich r) (x : xs)
+ Data.Diverse.Which.Internal: type DiversifyL (ls :: [k]) (branch :: [Type]) (tree :: [Type]) = (Diversify branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls)
+ Data.Diverse.Which.Internal: type ReinterpretL (ls :: [k]) (branch :: [Type]) (tree :: [Type]) = (Reinterpret branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls)
+ Data.Diverse.Which.Internal: type ReinterpretL' (ls :: [k]) (branch :: [Type]) (tree :: [Type]) = (Reinterpret' branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls)
+ Data.Diverse.Which.Internal: type Reinterpreted branch tree branchlessTree = (Reinterpret branch tree, branchlessTree ~ Complement tree branch)
+ Data.Diverse.Which.Internal: type ReinterpretedL ls branch tree branchlessTree = (ReinterpretL ls branch tree, branchlessTree ~ Complement tree branch)
- Data.Diverse.Many: type Select (smaller :: [Type]) (larger :: [Type]) = AFoldable (CollectorAny (CaseSelect smaller larger) larger) (Maybe (Int, WrappedAny))
+ Data.Diverse.Many: type Select (smaller :: [Type]) (larger :: [Type]) = (AFoldable (CollectorAny (CaseSelect smaller larger) larger) (Maybe (Int, WrappedAny)))
- Data.Diverse.Many.Internal: type Select (smaller :: [Type]) (larger :: [Type]) = AFoldable (CollectorAny (CaseSelect smaller larger) larger) (Maybe (Int, WrappedAny))
+ Data.Diverse.Many.Internal: type Select (smaller :: [Type]) (larger :: [Type]) = (AFoldable (CollectorAny (CaseSelect smaller larger) larger) (Maybe (Int, WrappedAny)))
- Data.Diverse.Which: diversifyL :: forall ls branch tree. (Diversify branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls) => Which branch -> Which tree
+ Data.Diverse.Which: diversifyL :: forall ls branch tree. (DiversifyL ls branch tree) => Which branch -> Which tree
- Data.Diverse.Which: diversifyN :: forall indices branch tree. (DiversifyN indices branch tree) => Which branch -> Which tree
+ Data.Diverse.Which: diversifyN :: forall ns branch tree. (DiversifyN ns branch tree) => Which branch -> Which tree
- Data.Diverse.Which: reinterpret :: forall branch tree. Reinterpret branch tree => Which tree -> Either (Which (Complement tree branch)) (Which branch)
+ Data.Diverse.Which: reinterpret :: forall branch tree. (Reinterpret branch tree) => Which tree -> Either (Which (Complement tree branch)) (Which branch)
- Data.Diverse.Which: reinterpret' :: forall branch tree. Reinterpret' branch tree => Which tree -> Maybe (Which branch)
+ Data.Diverse.Which: reinterpret' :: forall branch tree. (Reinterpret' branch tree) => Which tree -> Maybe (Which branch)
- Data.Diverse.Which: reinterpretL :: forall ls branch tree. (Reinterpret branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls) => Which tree -> Either (Which (Complement tree branch)) (Which branch)
+ Data.Diverse.Which: reinterpretL :: forall ls branch tree. (ReinterpretL ls branch tree) => Which tree -> Either (Which (Complement tree branch)) (Which branch)
- Data.Diverse.Which: reinterpretL' :: forall ls branch tree. (Reinterpret' branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls) => Which tree -> Maybe (Which branch)
+ Data.Diverse.Which: reinterpretL' :: forall ls branch tree. (ReinterpretL' ls branch tree) => Which tree -> Maybe (Which branch)
- Data.Diverse.Which: reinterpretN' :: forall (indices :: [Nat]) branch tree. (ReinterpretN' indices branch tree) => Which tree -> Maybe (Which branch)
+ Data.Diverse.Which: reinterpretN' :: forall ns branch tree. (ReinterpretN' ns branch tree) => Which tree -> Maybe (Which branch)
- Data.Diverse.Which: switchN :: SwitchN c r n xs => Which xs -> c r n xs -> r
+ Data.Diverse.Which: switchN :: SwitchN w c r n xs => w xs -> c r n xs -> r
- Data.Diverse.Which: type Diversify (branch :: [Type]) (tree :: [Type]) = Reduce (Which branch) (Switcher (CaseDiversify branch tree) (Which tree) branch)
+ Data.Diverse.Which: type Diversify (branch :: [Type]) (tree :: [Type]) = Switch (CaseDiversify branch tree) (Which tree) branch
- Data.Diverse.Which: type DiversifyN (indices :: [Nat]) (branch :: [Type]) (tree :: [Type]) = (Reduce (Which branch) (SwitcherN (CaseDiversifyN indices) (Which tree) 0 branch), KindsAtIndices indices tree ~ branch)
+ Data.Diverse.Which: type DiversifyN (ns :: [Nat]) (branch :: [Type]) (tree :: [Type]) = (SwitchN Which (CaseDiversifyN ns) (Which tree) 0 branch, KindsAtIndices ns tree ~ branch)
- Data.Diverse.Which: type Reinterpret branch tree = Reduce (Which tree) (Switcher (CaseReinterpret branch tree) (Either (Which (Complement tree branch)) (Which branch)) tree)
+ Data.Diverse.Which: type Reinterpret (branch :: [Type]) (tree :: [Type]) = Switch (CaseReinterpret branch tree) (Either (Which (Complement tree branch)) (Which branch)) tree
- Data.Diverse.Which: type Reinterpret' branch tree = Reduce (Which tree) (Switcher (CaseReinterpret' branch tree) (Maybe (Which branch)) tree)
+ Data.Diverse.Which: type Reinterpret' (branch :: [Type]) (tree :: [Type]) = Switch (CaseReinterpret' branch tree) (Maybe (Which branch)) tree
- Data.Diverse.Which: type ReinterpretN' (indices :: [Nat]) (branch :: [Type]) (tree :: [Type]) = (Reduce (Which tree) (SwitcherN (CaseReinterpretN' indices) (Maybe (Which branch)) 0 tree), KindsAtIndices indices tree ~ branch)
+ Data.Diverse.Which: type ReinterpretN' (ns :: [Nat]) (branch :: [Type]) (tree :: [Type]) = (SwitchN Which (CaseReinterpretN' ns) (Maybe (Which branch)) 0 tree, KindsAtIndices ns tree ~ branch)
- Data.Diverse.Which: whichN :: SwitchN c r n xs => c r n xs -> Which xs -> r
+ Data.Diverse.Which: whichN :: SwitchN w c r n xs => c r n xs -> w xs -> r
- Data.Diverse.Which.Internal: diversifyL :: forall ls branch tree. (Diversify branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls) => Which branch -> Which tree
+ Data.Diverse.Which.Internal: diversifyL :: forall ls branch tree. (DiversifyL ls branch tree) => Which branch -> Which tree
- Data.Diverse.Which.Internal: diversifyN :: forall indices branch tree. (DiversifyN indices branch tree) => Which branch -> Which tree
+ Data.Diverse.Which.Internal: diversifyN :: forall ns branch tree. (DiversifyN ns branch tree) => Which branch -> Which tree
- Data.Diverse.Which.Internal: reinterpret :: forall branch tree. Reinterpret branch tree => Which tree -> Either (Which (Complement tree branch)) (Which branch)
+ Data.Diverse.Which.Internal: reinterpret :: forall branch tree. (Reinterpret branch tree) => Which tree -> Either (Which (Complement tree branch)) (Which branch)
- Data.Diverse.Which.Internal: reinterpret' :: forall branch tree. Reinterpret' branch tree => Which tree -> Maybe (Which branch)
+ Data.Diverse.Which.Internal: reinterpret' :: forall branch tree. (Reinterpret' branch tree) => Which tree -> Maybe (Which branch)
- Data.Diverse.Which.Internal: reinterpretL :: forall ls branch tree. (Reinterpret branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls) => Which tree -> Either (Which (Complement tree branch)) (Which branch)
+ Data.Diverse.Which.Internal: reinterpretL :: forall ls branch tree. (ReinterpretL ls branch tree) => Which tree -> Either (Which (Complement tree branch)) (Which branch)
- Data.Diverse.Which.Internal: reinterpretL' :: forall ls branch tree. (Reinterpret' branch tree, branch ~ KindsAtLabels ls tree, UniqueLabels ls tree, IsDistinct ls) => Which tree -> Maybe (Which branch)
+ Data.Diverse.Which.Internal: reinterpretL' :: forall ls branch tree. (ReinterpretL' ls branch tree) => Which tree -> Maybe (Which branch)
- Data.Diverse.Which.Internal: reinterpretN' :: forall (indices :: [Nat]) branch tree. (ReinterpretN' indices branch tree) => Which tree -> Maybe (Which branch)
+ Data.Diverse.Which.Internal: reinterpretN' :: forall ns branch tree. (ReinterpretN' ns branch tree) => Which tree -> Maybe (Which branch)
- Data.Diverse.Which.Internal: switchN :: SwitchN c r n xs => Which xs -> c r n xs -> r
+ Data.Diverse.Which.Internal: switchN :: SwitchN w c r n xs => w xs -> c r n xs -> r
- Data.Diverse.Which.Internal: type Diversify (branch :: [Type]) (tree :: [Type]) = Reduce (Which branch) (Switcher (CaseDiversify branch tree) (Which tree) branch)
+ Data.Diverse.Which.Internal: type Diversify (branch :: [Type]) (tree :: [Type]) = Switch (CaseDiversify branch tree) (Which tree) branch
- Data.Diverse.Which.Internal: type DiversifyN (indices :: [Nat]) (branch :: [Type]) (tree :: [Type]) = (Reduce (Which branch) (SwitcherN (CaseDiversifyN indices) (Which tree) 0 branch), KindsAtIndices indices tree ~ branch)
+ Data.Diverse.Which.Internal: type DiversifyN (ns :: [Nat]) (branch :: [Type]) (tree :: [Type]) = (SwitchN Which (CaseDiversifyN ns) (Which tree) 0 branch, KindsAtIndices ns tree ~ branch)
- Data.Diverse.Which.Internal: type Reinterpret branch tree = Reduce (Which tree) (Switcher (CaseReinterpret branch tree) (Either (Which (Complement tree branch)) (Which branch)) tree)
+ Data.Diverse.Which.Internal: type Reinterpret (branch :: [Type]) (tree :: [Type]) = Switch (CaseReinterpret branch tree) (Either (Which (Complement tree branch)) (Which branch)) tree
- Data.Diverse.Which.Internal: type Reinterpret' branch tree = Reduce (Which tree) (Switcher (CaseReinterpret' branch tree) (Maybe (Which branch)) tree)
+ Data.Diverse.Which.Internal: type Reinterpret' (branch :: [Type]) (tree :: [Type]) = Switch (CaseReinterpret' branch tree) (Maybe (Which branch)) tree
- Data.Diverse.Which.Internal: type ReinterpretN' (indices :: [Nat]) (branch :: [Type]) (tree :: [Type]) = (Reduce (Which tree) (SwitcherN (CaseReinterpretN' indices) (Maybe (Which branch)) 0 tree), KindsAtIndices indices tree ~ branch)
+ Data.Diverse.Which.Internal: type ReinterpretN' (ns :: [Nat]) (branch :: [Type]) (tree :: [Type]) = (SwitchN Which (CaseReinterpretN' ns) (Maybe (Which branch)) 0 tree, KindsAtIndices ns tree ~ branch)
- Data.Diverse.Which.Internal: whichN :: SwitchN c r n xs => c r n xs -> Which xs -> r
+ Data.Diverse.Which.Internal: whichN :: SwitchN w c r n xs => c r n xs -> w xs -> r

Files

README.md view
@@ -14,6 +14,9 @@  # Changelog +* 2.0.1.0+  - Simplified type synonyms for Which. Added Reinterpreted constraint synonym.+ * 2.0.0.0   - Breaking change: the prime (xxx') version of functions are now consistently the simpler or non-polymorphic version.     - This is more consistent with 'Control.Lens' as well.
data-diverse.cabal view
@@ -1,5 +1,5 @@ name:                data-diverse-version:             2.0.0.0+version:             2.0.1.0 synopsis:            Extensible records and polymorphic variants. description:         "Data.Diverse.Many" is an extensible record for any size encoded efficiently as (Seq Any).                      "Data.Diverse.Which" is a polymorphic variant of possibilities encoded as (Int, Any).
src/Data/Diverse/Which.hs view
@@ -31,28 +31,33 @@     , diversify     , diversify'     , diversify0+    , DiversifyL     , diversifyL     , DiversifyN     , diversifyN       -- ** Inverse Injection     , Reinterpret+    , Reinterpreted     , reinterpret     , Reinterpret'     , reinterpret'+    , ReinterpretL+    , ReinterpretedL     , reinterpretL+    , ReinterpretL'     , reinterpretL'     , ReinterpretN'     , reinterpretN'        -- * Catamorphism     , Switch-    , Switcher(..)-    , which     , switch+    , which+    , Switcher(..)     , SwitchN-    , SwitcherN(..)-    , whichN     , switchN+    , whichN+    , SwitcherN(..)     ) where  import Data.Diverse.Which.Internal
src/Data/Diverse/Which/Internal.hs view
@@ -6,6 +6,7 @@ {-# LANGUAGE EmptyCase #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -50,28 +51,33 @@     , diversify     , diversify'     , diversify0+    , DiversifyL     , diversifyL     , DiversifyN     , diversifyN       -- ** Inverse Injection     , Reinterpret+    , Reinterpreted     , reinterpret     , Reinterpret'     , reinterpret'+    , ReinterpretL+    , ReinterpretedL     , reinterpretL+    , ReinterpretL'     , reinterpretL'     , ReinterpretN'     , reinterpretN'        -- * Catamorphism     , Switch-    , Switcher(..)-    , which     , switch+    , which+    , Switcher(..)     , SwitchN-    , SwitcherN(..)-    , whichN     , switchN+    , whichN+    , SwitcherN(..)     ) where  import Control.Applicative@@ -357,7 +363,7 @@ -----------------------------------------------------------------  -- | A friendlier constraint synonym for 'diversify'.-type Diversify (branch :: [Type]) (tree :: [Type]) = Reduce (Which branch) (Switcher (CaseDiversify branch tree) (Which tree) branch)+type Diversify (branch :: [Type]) (tree :: [Type]) = Switch (CaseDiversify branch tree) (Which tree) branch  -- | Convert a 'Which' to another 'Which' that may include other possibilities. -- That is, @branch@ is equal or is a subset of @tree@.@@ -398,6 +404,14 @@  ------------------------------------------------------------------ +-- | A friendlier constraint synonym for 'diversifyL'.+type DiversifyL (ls :: [k]) (branch :: [Type]) (tree :: [Type]) =+    ( Diversify branch tree+    , branch ~ KindsAtLabels ls tree+    , UniqueLabels ls tree+    , IsDistinct ls+    )+ -- | A variation of 'diversify' where @branch@is additionally specified by a labels list. -- -- @@@ -406,22 +420,16 @@ --     y'' = 'diversifyL' \@'[Bar, Foo] y' :: 'Which' '[Tagged Foo Bool, Tagged Bar Int] -- 'switch' y'' ('Data.Diverse.CaseFunc.CaseFunc' \@'Data.Typeable.Typeable' (show . typeRep . (pure \@Proxy))) \`shouldBe` \"Tagged * Bar Int" -- @-diversifyL-    :: forall ls branch tree.-       ( Diversify branch tree-       , branch ~ KindsAtLabels ls tree-       , UniqueLabels ls tree-       , IsDistinct ls-       )-    => Which branch -> Which tree+diversifyL :: forall ls branch tree. (DiversifyL ls branch tree) => Which branch -> Which tree diversifyL = which (CaseDiversify @branch @tree @_ @branch)  ------------------------------------------------------------------  -- | A friendlier constraint synonym for 'diversifyN'.-type DiversifyN (indices :: [Nat]) (branch :: [Type]) (tree :: [Type]) =-    ( Reduce (Which branch) (SwitcherN (CaseDiversifyN indices) (Which tree) 0 branch)-    , KindsAtIndices indices tree ~ branch)+type DiversifyN (ns :: [Nat]) (branch :: [Type]) (tree :: [Type]) =+    ( SwitchN Which (CaseDiversifyN ns) (Which tree) 0 branch+    , KindsAtIndices ns tree ~ branch+    )  -- | A variation of 'diversify' which uses a Nat list @indices@ to specify how to reorder the fields, where --@@ -438,25 +446,28 @@ --     y'' = 'diversifyN' \@[1,0] \@_ \@[Bool, Int] y' -- 'switch' y'' ('Data.Diverse.CaseFunc.CaseFunc' \@'Data.Typeable.Typeable' (show . typeRep . (pure \@Proxy))) \`shouldBe` \"Int" -- @-diversifyN :: forall indices branch tree. (DiversifyN indices branch tree) => Which branch -> Which tree-diversifyN = whichN (CaseDiversifyN @indices @_ @0 @branch)+diversifyN :: forall ns branch tree. (DiversifyN ns branch tree) => Which branch -> Which tree+diversifyN = whichN (CaseDiversifyN @ns @_ @0 @branch) -data CaseDiversifyN (indices :: [Nat]) r (n :: Nat) (branch' :: [Type]) = CaseDiversifyN+data CaseDiversifyN (ns :: [Nat]) r (n :: Nat) (branch' :: [Type]) = CaseDiversifyN -type instance CaseResult (CaseDiversifyN indices r n) x = r+type instance CaseResult (CaseDiversifyN ns r n) x = r -instance ReiterateN (CaseDiversifyN indices r) n branch' where+instance ReiterateN (CaseDiversifyN ns r) n branch' where     reiterateN CaseDiversifyN = CaseDiversifyN -instance MemberAt (KindAtIndex n indices) x tree =>-         Case (CaseDiversifyN indices (Which tree) n) (x ': branch') where-    case' CaseDiversifyN v = pickN @(KindAtIndex n indices) v+instance MemberAt (KindAtIndex n ns) x tree =>+         Case (CaseDiversifyN ns (Which tree) n) (x ': branch') where+    case' CaseDiversifyN v = pickN @(KindAtIndex n ns) v  ------------------------------------------------------------------  -- | A friendlier constraint synonym for 'reinterpret'.-type Reinterpret branch tree = Reduce (Which tree) (Switcher (CaseReinterpret branch tree) (Either (Which (Complement tree branch)) (Which branch)) tree)+type Reinterpret (branch :: [Type]) (tree :: [Type]) = Switch (CaseReinterpret branch tree) (Either (Which (Complement tree branch)) (Which branch)) tree +-- | A variation of 'Reinterpret' that exposes @branchlessTree ~ Complement tree branch@+type Reinterpreted branch tree branchlessTree = (Reinterpret branch tree, branchlessTree ~ Complement tree branch)+ -- | Convert a 'Which' into possibly another 'Which' with a totally different typelist. -- Returns either a 'Which' with the 'Right' value, or a 'Which' with the 'Left'over @compliment@ types. --@@ -471,7 +482,8 @@ --     let c = 'reinterpret' @[String, Int] a --     c \`shouldBe` Right ('pick' (5 :: Int)) :: 'Which' '[String, Int] -- @-reinterpret :: forall branch tree. Reinterpret branch tree => Which tree -> Either (Which (Complement tree branch)) (Which branch)+reinterpret :: forall branch tree. (Reinterpret branch tree) =>+    Which tree -> Either (Which (Complement tree branch)) (Which branch) reinterpret = which (CaseReinterpret @branch @tree @_ @tree)  data CaseReinterpret (branch :: [Type]) (tree :: [Type]) r (tree' :: [Type]) = CaseReinterpret@@ -497,10 +509,10 @@ ------------------------------------------------------------------  -- | A friendlier constraint synonym for 'reinterpret''.-type Reinterpret' branch tree = Reduce (Which tree) (Switcher (CaseReinterpret' branch tree) (Maybe (Which branch)) tree)+type Reinterpret' (branch :: [Type]) (tree :: [Type]) = Switch (CaseReinterpret' branch tree) (Maybe (Which branch)) tree  -- | Variation of 'reinterpret' which returns a Maybe.-reinterpret' :: forall branch tree. Reinterpret' branch tree => Which tree -> Maybe (Which branch)+reinterpret' :: forall branch tree. (Reinterpret' branch tree) => Which tree -> Maybe (Which branch) reinterpret' = which (CaseReinterpret' @branch @tree @_ @tree)  data CaseReinterpret' (branch :: [Type]) (tree :: [Type]) r (tree' :: [Type]) = CaseReinterpret'@@ -522,6 +534,17 @@  ------------------------------------------------------------------ +-- | A friendlier constraint synonym for 'reinterpretL'.+type ReinterpretL (ls :: [k]) (branch :: [Type]) (tree :: [Type]) =+    ( Reinterpret branch tree+    , branch ~ KindsAtLabels ls tree+    , UniqueLabels ls tree+    , IsDistinct ls+    )++-- | A variation of 'ReinterpretL' that exposes @branchlessTree ~ Complement tree branch@+type ReinterpretedL ls branch tree branchlessTree = (ReinterpretL ls branch tree, branchlessTree ~ Complement tree branch)+ -- | A variation of 'reinterpret' where the @branch@ is additionally specified with a labels list. -- -- @@@ -530,37 +553,31 @@ --     x = 'pick' \@[Tagged Foo Bool, Tagged Bar Int] (5 :: Tagged Bar Int) -- y' \`shouldBe` Right x -- @-reinterpretL-    :: forall ls branch tree.-       ( Reinterpret branch tree-       , branch ~ KindsAtLabels ls tree-       , UniqueLabels ls tree-       , IsDistinct ls-       )-    => Which tree-    -> Either (Which (Complement tree branch)) (Which branch)+reinterpretL :: forall ls branch tree. (ReinterpretL ls branch tree)+  => Which tree -> Either (Which (Complement tree branch)) (Which branch) reinterpretL = which (CaseReinterpret @branch @tree @_ @tree) +-- | A friendlier constraint synonym for 'reinterpretL'.+type ReinterpretL' (ls :: [k]) (branch :: [Type]) (tree :: [Type]) =+    ( Reinterpret' branch tree+    , branch ~ KindsAtLabels ls tree+    , UniqueLabels ls tree+    , IsDistinct ls+    )+ -- | Variation of 'reinterpretL' which returns a Maybe.-reinterpretL'-    :: forall ls branch tree.-       ( Reinterpret' branch tree-       , branch ~ KindsAtLabels ls tree-       , UniqueLabels ls tree-       , IsDistinct ls-       )-    => Which tree-    -> Maybe (Which branch)+reinterpretL' :: forall ls branch tree. (ReinterpretL' ls branch tree)+  => Which tree -> Maybe (Which branch) reinterpretL' = which (CaseReinterpret' @branch @tree @_ @tree)  ------------------------------------------------------------------  -- | A friendlier constraint synonym for 'reinterpretN'.-type ReinterpretN' (indices :: [Nat]) (branch :: [Type]) (tree :: [Type]) =-    ( Reduce (Which tree) (SwitcherN (CaseReinterpretN' indices) (Maybe (Which branch)) 0 tree)-    , KindsAtIndices indices tree ~ branch)+type ReinterpretN' (ns :: [Nat]) (branch :: [Type]) (tree :: [Type]) =+    ( SwitchN Which (CaseReinterpretN' ns) (Maybe (Which branch)) 0 tree+    , KindsAtIndices ns tree ~ branch) --- | A limited variation of 'reinterpret' which uses a Nat list @n@ to specify how to reorder the fields, where+-- | A limited variation of 'reinterpret'' which uses a Nat list @n@ to specify how to reorder the fields, where -- -- @ -- indices[branch_idx] = tree_idx@@ -574,8 +591,9 @@ -- Also it returns a Maybe instead of Either. -- -- This is so that the same @indices@ can be used in 'narrowN'.-reinterpretN' :: forall (indices :: [Nat]) branch tree. (ReinterpretN' indices branch tree) => Which tree -> Maybe (Which branch)-reinterpretN' = whichN (CaseReinterpretN' @indices @_ @0 @tree)+reinterpretN' :: forall ns branch tree. (ReinterpretN' ns branch tree)+  => Which tree -> Maybe (Which branch)+reinterpretN' = whichN (CaseReinterpretN' @ns @_ @0 @tree)  data CaseReinterpretN' (indices :: [Nat]) r (n :: Nat) (tree' :: [Type]) = CaseReinterpretN' @@ -617,7 +635,6 @@  -- | Terminating case of the loop, ensuring that a instance of @Case '[]@ -- with an empty typelist is not required.--- You can't reduce 'zilch' instance (Case (c r) '[x], r ~ CaseResult (c r) x) => Reduce (Which '[x]) (Switcher c r '[x]) where     reduce (Switcher c) v = case obvious v of             a -> case' c a@@ -630,13 +647,9 @@  ------------------------------------------------------------------ --- | A friendlier constraint synonym for 'switch'.+-- | A friendlier constraint synonym for 'reinterpretN'. type Switch c r xs = Reduce (Which xs) (Switcher c r xs) --- | Catamorphism for 'Which'. This is equivalent to @flip 'switch'@.-which :: Switch c r xs => c r xs -> Which xs -> r-which = reduce . Switcher- -- | A switch/case statement for 'Which'. This is equivalent to @flip 'which'@ -- -- Use 'Case' instances like 'Data.Diverse.Cases.Cases' to apply a 'Which' of functions to a variant of values.@@ -658,8 +671,12 @@ -- -- Or you may use your own custom instance of 'Case'. switch :: Switch c r xs => Which xs -> c r xs -> r-switch = flip which+switch w c = reduce (Switcher c) w +-- | Catamorphism for 'Which'. This is @flip 'switch'@.+which :: Switch c r xs => c r xs -> Which xs -> r+which = flip switch+ ------------------------------------------------------------------  -- | 'SwitcherN' is a variation of 'Switcher' which __'reiterateN'__s through the possibilities in a 'Which',@@ -691,12 +708,9 @@     reduce (SwitcherN c) v = case obvious v of             a -> case' c a --- | A friendlier constraint synonym for 'switch'.-type SwitchN c r n xs = Reduce (Which xs) (SwitcherN c r n xs)- -- | Catamorphism for 'Which'. This is equivalent to @flip 'switchN'@.-whichN :: SwitchN c r n xs => c r n xs -> Which xs -> r-whichN = reduce . SwitcherN+whichN :: SwitchN w c r n xs => c r n xs -> w xs -> r+whichN = flip switchN  -- | A switch/case statement for 'Which'. This is equivalent to @flip 'whichN'@ --@@ -714,13 +728,16 @@ -- @ -- -- Or you may use your own custom instance of 'Case'.-switchN :: SwitchN c r n xs => Which xs -> c r n xs -> r-switchN = flip whichN+class SwitchN w c r (n :: Nat) xs where+    switchN :: w xs -> c r n xs -> r +instance Reduce (Which xs) (SwitcherN c r n xs) => SwitchN Which c r n xs where+    switchN w c = reduce (SwitcherN c) w+ -----------------------------------------------------------------  -- | Two 'Which'es are only equal iff they both contain the equivalnet value at the same type index.-instance (Reduce (Which (x ': xs)) (Switcher CaseEqWhich Bool (x ': xs))) =>+instance (Switch CaseEqWhich Bool (x ': xs)) =>          Eq (Which (x ': xs)) where     l@(Which i _) == (Which j u) =         if i /= j@@ -746,8 +763,8 @@ -----------------------------------------------------------------  -- | A 'Which' with a type at smaller type index is considered smaller.-instance ( Reduce (Which (x ': xs)) (Switcher CaseEqWhich Bool (x ': xs))-         , Reduce (Which (x ': xs)) (Switcher CaseOrdWhich Ordering (x ': xs))+instance ( Switch CaseEqWhich Bool (x ': xs)+         , Switch CaseOrdWhich Ordering (x ': xs)          ) =>          Ord (Which (x ': xs)) where     compare l@(Which i _) (Which j u) =@@ -774,7 +791,7 @@ ------------------------------------------------------------------  -- | @show ('pick'' \'A') == "pick \'A'"@-instance (Reduce (Which (x ': xs)) (Switcher CaseShowWhich ShowS (x ': xs))) =>+instance (Switch CaseShowWhich ShowS (x ': xs)) =>          Show (Which (x ': xs)) where     showsPrec d v = showParen (d > app_prec) (which (CaseShowWhich 0) v)       where