htree 0.1.1.0 → 0.2.0.0
raw patch · 11 files changed
+64/−60 lines, 11 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.HTree.Constraint: instance forall k1 (f :: k1 -> GHC.Types.Type) (k2 :: k1) (c :: k1 -> GHC.Types.Constraint). GHC.Show.Show (f k2) => GHC.Show.Show (Data.HTree.Constraint.Has @k1 c f k2)
- Data.HTree.Existential: instance forall (f :: GHC.Types.Type -> GHC.Types.Type). (forall x. GHC.Classes.Eq x => GHC.Classes.Eq (f x), Data.Typeable.Internal.Typeable @(GHC.Types.Type -> GHC.Types.Type) f) => GHC.Classes.Eq (Data.HTree.Existential.EList @GHC.Types.Type (Data.HTree.Constraint.Has @GHC.Types.Type (Data.HTree.Families.Both @GHC.Types.Type (Data.Typeable.Internal.Typeable @GHC.Types.Type) GHC.Classes.Eq) f))
- Data.HTree.Existential: instance forall (f :: GHC.Types.Type -> GHC.Types.Type). (forall x. GHC.Classes.Eq x => GHC.Classes.Eq (f x), Data.Typeable.Internal.Typeable @(GHC.Types.Type -> GHC.Types.Type) f) => GHC.Classes.Eq (Data.HTree.Existential.ETree @GHC.Types.Type (Data.HTree.Constraint.Has @GHC.Types.Type (Data.HTree.Families.Both @GHC.Types.Type (Data.Typeable.Internal.Typeable @GHC.Types.Type) GHC.Classes.Eq) f))
- Data.HTree.Existential: instance forall (f :: GHC.Types.Type -> GHC.Types.Type). (forall x. GHC.Classes.Eq x => GHC.Classes.Eq (f x), Data.Typeable.Internal.Typeable @(GHC.Types.Type -> GHC.Types.Type) f) => GHC.Classes.Eq (Data.HTree.Existential.Some @GHC.Types.Type (Data.HTree.Constraint.Has @GHC.Types.Type (Data.Typeable.Internal.Typeable @GHC.Types.Type) (Data.HTree.Constraint.Has @GHC.Types.Type GHC.Classes.Eq f)))
- Data.HTree.Existential: instance forall (f :: GHC.Types.Type -> GHC.Types.Type). (forall x. GHC.Classes.Ord x => GHC.Classes.Ord (f x), Data.Typeable.Internal.Typeable @(GHC.Types.Type -> GHC.Types.Type) f, GHC.Classes.Eq (Data.HTree.Existential.Some @GHC.Types.Type (Data.HTree.Constraint.Has @GHC.Types.Type (Data.Typeable.Internal.Typeable @GHC.Types.Type) (Data.HTree.Constraint.Has @GHC.Types.Type GHC.Classes.Ord f)))) => GHC.Classes.Ord (Data.HTree.Existential.Some @GHC.Types.Type (Data.HTree.Constraint.Has @GHC.Types.Type (Data.Typeable.Internal.Typeable @GHC.Types.Type) (Data.HTree.Constraint.Has @GHC.Types.Type GHC.Classes.Ord f)))
- Data.HTree.Existential: instance forall k l (g :: k -> l -> GHC.Types.Type) (f :: k). (forall (k1 :: l). GHC.Show.Show (g f k1)) => GHC.Show.Show (Data.HTree.Existential.Some2 @k @l g f)
- Data.HTree.Existential: instance forall l (f :: l -> GHC.Types.Type). Data.Typeable.Internal.Typeable @(l -> GHC.Types.Type) f => GHC.Show.Show (Data.HTree.Existential.Some @l (Data.HTree.Constraint.Has @l (Data.Typeable.Internal.Typeable @l) f))
- Data.HTree.Existential: instance forall l (g :: l -> GHC.Types.Type). (forall (k :: l). GHC.Show.Show (g k)) => GHC.Show.Show (Data.HTree.Existential.Some @l g)
- Data.HTree.Labeled: Proxy :: Proxy (t :: k)
- Data.HTree.Labeled: data () => Proxy (t :: k)
- Data.HTree.Labeled: instance forall k (l :: k) typ (t :: Data.HTree.Tree.TyTree @GHC.Types.Type GHC.Types.Type) (f :: GHC.Types.Type -> GHC.Types.Type). (Data.HTree.Labeled.HasField' 'Data.HTree.Labeled.BFS (Data.HTree.Labeled.Labeled @k l typ) t, GHC.Base.Functor f) => GHC.Records.HasField @{k} l (Data.HTree.Tree.HTree @GHC.Types.Type f t) (f typ)
- Data.HTree.Labeled: instance forall l1 (l2 :: l1) a. GHC.Generics.Generic (Data.HTree.Labeled.Labeled @l1 l2 a)
- Data.HTree.Labeled: instance forall l1 (l2 :: l1) a. GHC.Show.Show a => GHC.Show.Show (Data.HTree.Labeled.Labeled @l1 l2 a)
- Data.HTree.Labeled: instance forall l1 (l2 :: l1). Data.Foldable.Foldable (Data.HTree.Labeled.Labeled @l1 l2)
- Data.HTree.Labeled: instance forall l1 (l2 :: l1). Data.Traversable.Traversable (Data.HTree.Labeled.Labeled @l1 l2)
- Data.HTree.Labeled: instance forall l1 (l2 :: l1). GHC.Base.Functor (Data.HTree.Labeled.Labeled @l1 l2)
- Data.HTree.List: instance forall a (f :: a -> GHC.Types.Type) (x :: a) (xs :: [a]). (GHC.Show.Show (f x), GHC.Show.Show (Data.HTree.List.HList @a f xs)) => GHC.Show.Show (Data.HTree.List.HList @a f ((':) @a x xs))
- Data.HTree.List: instance forall k (f :: k -> GHC.Types.Type). GHC.Show.Show (Data.HTree.List.HList @k f ('[] @k))
- Data.HTree.Tree: instance forall a1 (f :: a1 -> GHC.Types.Type) (a2 :: a1) (t :: Data.HTree.Tree.TyForest @GHC.Types.Type a1). (GHC.Show.Show (f a2), GHC.Show.Show (Data.HTree.Tree.HForest @a1 f t)) => GHC.Show.Show (Data.HTree.Tree.HTree @a1 f ('Data.HTree.Tree.TyNode @a1 a2 t))
- Data.HTree.Tree: instance forall k (typ :: k) (t :: Data.HTree.Tree.TyTree @GHC.Types.Type k). GHC.Show.Show (Data.HTree.Tree.Path @k typ t)
+ Data.HTree.Constraint: instance forall k1 (f :: k1 -> GHC.Types.Type) (k2 :: k1) (c :: k1 -> GHC.Types.Constraint). GHC.Internal.Show.Show (f k2) => GHC.Internal.Show.Show (Data.HTree.Constraint.Has @k1 c f k2)
+ Data.HTree.Existential: instance forall (f :: GHC.Types.Type -> GHC.Types.Type). (forall x. GHC.Classes.Eq x => GHC.Classes.Eq (f x), GHC.Internal.Data.Typeable.Internal.Typeable @(GHC.Types.Type -> GHC.Types.Type) f) => GHC.Classes.Eq (Data.HTree.Existential.EList @GHC.Types.Type (Data.HTree.Constraint.Has @GHC.Types.Type (Data.HTree.Families.Both @GHC.Types.Type (GHC.Internal.Data.Typeable.Internal.Typeable @GHC.Types.Type) GHC.Classes.Eq) f))
+ Data.HTree.Existential: instance forall (f :: GHC.Types.Type -> GHC.Types.Type). (forall x. GHC.Classes.Eq x => GHC.Classes.Eq (f x), GHC.Internal.Data.Typeable.Internal.Typeable @(GHC.Types.Type -> GHC.Types.Type) f) => GHC.Classes.Eq (Data.HTree.Existential.ETree @GHC.Types.Type (Data.HTree.Constraint.Has @GHC.Types.Type (Data.HTree.Families.Both @GHC.Types.Type (GHC.Internal.Data.Typeable.Internal.Typeable @GHC.Types.Type) GHC.Classes.Eq) f))
+ Data.HTree.Existential: instance forall (f :: GHC.Types.Type -> GHC.Types.Type). (forall x. GHC.Classes.Eq x => GHC.Classes.Eq (f x), GHC.Internal.Data.Typeable.Internal.Typeable @(GHC.Types.Type -> GHC.Types.Type) f) => GHC.Classes.Eq (Data.HTree.Existential.Some @GHC.Types.Type (Data.HTree.Constraint.Has @GHC.Types.Type (GHC.Internal.Data.Typeable.Internal.Typeable @GHC.Types.Type) (Data.HTree.Constraint.Has @GHC.Types.Type GHC.Classes.Eq f)))
+ Data.HTree.Existential: instance forall (f :: GHC.Types.Type -> GHC.Types.Type). (forall x. GHC.Classes.Ord x => GHC.Classes.Ord (f x), GHC.Internal.Data.Typeable.Internal.Typeable @(GHC.Types.Type -> GHC.Types.Type) f, GHC.Classes.Eq (Data.HTree.Existential.Some @GHC.Types.Type (Data.HTree.Constraint.Has @GHC.Types.Type (GHC.Internal.Data.Typeable.Internal.Typeable @GHC.Types.Type) (Data.HTree.Constraint.Has @GHC.Types.Type GHC.Classes.Ord f)))) => GHC.Classes.Ord (Data.HTree.Existential.Some @GHC.Types.Type (Data.HTree.Constraint.Has @GHC.Types.Type (GHC.Internal.Data.Typeable.Internal.Typeable @GHC.Types.Type) (Data.HTree.Constraint.Has @GHC.Types.Type GHC.Classes.Ord f)))
+ Data.HTree.Existential: instance forall k l (g :: k -> l -> GHC.Types.Type) (f :: k). (forall (k1 :: l). GHC.Internal.Show.Show (g f k1)) => GHC.Internal.Show.Show (Data.HTree.Existential.Some2 @k @l g f)
+ Data.HTree.Existential: instance forall l (f :: l -> GHC.Types.Type). GHC.Internal.Data.Typeable.Internal.Typeable @(l -> GHC.Types.Type) f => GHC.Internal.Show.Show (Data.HTree.Existential.Some @l (Data.HTree.Constraint.Has @l (GHC.Internal.Data.Typeable.Internal.Typeable @l) f))
+ Data.HTree.Existential: instance forall l (g :: l -> GHC.Types.Type). (forall (k :: l). GHC.Internal.Show.Show (g k)) => GHC.Internal.Show.Show (Data.HTree.Existential.Some @l g)
+ Data.HTree.Labeled: instance forall k (l :: k) typ (t :: Data.HTree.Tree.TyTree @GHC.Types.Type GHC.Types.Type) (f :: GHC.Types.Type -> GHC.Types.Type). (Data.HTree.Labeled.HasField' 'Data.HTree.Labeled.BFS (Data.HTree.Labeled.Labeled @k l typ) t, GHC.Internal.Base.Functor f) => GHC.Internal.Records.HasField @{k} l (Data.HTree.Tree.HTree @GHC.Types.Type f t) (f typ)
+ Data.HTree.Labeled: instance forall l1 (l2 :: l1) a. GHC.Internal.Generics.Generic (Data.HTree.Labeled.Labeled @l1 l2 a)
+ Data.HTree.Labeled: instance forall l1 (l2 :: l1) a. GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Data.HTree.Labeled.Labeled @l1 l2 a)
+ Data.HTree.Labeled: instance forall l1 (l2 :: l1). GHC.Internal.Base.Functor (Data.HTree.Labeled.Labeled @l1 l2)
+ Data.HTree.Labeled: instance forall l1 (l2 :: l1). GHC.Internal.Data.Foldable.Foldable (Data.HTree.Labeled.Labeled @l1 l2)
+ Data.HTree.Labeled: instance forall l1 (l2 :: l1). GHC.Internal.Data.Traversable.Traversable (Data.HTree.Labeled.Labeled @l1 l2)
+ Data.HTree.List: instance forall a (f :: a -> GHC.Types.Type) (x :: a) (xs :: [a]). (GHC.Internal.Show.Show (f x), GHC.Internal.Show.Show (Data.HTree.List.HList @a f xs)) => GHC.Internal.Show.Show (Data.HTree.List.HList @a f ((':) @a x xs))
+ Data.HTree.List: instance forall k (f :: k -> GHC.Types.Type). GHC.Internal.Show.Show (Data.HTree.List.HList @k f ('[] @k))
+ Data.HTree.Tree: instance forall a1 (f :: a1 -> GHC.Types.Type) (a2 :: a1) (t :: Data.HTree.Tree.TyForest @GHC.Types.Type a1). (GHC.Internal.Show.Show (f a2), GHC.Internal.Show.Show (Data.HTree.Tree.HForest @a1 f t)) => GHC.Internal.Show.Show (Data.HTree.Tree.HTree @a1 f ('Data.HTree.Tree.TyNode @a1 a2 t))
+ Data.HTree.Tree: instance forall k (typ :: k) (t :: Data.HTree.Tree.TyTree @GHC.Types.Type k). GHC.Internal.Show.Show (Data.HTree.Tree.Path @k typ t)
- Data.HTree: MkLabeled :: a -> Labeled l a
+ Data.HTree: MkLabeled :: a -> Labeled (l1 :: l) a
- Data.HTree: [HCons] :: forall f x xs. f x -> HList f xs -> HList f (x : xs)
+ Data.HTree: [HCons] :: forall {k} (f :: k -> Type) (x :: k) (xs :: [k]). f x -> HList f xs -> HList f (x ': xs)
- Data.HTree: [HNil] :: forall f. HList f '[]
+ Data.HTree: [HNil] :: forall {k} (f :: k -> Type). HList f ('[] :: [k])
- Data.HTree: [HNode] :: forall f a ts. f a -> HForest f ts -> HTree f ('TyNode a ts)
+ Data.HTree: [HNode] :: forall {k} (f :: k -> Type) (a :: k) (ts :: TyForest k). f a -> HForest f ts -> HTree f ('TyNode a ts)
- Data.HTree: [unLabel] :: Labeled l a -> a
+ Data.HTree: [unLabel] :: Labeled (l1 :: l) a -> a
- Data.HTree: class () => HasField (x :: k) r a | x r -> a
+ Data.HTree: class HasField (x :: k) r a | x r -> a
- Data.HTree: data HList f ts
+ Data.HTree: data HList (f :: k -> Type) (ts :: [k])
- Data.HTree: data HTree f t
+ Data.HTree: data HTree (f :: k -> Type) (t :: TyTree k)
- Data.HTree: data () => Proxy (t :: k)
+ Data.HTree: data Proxy (t :: k)
- Data.HTree: data TyTree k
+ Data.HTree: data TyTree (k1 :: k)
- Data.HTree: getElem :: forall {proxy} strat l typ t f. (HasField' (strat :: SearchStrategy) (Labeled l typ) t, Functor f) => proxy strat -> HTree f t -> f typ
+ Data.HTree: getElem :: forall {k} (t :: TyTree Type) f. forall (strat :: SearchStrategy) (l :: k) typ -> (HasField' strat (Labeled l typ) t, Functor f) => HTree f t -> f typ
- Data.HTree: hFoldMap :: forall {k} (f :: k -> Type) (t :: TyTree k) (b :: Type). Semigroup b => (forall a. f a -> b) -> HTree f t -> b
+ Data.HTree: hFoldMap :: forall {k} f (t :: TyTree k) b. Semigroup b => (forall (a :: k). () => f a -> b) -> HTree f t -> b
- Data.HTree: hcFoldMap :: forall {k} (c :: k -> Constraint) (f :: k -> Type) (t :: TyTree k) (b :: Type). (AllTree c t, Semigroup b) => (forall a. c a => f a -> b) -> HTree f t -> b
+ Data.HTree: hcFoldMap :: forall {k} f (t :: TyTree k) b. forall (c :: k -> Constraint) -> (AllTree c t, Semigroup b) => (forall (a :: k). c a => f a -> b) -> HTree f t -> b
- Data.HTree: hcmap :: forall {k} (c :: k -> Constraint) (f :: k -> Type) (g :: k -> Type) (t :: TyTree k). AllTree c t => (forall a. c a => f a -> g a) -> HTree f t -> HTree g t
+ Data.HTree: hcmap :: forall {k} f g (t :: TyTree k). forall (c :: k -> Constraint) -> AllTree c t => (forall (a :: k). c a => f a -> g a) -> HTree f t -> HTree g t
- Data.HTree: hctraverse :: forall {k} (c :: k -> Constraint) (h :: Type -> Type) (f :: k -> Type) (g :: k -> Type) (t :: TyTree k). (AllTree c t, Applicative h) => (forall a. c a => f a -> h (g a)) -> HTree f t -> h (HTree g t)
+ Data.HTree: hctraverse :: forall {k} h f g (t :: TyTree k). forall (c :: k -> Constraint) -> (AllTree c t, Applicative h) => (forall (a :: k). c a => f a -> h (g a)) -> HTree f t -> h (HTree g t)
- Data.HTree: hmap :: forall {k} (f :: k -> Type) (g :: k -> Type) (t :: TyTree k). (forall a. f a -> g a) -> HTree f t -> HTree g t
+ Data.HTree: hmap :: forall {k} f g (t :: TyTree k). (forall (a :: k). () => f a -> g a) -> HTree f t -> HTree g t
- Data.HTree: htraverse :: forall {k} (h :: Type -> Type) (f :: k -> Type) (g :: k -> Type) (t :: TyTree k). Applicative h => (forall a. f a -> h (g a)) -> HTree f t -> h (HTree g t)
+ Data.HTree: htraverse :: forall {k} h f g (t :: TyTree k). Applicative h => (forall (a :: k). () => f a -> h (g a)) -> HTree f t -> h (HTree g t)
- Data.HTree: newtype Labeled l a
+ Data.HTree: newtype Labeled (l1 :: l) a
- Data.HTree: pattern (:::) :: forall f x xs. f x -> HList f xs -> HList f (x : xs)
+ Data.HTree: pattern (:::) :: forall {a} f (x :: a) xs. f x -> HList f xs -> HList f (x ': xs)
- Data.HTree: pattern Dict :: forall (c :: Constraint). c => Dict c
+ Data.HTree: pattern Dict :: () => c => Dict c
- Data.HTree: pattern HLeaf :: forall f a. f a -> HTree f ('TyNode a '[])
+ Data.HTree: pattern HLeaf :: forall {a1} f (a2 :: a1). f a2 -> HTree f ('TyNode a2 ('[] :: [TyTree a1]))
- Data.HTree: pattern HSing :: forall f a. f a -> HList f '[a]
+ Data.HTree: pattern HSing :: forall {k} f (a :: k). f a -> HList f '[a]
- Data.HTree: pattern HNodeL :: forall l a f ts. Functor f => f a -> HForest f ts -> HTree f ('TyNode (Labeled l a) ts)
+ Data.HTree: pattern HNodeL :: forall {l1} (l2 :: l1) a f (ts :: TyForest Type). Functor f => f a -> HForest f ts -> HTree f ('TyNode (Labeled l2 a) ts)
- Data.HTree: type Dict c = Has (Charge c) Proxy ()
+ Data.HTree: type Dict c = Has Charge c :: Type -> Constraint Proxy :: Type -> Type ()
- Data.HTree: type TyNodeL l a = 'TyNode (Labeled l a)
+ Data.HTree: type TyNodeL (l1 :: l) a = 'TyNode Labeled l1 a
- Data.HTree: type family FlattenForest f
+ Data.HTree: type family FlattenForest (f :: TyForest k) :: [k]
- Data.HTree.Constraint: [Proves] :: c k => f k -> Has c f k
+ Data.HTree.Constraint: [Proves] :: forall {k} (c :: k -> Constraint) (k1 :: k) (f :: k -> Type). c k1 => f k1 -> Has c f k1
- Data.HTree.Constraint: class c => Charge c a
+ Data.HTree.Constraint: class c => Charge c (a :: k)
- Data.HTree.Constraint: data Has c f k
+ Data.HTree.Constraint: data Has (c :: k -> Constraint) (f :: k -> Type) (k1 :: k)
- Data.HTree.Constraint: pattern Dict :: forall (c :: Constraint). c => Dict c
+ Data.HTree.Constraint: pattern Dict :: () => c => Dict c
- Data.HTree.Constraint: proves :: Has c f a -> (c a => f a -> r) -> r
+ Data.HTree.Constraint: proves :: forall {k} c f (a :: k) r. Has c f a -> (c a => f a -> r) -> r
- Data.HTree.Constraint: type Dict c = Has (Charge c) Proxy ()
+ Data.HTree.Constraint: type Dict c = Has Charge c :: Type -> Constraint Proxy :: Type -> Type ()
- Data.HTree.Constraint: type HasIs k = Has ((~) k)
+ Data.HTree.Constraint: type HasIs (k1 :: k) = Has k ~ k1
- Data.HTree.Constraint: type HasTypeable = Has Typeable
+ Data.HTree.Constraint: type HasTypeable = Has Typeable :: k -> Constraint
- Data.HTree.Existential: [MkSome2] :: g f k -> Some2 g f
+ Data.HTree.Existential: [MkSome2] :: forall {k} {l} (g :: k -> l -> Type) (f :: k) (k1 :: l). g f k1 -> Some2 g f
- Data.HTree.Existential: [MkSome] :: g k -> Some g
+ Data.HTree.Existential: [MkSome] :: forall {l} (g :: l -> Type) (k :: l). g k -> Some g
- Data.HTree.Existential: [Proves] :: c k => f k -> Has c f k
+ Data.HTree.Existential: [Proves] :: forall {k} (c :: k -> Constraint) (k1 :: k) (f :: k -> Type). c k1 => f k1 -> Has c f k1
- Data.HTree.Existential: data Has c f k
+ Data.HTree.Existential: data Has (c :: k -> Constraint) (f :: k -> Type) (k1 :: k)
- Data.HTree.Existential: data Some g
+ Data.HTree.Existential: data Some (g :: l -> Type)
- Data.HTree.Existential: data Some2 g f
+ Data.HTree.Existential: data Some2 (g :: k -> l -> Type) (f :: k)
- Data.HTree.Existential: flipHas :: forall c1 c2 f. Some (Has c1 (Has c2 f)) -> Some (Has c2 (Has c1 f))
+ Data.HTree.Existential: flipHas :: forall {l} (c1 :: l -> Constraint) (c2 :: l -> Constraint) (f :: l -> Type). Some (Has c1 (Has c2 f)) -> Some (Has c2 (Has c1 f))
- Data.HTree.Existential: hcFoldEHList :: forall c f y. (forall x. c x => f x -> y -> y) -> y -> EList (Has c f) -> y
+ Data.HTree.Existential: hcFoldEHList :: (forall (x :: k). c x => f x -> y -> y) -> y -> EList (Has c f) -> y
- Data.HTree.Existential: hcFoldMapEHTree :: forall c f y. Semigroup y => (forall a. c a => f a -> y) -> ETree (Has c f) -> y
+ Data.HTree.Existential: hcFoldMapEHTree :: forall {k} c f y. Semigroup y => (forall (a :: k). c a => f a -> y) -> ETree (Has c f) -> y
- Data.HTree.Existential: prodHas :: forall c1 c2 f. Some (Has c1 (Has c2 f)) -> Some (Has (Both c1 c2) f)
+ Data.HTree.Existential: prodHas :: forall {l} (c1 :: l -> Constraint) (c2 :: l -> Constraint) (f :: l -> Type). Some (Has c1 (Has c2 f)) -> Some (Has (Both c1 c2) f)
- Data.HTree.Existential: type EList = Some2 HList
+ Data.HTree.Existential: type EList = Some2 HList :: k -> Type -> [k] -> Type
- Data.HTree.Existential: type ETree = Some2 HTree
+ Data.HTree.Existential: type ETree = Some2 HTree :: k -> Type -> TyTree k -> Type
- Data.HTree.Existential: type HasIs k = Has ((~) k)
+ Data.HTree.Existential: type HasIs (k1 :: k) = Has k ~ k1
- Data.HTree.Existential: type HasTypeable = Has Typeable
+ Data.HTree.Existential: type HasTypeable = Has Typeable :: k -> Constraint
- Data.HTree.Existential: with :: forall {l} (g :: l -> Type) r. Some g -> (forall m. g m -> r) -> r
+ Data.HTree.Existential: with :: Some g -> (forall (m :: l). () => g m -> r) -> r
- Data.HTree.Existential: with2 :: forall {k} {l} (g :: k -> l -> Type) (f :: k) r. Some2 g f -> (forall m. g f m -> r) -> r
+ Data.HTree.Existential: with2 :: forall {k} {l} g (f :: k) r. Some2 g f -> (forall (m :: l). () => g f m -> r) -> r
- Data.HTree.Existential: withProves :: Some (Has c f) -> (forall a. c a => f a -> r) -> r
+ Data.HTree.Existential: withProves :: Some (Has c f) -> (forall (a :: l). c a => f a -> r) -> r
- Data.HTree.Existential: withSomeHList :: EList f -> (forall xs. HList f xs -> r) -> r
+ Data.HTree.Existential: withSomeHList :: forall {k} (f :: k -> Type) r. EList f -> (forall (xs :: [k]). () => HList f xs -> r) -> r
- Data.HTree.Existential: withSomeHTree :: ETree f -> (forall t. HTree f t -> r) -> r
+ Data.HTree.Existential: withSomeHTree :: forall {k} (f :: k -> Type) r. ETree f -> (forall (t :: TyTree k). () => HTree f t -> r) -> r
- Data.HTree.Families: class All c xs => AllC c xs
+ Data.HTree.Families: class All c xs => AllC (c :: k -> Constraint) (xs :: [k])
- Data.HTree.Families: class AllInv l k
+ Data.HTree.Families: class AllInv (l :: [k -> Constraint]) (k1 :: k)
- Data.HTree.Families: class (c1 a, c2 a) => Both c1 c2 a
+ Data.HTree.Families: class (c1 a, c2 a) => Both (c1 :: k -> Constraint) (c2 :: k -> Constraint) (a :: k)
- Data.HTree.Families: class Top k
+ Data.HTree.Families: class Top (k1 :: k)
- Data.HTree.Families: type family a || b
+ Data.HTree.Families: type family (a :: Bool) || (b :: Bool) :: Bool
- Data.HTree.Labeled: MkLabeled :: a -> Labeled l a
+ Data.HTree.Labeled: MkLabeled :: a -> Labeled (l1 :: l) a
- Data.HTree.Labeled: [unLabel] :: Labeled l a -> a
+ Data.HTree.Labeled: [unLabel] :: Labeled (l1 :: l) a -> a
- Data.HTree.Labeled: class Decide strat elem typ t | strat t -> typ
+ Data.HTree.Labeled: class Decide (strat :: SearchStrategy) (elem :: Bool) typ (t :: TyTree Type) | strat t -> typ
- Data.HTree.Labeled: class () => HasField (x :: k) r a | x r -> a
+ Data.HTree.Labeled: class HasField (x :: k) r a | x r -> a
- Data.HTree.Labeled: class HasField' strat typ t | strat t -> typ
+ Data.HTree.Labeled: class HasField' (strat :: SearchStrategy) typ (t :: TyTree Type) | strat t -> typ
- Data.HTree.Labeled: evidence :: forall {proxy}. HasField' strat typ t => proxy strat -> Path typ t
+ Data.HTree.Labeled: evidence :: HasField' strat typ t => proxy strat -> Path typ t
- Data.HTree.Labeled: evidence' :: forall {proxy :: forall k. k -> Type}. Decide strat elem typ t => proxy strat -> proxy elem -> Path typ t
+ Data.HTree.Labeled: evidence' :: forall {proxy :: forall k. () => k -> Type}. Decide strat elem typ t => proxy strat -> proxy elem -> Path typ t
- Data.HTree.Labeled: getElem :: forall {proxy} strat l typ t f. (HasField' (strat :: SearchStrategy) (Labeled l typ) t, Functor f) => proxy strat -> HTree f t -> f typ
+ Data.HTree.Labeled: getElem :: forall {k} (t :: TyTree Type) f. forall (strat :: SearchStrategy) (l :: k) typ -> (HasField' strat (Labeled l typ) t, Functor f) => HTree f t -> f typ
- Data.HTree.Labeled: getElem' :: forall {proxy} strat typ t f. HasField' (strat :: SearchStrategy) typ t => proxy strat -> HTree f t -> f typ
+ Data.HTree.Labeled: getElem' :: forall (t :: TyTree Type) f. forall (strat :: SearchStrategy) typ -> HasField' strat typ t => HTree f t -> f typ
- Data.HTree.Labeled: getElemWithPath :: forall typ t f. Path typ t -> HTree f t -> f typ
+ Data.HTree.Labeled: getElemWithPath :: forall {k} (typ :: k) (t :: TyTree k) f. Path typ t -> HTree f t -> f typ
- Data.HTree.Labeled: newtype Labeled l a
+ Data.HTree.Labeled: newtype Labeled (l1 :: l) a
- Data.HTree.Labeled: pattern HLeafL :: forall l a f. Functor f => f a -> HTree f ('TyNode (Labeled l a) '[])
+ Data.HTree.Labeled: pattern HLeafL :: forall {l1} (l2 :: l1) a f. Functor f => f a -> HTree f ('TyNode (Labeled l2 a) ('[] :: [TyTree Type]))
- Data.HTree.Labeled: type TyNodeL l a = 'TyNode (Labeled l a)
+ Data.HTree.Labeled: type TyNodeL (l1 :: l) a = 'TyNode Labeled l1 a
- Data.HTree.Labeled: type family AnyElem typ ts
+ Data.HTree.Labeled: type family AnyElem (typ :: k) (ts :: TyForest k) :: Bool
- Data.HTree.List: [HCons] :: forall f x xs. f x -> HList f xs -> HList f (x : xs)
+ Data.HTree.List: [HCons] :: forall {k} (f :: k -> Type) (x :: k) (xs :: [k]). f x -> HList f xs -> HList f (x ': xs)
- Data.HTree.List: [HNil] :: forall f. HList f '[]
+ Data.HTree.List: [HNil] :: forall {k} (f :: k -> Type). HList f ('[] :: [k])
- Data.HTree.List: allTopHList :: forall f xs. HList f xs -> Dict (All Top xs)
+ Data.HTree.List: allTopHList :: forall {k} (f :: k -> Type) (xs :: [k]). HList f xs -> Dict (All (Top :: k -> Constraint) xs)
- Data.HTree.List: data HList f ts
+ Data.HTree.List: data HList (f :: k -> Type) (ts :: [k])
- Data.HTree.List: hcFold :: forall c f b xs. All c xs => (forall a. c a => f a -> b -> b) -> b -> HList f xs -> b
+ Data.HTree.List: hcFold :: forall {k} f b (xs :: [k]). forall (c :: k -> Constraint) -> All c xs => (forall (a :: k). c a => f a -> b -> b) -> b -> HList f xs -> b
- Data.HTree.List: hcmap :: forall c f g xs. All c xs => (forall a. c a => f a -> g a) -> HList f xs -> HList g xs
+ Data.HTree.List: hcmap :: forall {k} f g (xs :: [k]). forall (c :: k -> Constraint) -> All c xs => (forall (a :: k). c a => f a -> g a) -> HList f xs -> HList g xs
- Data.HTree.List: hconcat :: forall f xs ys. HList f xs -> HList f ys -> HList f (xs ++ ys)
+ Data.HTree.List: hconcat :: forall {k} (f :: k -> Type) (xs :: [k]) (ys :: [k]). HList f xs -> HList f ys -> HList f (xs ++ ys)
- Data.HTree.List: hctraverse :: forall c t f g xs. (All c xs, Applicative t) => (forall a. c a => f a -> t (g a)) -> HList f xs -> t (HList g xs)
+ Data.HTree.List: hctraverse :: forall {k} t f g (xs :: [k]). forall (c :: k -> Constraint) -> (All c xs, Applicative t) => (forall (a :: k). c a => f a -> t (g a)) -> HList f xs -> t (HList g xs)
- Data.HTree.List: hmap :: forall f g xs. (forall a. f a -> g a) -> HList f xs -> HList g xs
+ Data.HTree.List: hmap :: forall {k} f g (xs :: [k]). (forall (a :: k). () => f a -> g a) -> HList f xs -> HList g xs
- Data.HTree.List: htraverse :: forall t f g xs. Applicative t => (forall a. f a -> t (g a)) -> HList f xs -> t (HList g xs)
+ Data.HTree.List: htraverse :: forall {k} t f g (xs :: [k]). Applicative t => (forall (a :: k). () => f a -> t (g a)) -> HList f xs -> t (HList g xs)
- Data.HTree.List: pattern (:::) :: forall f x xs. f x -> HList f xs -> HList f (x : xs)
+ Data.HTree.List: pattern (:::) :: forall {a} f (x :: a) xs. f x -> HList f xs -> HList f (x ': xs)
- Data.HTree.List: pattern HSing :: forall f a. f a -> HList f '[a]
+ Data.HTree.List: pattern HSing :: forall {k} f (a :: k). f a -> HList f '[a]
- Data.HTree.Tree: [Deeper] :: forall a b t ts. Path a t -> Path a ('TyNode b (t : ts))
+ Data.HTree.Tree: [Deeper] :: forall {k} (k1 :: k) (b :: k) (t1 :: TyTree k) (ts :: [TyTree k]). Path k1 t1 -> Path k1 ('TyNode b (t1 ': ts))
- Data.HTree.Tree: [Farther] :: forall a b t ts. Path a ('TyNode b ts) -> Path a ('TyNode b (t : ts))
+ Data.HTree.Tree: [Farther] :: forall {k} (k1 :: k) (b :: k) (t1 :: TyTree k) (ts :: [TyTree k]). Path k1 ('TyNode b ts) -> Path k1 ('TyNode b (t1 ': ts))
- Data.HTree.Tree: [HNode] :: forall f a ts. f a -> HForest f ts -> HTree f ('TyNode a ts)
+ Data.HTree.Tree: [HNode] :: forall {k} (f :: k -> Type) (a :: k) (ts :: TyForest k). f a -> HForest f ts -> HTree f ('TyNode a ts)
- Data.HTree.Tree: [Here] :: forall a ts. Path a ('TyNode a ts)
+ Data.HTree.Tree: [Here] :: forall {k} (k1 :: k) (ts :: TyForest k). Path k1 ('TyNode k1 ts)
- Data.HTree.Tree: allTopHForest :: forall f t. HForest f t -> Dict (AllForest Top t)
+ Data.HTree.Tree: allTopHForest :: forall {k} (f :: k -> Type) (t :: TyForest k). HForest f t -> Dict (AllForest (Top :: k -> Constraint) t)
- Data.HTree.Tree: allTopHTree :: forall f t. HTree f t -> Dict (AllTree Top t)
+ Data.HTree.Tree: allTopHTree :: forall {k} (f :: k -> Type) (t :: TyTree k). HTree f t -> Dict (AllTree (Top :: k -> Constraint) t)
- Data.HTree.Tree: class AllTree c ts => AllTreeC c ts
+ Data.HTree.Tree: class AllTree c ts => AllTreeC (c :: k -> Constraint) (ts :: TyTree k)
- Data.HTree.Tree: data HTree f t
+ Data.HTree.Tree: data HTree (f :: k -> Type) (t :: TyTree k)
- Data.HTree.Tree: data Path k t
+ Data.HTree.Tree: data Path (k1 :: k) (t :: TyTree k)
- Data.HTree.Tree: data TyTree k
+ Data.HTree.Tree: data TyTree (k1 :: k)
- Data.HTree.Tree: hFoldMap :: forall {k} (f :: k -> Type) (t :: TyTree k) (b :: Type). Semigroup b => (forall a. f a -> b) -> HTree f t -> b
+ Data.HTree.Tree: hFoldMap :: forall {k} f (t :: TyTree k) b. Semigroup b => (forall (a :: k). () => f a -> b) -> HTree f t -> b
- Data.HTree.Tree: hcFoldMap :: forall {k} (c :: k -> Constraint) (f :: k -> Type) (t :: TyTree k) (b :: Type). (AllTree c t, Semigroup b) => (forall a. c a => f a -> b) -> HTree f t -> b
+ Data.HTree.Tree: hcFoldMap :: forall {k} f (t :: TyTree k) b. forall (c :: k -> Constraint) -> (AllTree c t, Semigroup b) => (forall (a :: k). c a => f a -> b) -> HTree f t -> b
- Data.HTree.Tree: hcmap :: forall {k} (c :: k -> Constraint) (f :: k -> Type) (g :: k -> Type) (t :: TyTree k). AllTree c t => (forall a. c a => f a -> g a) -> HTree f t -> HTree g t
+ Data.HTree.Tree: hcmap :: forall {k} f g (t :: TyTree k). forall (c :: k -> Constraint) -> AllTree c t => (forall (a :: k). c a => f a -> g a) -> HTree f t -> HTree g t
- Data.HTree.Tree: hctraverse :: forall {k} (c :: k -> Constraint) (h :: Type -> Type) (f :: k -> Type) (g :: k -> Type) (t :: TyTree k). (AllTree c t, Applicative h) => (forall a. c a => f a -> h (g a)) -> HTree f t -> h (HTree g t)
+ Data.HTree.Tree: hctraverse :: forall {k} h f g (t :: TyTree k). forall (c :: k -> Constraint) -> (AllTree c t, Applicative h) => (forall (a :: k). c a => f a -> h (g a)) -> HTree f t -> h (HTree g t)
- Data.HTree.Tree: hmap :: forall {k} (f :: k -> Type) (g :: k -> Type) (t :: TyTree k). (forall a. f a -> g a) -> HTree f t -> HTree g t
+ Data.HTree.Tree: hmap :: forall {k} f g (t :: TyTree k). (forall (a :: k). () => f a -> g a) -> HTree f t -> HTree g t
- Data.HTree.Tree: htraverse :: forall {k} (h :: Type -> Type) (f :: k -> Type) (g :: k -> Type) (t :: TyTree k). Applicative h => (forall a. f a -> h (g a)) -> HTree f t -> h (HTree g t)
+ Data.HTree.Tree: htraverse :: forall {k} h f g (t :: TyTree k). Applicative h => (forall (a :: k). () => f a -> h (g a)) -> HTree f t -> h (HTree g t)
- Data.HTree.Tree: pattern HLeaf :: forall f a. f a -> HTree f ('TyNode a '[])
+ Data.HTree.Tree: pattern HLeaf :: forall {a1} f (a2 :: a1). f a2 -> HTree f ('TyNode a2 ('[] :: [TyTree a1]))
- Data.HTree.Tree: replaceAt :: Path typ t -> f typ -> HTree f t -> HTree f t
+ Data.HTree.Tree: replaceAt :: forall {k} (typ :: k) (t :: TyTree k) f. Path typ t -> f typ -> HTree f t -> HTree f t
- Data.HTree.Tree: type HForest f ts = HList (HTree f) ts
+ Data.HTree.Tree: type HForest (f :: k -> Type) (ts :: TyForest k) = HList HTree f ts
- Data.HTree.Tree: type TyForest a = [TyTree a]
+ Data.HTree.Tree: type TyForest (a :: k) = [TyTree a]
- Data.HTree.Tree: type family AllForest c t
+ Data.HTree.Tree: type family AllForest (c :: k -> Constraint) (t :: TyForest k)
Files
- CHANGELOG.md +9/−0
- README.md +3/−5
- htree.cabal +5/−9
- src/Data/HTree/Constraint.hs +2/−2
- src/Data/HTree/Existential.hs +2/−2
- src/Data/HTree/Labeled.hs +14/−13
- src/Data/HTree/List.hs +10/−10
- src/Data/HTree/Tree.hs +13/−13
- test/Spec/HTree/Fold.hs +2/−2
- test/Spec/HTree/Labeled.hs +3/−3
- test/Spec/HTree/Traverse.hs +1/−1
CHANGELOG.md view
@@ -3,3 +3,12 @@ ## 0.1.0.0 -- 2024-07-21 * initial release++## 0.2.0.0 -- 2024-11-15++* moved to required type arguments wherever possible+* dropped support for GHC < 9.10+* dropped support for base < 4.20+* stopped reexporting Proxy+* make `getElem` and `getElem'` take required type arguments, the search strategy and the type of the field, as well as the name of the field in the case of `getElem`+* make all hc* functions take the constraint as a required type argument
README.md view
@@ -1,8 +1,6 @@--[](https://nixos.org/) [](https://www.haskell.org/) -[](https://mangoiv.com/htree)+[](https://hackage.haskell.org/package/htree) # `htree`: heterogeneous rose tree @@ -60,9 +58,9 @@ , TyNodeL "foo" Int '[] ] --- >>> getElem @'DFS @"foo" @Int Proxy labeledTree+-- >>> getElem DFS "foo" Int labeledTree -- Identity 69--- >>> getElem @'BFS @"foo" @Int Proxy labeledTree+-- >>> getElem BFS "foo" Int labeledTree -- Identity 67 labeledTree :: HTree Identity LabeledTree labeledTree = 42 `HNodeL` HNodeL 4 (HNodeL 69 HNil ::: HNil) ::: HNodeL 67 HNil ::: HNil
htree.cabal view
@@ -1,19 +1,13 @@ cabal-version: 3.4 name: htree-tested-with: GHC ==9.2.8 || ==9.4.8 || ==9.6.4 || ==9.8.1-version: 0.1.1.0+tested-with: GHC ==9.10.1+version: 0.2.0.0 synopsis: a library to build and work with heterogeneous, type level indexed rose trees description: This library implements a heterogeneous rose-tree (HTree) that is indexed by a type-level rosetree (TyTree). - It also offers some useful functions, highlights include:-- searching in the tree and creating evidence on the term-level via typeclasses- record-dot syntax for accessing elements in the tree.- mapping and traversing trees- license: AGPL-3.0-or-later license-file: LICENSE author: mangoiv@@ -41,10 +35,12 @@ OverloadedStrings PatternSynonyms QuantifiedConstraints+ RequiredTypeArguments+ TypeAbstractions TypeFamilies ViewPatterns - build-depends: base >=4.16 && <5+ build-depends: base >=4.20 && <5 library import: warnings-and-imports
src/Data/HTree/Constraint.hs view
@@ -61,8 +61,8 @@ proves (Proves x) k = k x -- | 'Has' but specialised to 'Typeable'-type HasTypeable :: (k -> Type) -> k -> Type-type HasTypeable = Has Typeable+type HasTypeable :: forall k. (k -> Type) -> k -> Type+type HasTypeable @k = Has Typeable -- | 'Has' but specialised to a constant type, @Some (HasIs k f)@ is isomorphic to @f k@ type HasIs :: k -> (k -> Type) -> k -> Type
src/Data/HTree/Existential.hs view
@@ -65,11 +65,11 @@ -- | HTree but the type level tree is existential type ETree :: forall k. (k -> Type) -> Type-type ETree = Some2 HTree+type ETree @k = Some2 HTree -- | HList but the type level list is existential type EList :: forall k. (k -> Type) -> Type-type EList = Some2 HList+type EList @k = Some2 HList -- | 'with2' specialized to 'HTree's withSomeHTree :: ETree f -> (forall t. HTree f t -> r) -> r
src/Data/HTree/Labeled.hs view
@@ -23,7 +23,6 @@ -- ** Reexports , HasField (..)- , Proxy (..) -- * Internal , HasField' (..)@@ -72,31 +71,33 @@ getElemWithPath (Deeper pt) (HNode _ (t `HCons` _)) = getElemWithPath pt t -- | searches a tree for an element and returns that element-getElem' :: forall {proxy} strat typ t f. HasField' (strat :: SearchStrategy) typ t => proxy strat -> HTree f t -> f typ-getElem' _ = getElemWithPath (evidence @strat @typ @t Proxy)+getElem' :: forall t f. forall (strat :: SearchStrategy) -> forall typ -> HasField' strat typ t => HTree f t -> f typ+getElem' strat typ = getElemWithPath (evidence @strat @typ @t Proxy) -- | searches a tree for an element and returns that element, specialised to 'Labeled' and unwraps -- -- >>> import Data.Functor.Identity -- >>> type T = TyNodeL "top" Int [ TyNodeL "inter" Int '[ TyNodeL "foo" Int '[]], TyNodeL "foo" Int '[]] -- >>> t :: HTree Identity T = 42 `HNodeL` HNodeL 4 (HNodeL 69 HNil `HCons` HNil) `HCons` HNodeL 67 HNil `HCons` HNil--- >>> getElem @'DFS @"foo" @Int Proxy t+-- >>> getElem DFS "foo" Int t -- Identity 69--- >>> getElem @'BFS @"foo" @Int Proxy t+-- >>> getElem BFS "foo" Int t -- Identity 67 getElem- :: forall {proxy} strat l typ t f- . ( HasField' (strat :: SearchStrategy) (Labeled l typ) t- , Functor f- )- => proxy strat- -> HTree f t+ :: forall {k} t f+ . forall (strat :: SearchStrategy)+ ->forall (l :: k)+ ->forall (typ :: Type)+ ->( HasField' strat (Labeled l typ) t+ , Functor f+ )+ => HTree f t -> f typ-getElem _ = fmap unLabel . getElemWithPath (evidence @strat @(Labeled l typ) @t Proxy)+getElem strat l typ = fmap unLabel . getElemWithPath (evidence @strat @(Labeled l typ) @t Proxy) -- the default behaviour is a breadth first search instance (HasField' 'BFS (Labeled l typ) t, Functor f) => HasField l (HTree f t) (f typ) where- getField = getElem @'BFS @l @typ @t Proxy+ getField = getElem BFS l typ -- | simple typelevel predicate that tests whether some element is in a tree type Elem :: forall k. k -> TyTree k -> Bool
src/Data/HTree/List.hs view
@@ -57,33 +57,33 @@ -- | map with a function that maps forall f a hmap :: forall f g xs. (forall a. f a -> g a) -> HList f xs -> HList g xs-hmap f l = withDict (allTopHList l) $ hcmap @Top @f @g f l+hmap f l = withDict (allTopHList l) $ hcmap Top f l -- | map with a constraint that holds for all elements of the list -- -- >>> import Data.Functor.Const -- >>> hcmap @Show (Const . show . runIdentity) (42 `HCons` HSing "bla" :: HList Identity '[ Int, String ]) -- HCons (Const "42") (HCons (Const "\"bla\"") HNil)-hcmap :: forall c f g xs. All c xs => (forall a. c a => f a -> g a) -> HList f xs -> HList g xs-hcmap f = runIdentity . hctraverse @c @Identity @f @g (Identity . f)+hcmap :: forall f g xs. forall c -> All c xs => (forall a. c a => f a -> g a) -> HList f xs -> HList g xs+hcmap c f = runIdentity . hctraverse c (Identity . f) -- | traverse a structure with a function htraverse :: forall t f g xs. Applicative t => (forall a. f a -> t (g a)) -> HList f xs -> t (HList g xs)-htraverse f l = withDict (allTopHList l) $ hctraverse @Top @t @f @g f l+htraverse f l = withDict (allTopHList l) $ hctraverse Top f l -- | traverse a structure such that a constraint holds; this is the workhorse of mapping and traversing -- -- >>> import Data.Functor.Const -- >>> hctraverse @Show (Just . Const . show . runIdentity) (42 `HCons` HSing "bla" :: HList Identity '[ Int, String ]) -- Just (HCons (Const "42") (HCons (Const "\"bla\"") HNil))-hctraverse :: forall c t f g xs. (All c xs, Applicative t) => (forall a. c a => f a -> t (g a)) -> HList f xs -> t (HList g xs)-hctraverse _ HNil = pure HNil-hctraverse f (HCons x xs) = HCons <$> f x <*> hctraverse @c @t @f @g f xs+hctraverse :: forall t f g xs. forall c -> (All c xs, Applicative t) => (forall a. c a => f a -> t (g a)) -> HList f xs -> t (HList g xs)+hctraverse _ _ HNil = pure HNil+hctraverse c f (HCons x xs) = HCons <$> f x <*> hctraverse c f xs -- | foldr for HLists.-hcFold :: forall c f b xs. All c xs => (forall a. c a => f a -> b -> b) -> b -> HList f xs -> b-hcFold _ def HNil = def-hcFold f def (x `HCons` xs) = f x $ hcFold @c f def xs+hcFold :: forall f b xs. forall c -> All c xs => (forall a. c a => f a -> b -> b) -> b -> HList f xs -> b+hcFold _ _ def HNil = def+hcFold c f def (x `HCons` xs) = f x $ hcFold c f def xs -- | witnesses that for all HLists, we can always derive the All Top constraint allTopHList :: forall f xs. HList f xs -> Dict (All Top xs)
src/Data/HTree/Tree.hs view
@@ -90,21 +90,21 @@ . (forall a. f a -> g a) -> HTree f t -> HTree g t-hmap f t = withDict (allTopHTree t) $ hcmap @Top @f @g f t+hmap f t = withDict (allTopHTree t) $ hcmap Top f t -- | map a function with a constraint over an HTree hcmap :: forall {k}- (c :: k -> Constraint) (f :: k -> Type) (g :: k -> Type) (t :: TyTree k)- . AllTree c t+ . forall (c :: k -> Constraint)+ ->AllTree c t => (forall a. c a => f a -> g a) -> HTree f t -> HTree g t-hcmap f = runIdentity . hctraverse @c @Identity @f @g (Identity . f)+hcmap c f = runIdentity . hctraverse c (Identity . f) -- | traverse a structure with a function htraverse@@ -118,22 +118,22 @@ => (forall a. f a -> h (g a)) -> HTree f t -> h (HTree g t)-htraverse f t = withDict (allTopHTree t) $ hctraverse @Top f t+htraverse f t = withDict (allTopHTree t) $ hctraverse Top f t -- | traverse a structure such that a constraint holds; this is the workhorse of mapping and traversing hctraverse :: forall {k}- (c :: k -> Constraint) (h :: Type -> Type) (f :: k -> Type) (g :: k -> Type) (t :: TyTree k)- . (AllTree c t, Applicative h)+ . forall (c :: k -> Constraint)+ ->(AllTree c t, Applicative h) => (forall a. c a => f a -> h (g a)) -> HTree f t -> h (HTree g t)-hctraverse f (HNode x ts) = HNode <$> f x <*> L.hctraverse @(AllTreeC c) @h @(HTree f) @(HTree g) (hctraverse @c f) ts+hctraverse c f (HNode x ts) = HNode <$> f x <*> L.hctraverse (AllTreeC c) (hctraverse c f) ts -- | map a functor over a TyTree type TreeMap :: forall k l. (k -> l) -> TyTree k -> TyTree l@@ -152,16 +152,16 @@ hcFoldMap :: forall {k}- (c :: k -> Constraint) (f :: k -> Type) (t :: TyTree k) (b :: Type)- . (AllTree c t, Semigroup b)+ . forall (c :: k -> Constraint)+ ->(AllTree c t, Semigroup b) => (forall a. c a => f a -> b) -> HTree f t -> b-hcFoldMap f (HNode x HNil) = f x-hcFoldMap f (HNode x (y `HCons` ys)) = hcFoldMap @c f y <> hcFoldMap @c f (HNode x ys)+hcFoldMap _ f (HNode x HNil) = f x+hcFoldMap c f (HNode x (y `HCons` ys)) = hcFoldMap c f y <> hcFoldMap c f (HNode x ys) -- | monoidally folds down a tree to a single value, this is similar to 'foldMap' hFoldMap@@ -174,7 +174,7 @@ => (forall a. f a -> b) -> HTree f t -> b-hFoldMap f t = withDict (allTopHTree t) $ hcFoldMap @Top f t+hFoldMap f t = withDict (allTopHTree t) $ hcFoldMap Top f t -- | flatten a heterogeneous tree down to a heterogeneous list hFlatten
test/Spec/HTree/Fold.hs view
@@ -17,8 +17,8 @@ spec :: Spec spec = do describe "folding an HTree of numbers" do- it "calculates the correct sum" (31649046316921651 % 281474976710656 == getSum (hcFoldMap @Real (Sum . toRational) exReal))- it "calculates the correct product" (308407698144 == getProduct (hcFoldMap @Integral (Product . toInteger) exIntegral))+ it "calculates the correct sum" (31649046316921651 % 281474976710656 == getSum (hcFoldMap Real (Sum . toRational) exReal))+ it "calculates the correct product" (308407698144 == getProduct (hcFoldMap Integral (Product . toInteger) exIntegral)) modifyMaxSuccess (* 10) do prop "yields the same results as expected for many Lists" $ foldsSameList @Identity
test/Spec/HTree/Labeled.hs view
@@ -3,7 +3,7 @@ module Spec.HTree.Labeled (spec) where -import Data.HTree.Labeled (Proxy (Proxy), SearchStrategy (BFS, DFS), getElem)+import Data.HTree.Labeled (SearchStrategy (BFS, DFS), getElem) import Spec.HTree.Fixtures (exBfsDfs, exL, unI) import Test.Hspec (Spec, describe, it) @@ -20,6 +20,6 @@ it "has e node \"test\"" do ("test" :: String) == unI exL.e it "finds int via BFS" do- unI (getElem @BFS @"foo" @Int Proxy exBfsDfs) == 67+ unI (getElem BFS "foo" Int exBfsDfs) == 67 it "finds int via DFS" do- unI (getElem @DFS @"foo" @Int Proxy exBfsDfs) == 69+ unI (getElem DFS "foo" Int exBfsDfs) == 69
test/Spec/HTree/Traverse.hs view
@@ -11,5 +11,5 @@ describe "use hctraverse" $ do it "yields the same result as expected" $ do let traversed :: Maybe (HTree (Const String) Ex)- traversed = hctraverse @Show (Just . Const . show . unI) ex+ traversed = hctraverse Show (Just . Const . show . unI) ex Just `traverse` exShown == (forgetHTree <$> traversed)