-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Extensible, efficient, optics-friendly data types and effects -- -- This package provides a powerful framework to combine and manipulate -- various types of structures. -- -- See also School of Haskell for tutorials. @package extensible @version 0.4.9 -- | A bunch of combinators that contains magic module Data.Extensible.Internal -- | The position of x in the type level set xs. data Membership (xs :: [k]) (x :: k) -- | get the position as an Int. getMemberId :: Membership xs x -> Int -- | Generates a Membership that corresponds to the given ordinal -- (0-origin). mkMembership :: Int -> Q Exp -- | Make up a Membership from an integer. reifyMembership :: Int -> (forall x. Membership xs x -> r) -> r -- | Embodies a type equivalence to ensure that the Membership -- points the first element. leadership :: Membership (y : xs) x -> (x :~: y -> r) -> (Membership xs x -> r) -> r -- | Compare two Memberships. compareMembership :: Membership xs x -> Membership xs y -> Either Ordering (x :~: y) -- | There is no Membership of an empty list. impossibleMembership :: Membership '[] x -> r -- | The Membership points the first element here :: Membership (x : xs) x -- | The next membership navNext :: Membership xs y -> Membership (x : xs) y -- | x is a member of xs class Member xs x membership :: Member xs x => Membership xs x -- | Remember that Member xs x from Membership. remember :: forall xs x r. Membership xs x -> (Member xs x => r) -> r -- | Unicode flipped alias for Member type x ∈ xs = Member xs x -- | FindType types -- | The kind of key-value pairs data Assoc k v (:>) :: k -> v -> Assoc k v -- | A synonym for (:>) type >: = '(:>) -- | Associate k v xs is essentially identical to (k -- :> v) ∈ xs , but the type v is inferred from -- k and xs. class Associate k v xs | k xs -> v association :: Associate k v xs => Membership xs (k :> v) -- | Find a type associated to the specified key. -- | Make the result more readable -- | A readable type search result data Elaborated k v Expecting :: v -> Elaborated k v Missing :: k -> Elaborated k v Duplicate :: k -> Elaborated k v -- | First element -- | Last element instance forall k (xs :: [k]) (x :: k). Control.DeepSeq.NFData (Data.Extensible.Internal.Membership xs x) instance forall k (x :: k) (xs :: [k]) (pos :: GHC.Types.Nat). (Data.Extensible.Internal.Elaborate x (Data.Extensible.Internal.FindType x xs) ~ 'Data.Extensible.Internal.Expecting pos, GHC.TypeNats.KnownNat pos) => Data.Extensible.Internal.Member xs x instance forall v1 k1 (k2 :: k1) (xs :: [Data.Extensible.Internal.Assoc k1 v1]) (n :: GHC.Types.Nat) (v2 :: v1). (Data.Extensible.Internal.Elaborate k2 (Data.Extensible.Internal.FindAssoc 0 k2 xs) ~ 'Data.Extensible.Internal.Expecting (n 'Data.Extensible.Internal.:> v2), GHC.TypeNats.KnownNat n) => Data.Extensible.Internal.Associate k2 v2 xs instance forall k (xs :: [k]) (x :: k). Language.Haskell.TH.Syntax.Lift (Data.Extensible.Internal.Membership xs x) instance forall k (xs :: [k]) (x :: k). Data.Hashable.Class.Hashable (Data.Extensible.Internal.Membership xs x) instance forall k (xs :: [k]) (x :: k). GHC.Show.Show (Data.Extensible.Internal.Membership xs x) instance forall k (xs :: [k]) (x :: k). Data.Text.Prettyprint.Doc.Internal.Pretty (Data.Extensible.Internal.Membership xs x) instance forall k (xs :: [k]) (x :: k). GHC.Classes.Eq (Data.Extensible.Internal.Membership xs x) instance forall k (xs :: [k]) (x :: k). GHC.Classes.Ord (Data.Extensible.Internal.Membership xs x) instance forall k (xs :: [k]) (x :: k). Data.Semigroup.Semigroup (Data.Extensible.Internal.Membership xs x) -- | Heterogeneous list module Data.Extensible.HList data HList (h :: k -> *) (xs :: [k]) [HNil] :: HList h '[] [HCons] :: h x -> HList h xs -> HList h (x : xs) htraverse :: Applicative f => (forall x. g x -> f (h x)) -> HList g xs -> f (HList h xs) htraverseWithIndex :: forall f g h xs. Applicative f => (forall x. Membership xs x -> g x -> f (h x)) -> HList g xs -> f (HList h xs) hfoldrWithIndex :: forall h r xs. (forall x. Membership xs x -> h x -> r -> r) -> r -> HList h xs -> r hlength :: HList h xs -> Int -- | Re-implementation of lens combinators module Data.Extensible.Internal.Rig type Optic p f s t a b = p a (f b) -> p s (f t) type Optic' p f s a = p a (f a) -> p s (f s) -- |
-- view :: Getter s a -> s -> a --view :: Optic' (->) (Const a) s a -> s -> a -- |
-- views :: Getter s a -> (a -> r) -> (s -> r) --views :: Optic' (->) (Const r) s a -> (a -> r) -> s -> r -- |
-- over :: Setter s t a b -> (a -> b) -> (s -> t) --over :: Optic (->) Identity s t a b -> (a -> b) -> s -> t -- | Recover tho functions from an Iso/ withIso :: Optic (Exchange a b) Identity s t a b -> ((s -> a) -> (b -> t) -> r) -> r -- | Reifies the structure of Isos data Exchange a b s t Exchange :: (s -> a) -> (b -> t) -> Exchange a b s t -- |
-- review :: AReview s a -> a -> s --review :: Optic' Tagged Identity s a -> a -> s instance Data.Profunctor.Unsafe.Profunctor (Data.Extensible.Internal.Rig.Exchange a b) module Data.Extensible.Wrapper -- | The extensible data types should take k -> * as a -- parameter. This class allows us to take a shortcut for direct -- representation. class Wrapper (h :: k -> *) where { type family Repr h (v :: k) :: *; } -- | This is an isomorphism between h v and Repr h -- v. -- --
-- _Wrapper :: Iso' (h v) (Repr h v) --_Wrapper :: (Wrapper h, Functor f, Profunctor p) => Optic' p f (h v) (Repr h v) -- | Restricted version of _Wrapper. It is useful for eliminating -- ambiguousness. _WrapperAs :: (Functor f, Profunctor p, Wrapper h) => proxy v -> Optic' p f (h v) (Repr h v) -- | Poly-kinded Const newtype Const' a x Const' :: a -> Const' a x [getConst'] :: Const' a x -> a -- | Poly-kinded composition newtype Comp (f :: j -> *) (g :: i -> j) (a :: i) Comp :: f (g a) -> Comp [getComp] :: Comp -> f (g a) -- | Wrap a result of fmap comp :: Functor f => (a -> g b) -> f a -> Comp f g b -- | Poly-kinded product data Prod f g a Prod :: (f a) -> (g a) -> Prod f g a instance (Data.Traversable.Traversable g, Data.Traversable.Traversable f) => Data.Traversable.Traversable (Data.Extensible.Wrapper.Prod f g) instance (Data.Foldable.Foldable g, Data.Foldable.Foldable f) => Data.Foldable.Foldable (Data.Extensible.Wrapper.Prod f g) instance (GHC.Base.Functor g, GHC.Base.Functor f) => GHC.Base.Functor (Data.Extensible.Wrapper.Prod f g) instance forall k (f :: k -> *) (g :: k -> *) (a :: k). GHC.Generics.Generic (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> *) (g :: k -> *) (a :: k). (GHC.Classes.Ord (g a), GHC.Classes.Ord (f a)) => GHC.Classes.Ord (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> *) (g :: k -> *) (a :: k). (GHC.Classes.Eq (g a), GHC.Classes.Eq (f a)) => GHC.Classes.Eq (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> *) (g :: k -> *) (a :: k). (GHC.Show.Show (g a), GHC.Show.Show (f a)) => GHC.Show.Show (Data.Extensible.Wrapper.Prod f g a) instance forall a k (x :: k). Data.Hashable.Class.Hashable a => Data.Hashable.Class.Hashable (Data.Extensible.Wrapper.Const' a x) instance forall a k (x :: k). Test.QuickCheck.Arbitrary.Arbitrary a => Test.QuickCheck.Arbitrary.Arbitrary (Data.Extensible.Wrapper.Const' a x) instance Data.Traversable.Traversable (Data.Extensible.Wrapper.Const' a) instance Data.Foldable.Foldable (Data.Extensible.Wrapper.Const' a) instance GHC.Base.Functor (Data.Extensible.Wrapper.Const' a) instance forall a k (x :: k). GHC.Base.Monoid a => GHC.Base.Monoid (Data.Extensible.Wrapper.Const' a x) instance forall a k (x :: k). Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Data.Extensible.Wrapper.Const' a x) instance forall a k (x :: k). Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Extensible.Wrapper.Const' a x) instance forall a k (x :: k). GHC.Generics.Generic (Data.Extensible.Wrapper.Const' a x) instance forall a k (x :: k). GHC.Classes.Ord a => GHC.Classes.Ord (Data.Extensible.Wrapper.Const' a x) instance forall a k (x :: k). GHC.Classes.Eq a => GHC.Classes.Eq (Data.Extensible.Wrapper.Const' a x) instance forall a k (x :: k). GHC.Show.Show a => GHC.Show.Show (Data.Extensible.Wrapper.Const' a x) instance forall j (f :: j -> *) i (g :: i -> j) (a :: i). Data.Text.Prettyprint.Doc.Internal.Pretty (f (g a)) => Data.Text.Prettyprint.Doc.Internal.Pretty (Data.Extensible.Wrapper.Comp f g a) instance forall j (f :: j -> *) i (g :: i -> j) (a :: i). Data.Hashable.Class.Hashable (f (g a)) => Data.Hashable.Class.Hashable (Data.Extensible.Wrapper.Comp f g a) instance forall j (f :: j -> *) i (g :: i -> j) (a :: i). Test.QuickCheck.Arbitrary.Arbitrary (f (g a)) => Test.QuickCheck.Arbitrary.Arbitrary (Data.Extensible.Wrapper.Comp f g a) instance forall j (f :: j -> *) i (g :: i -> j) (a :: i). GHC.Base.Monoid (f (g a)) => GHC.Base.Monoid (Data.Extensible.Wrapper.Comp f g a) instance forall j (f :: j -> *) i (g :: i -> j) (a :: i). Data.Semigroup.Semigroup (f (g a)) => Data.Semigroup.Semigroup (Data.Extensible.Wrapper.Comp f g a) instance forall j (f :: j -> *) i (g :: i -> j) (a :: i). GHC.Generics.Generic (Data.Extensible.Wrapper.Comp f g a) instance forall j (f :: j -> *) i (g :: i -> j) (a :: i). Control.DeepSeq.NFData (f (g a)) => Control.DeepSeq.NFData (Data.Extensible.Wrapper.Comp f g a) instance forall j (f :: j -> *) i (g :: i -> j) (a :: i). GHC.Classes.Ord (f (g a)) => GHC.Classes.Ord (Data.Extensible.Wrapper.Comp f g a) instance forall j (f :: j -> *) i (g :: i -> j) (a :: i). GHC.Classes.Eq (f (g a)) => GHC.Classes.Eq (Data.Extensible.Wrapper.Comp f g a) instance forall j (f :: j -> *) i (g :: i -> j) (a :: i). GHC.Show.Show (f (g a)) => GHC.Show.Show (Data.Extensible.Wrapper.Comp f g a) instance (GHC.Base.Functor f, GHC.Base.Functor g) => GHC.Base.Functor (Data.Extensible.Wrapper.Comp f g) instance (Data.Foldable.Foldable f, Data.Foldable.Foldable g) => Data.Foldable.Foldable (Data.Extensible.Wrapper.Comp f g) instance (Data.Traversable.Traversable f, Data.Traversable.Traversable g) => Data.Traversable.Traversable (Data.Extensible.Wrapper.Comp f g) instance forall k (f :: k -> *) (a :: k) (g :: k -> *). (Control.DeepSeq.NFData (f a), Control.DeepSeq.NFData (g a)) => Control.DeepSeq.NFData (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> *) (a :: k) (g :: k -> *). (Data.Hashable.Class.Hashable (f a), Data.Hashable.Class.Hashable (g a)) => Data.Hashable.Class.Hashable (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> *) (g :: k -> *). (Data.Extensible.Wrapper.Wrapper f, Data.Extensible.Wrapper.Wrapper g) => Data.Extensible.Wrapper.Wrapper (Data.Extensible.Wrapper.Prod f g) instance forall k (f :: k -> *) (a :: k) (g :: k -> *). (Data.Semigroup.Semigroup (f a), Data.Semigroup.Semigroup (g a)) => Data.Semigroup.Semigroup (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> *) (a :: k) (g :: k -> *). (GHC.Base.Monoid (f a), GHC.Base.Monoid (g a)) => GHC.Base.Monoid (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> *) (a :: k) (g :: k -> *). (Test.QuickCheck.Arbitrary.Arbitrary (f a), Test.QuickCheck.Arbitrary.Arbitrary (g a)) => Test.QuickCheck.Arbitrary.Arbitrary (Data.Extensible.Wrapper.Prod f g a) instance Data.Extensible.Wrapper.Wrapper (Data.Extensible.Wrapper.Const' a) instance forall i j (f :: j -> *) (g :: i -> j) (a :: i). Language.Haskell.TH.Syntax.Lift (f (g a)) => Language.Haskell.TH.Syntax.Lift (Data.Extensible.Wrapper.Comp f g a) instance forall k (f :: * -> *) (g :: k -> *). (GHC.Base.Functor f, Data.Extensible.Wrapper.Wrapper g) => Data.Extensible.Wrapper.Wrapper (Data.Extensible.Wrapper.Comp f g) instance Data.Extensible.Wrapper.Wrapper Data.Functor.Identity.Identity instance Data.Extensible.Wrapper.Wrapper GHC.Base.Maybe instance Data.Extensible.Wrapper.Wrapper (Data.Either.Either e) instance Data.Extensible.Wrapper.Wrapper [] instance Data.Extensible.Wrapper.Wrapper Data.Proxy.Proxy module Data.Extensible.Class -- | This class allows us to use pieceAt for both sums and products. class (Functor f, Profunctor p) => Extensible f p (t :: (k -> *) -> [k] -> *) where { type family ExtensibleConstr t (h :: k -> *) (xs :: [k]) (x :: k) :: Constraint; type ExtensibleConstr t h xs x = (); } pieceAt :: (Extensible f p t, ExtensibleConstr t h xs x) => Membership xs x -> Optic' p f (t h xs) (h x) -- | Accessor for an element. piece :: (x ∈ xs, Extensible f p t, ExtensibleConstr t h xs x) => Optic' p f (t h xs) (h x) -- | Like piece, but reckon membership from its key. pieceAssoc :: (Associate k v xs, Extensible f p t, ExtensibleConstr t h xs (k :> v)) => Optic' p f (t h xs) (h (k :> v)) -- | Access a specified element through a wrapper. itemAt :: (Wrapper h, Extensible f p t, ExtensibleConstr t h xs x) => Membership xs x -> Optic' p f (t h xs) (Repr h x) -- | Access an element through a wrapper. item :: (Wrapper h, Extensible f p t, x ∈ xs, ExtensibleConstr t h xs x) => proxy x -> Optic' p f (t h xs) (Repr h x) -- | Access an element specified by the key type through a wrapper. itemAssoc :: (Wrapper h, Extensible f p t, Associate k v xs, ExtensibleConstr t h xs (k :> v)) => proxy k -> Optic' p f (t h xs) (Repr h (k :> v)) -- | The position of x in the type level set xs. data Membership (xs :: [k]) (x :: k) -- | Generates a Membership that corresponds to the given ordinal -- (0-origin). mkMembership :: Int -> Q Exp -- | get the position as an Int. getMemberId :: Membership xs x -> Int -- | Compare two Memberships. compareMembership :: Membership xs x -> Membership xs y -> Either Ordering (x :~: y) -- | Embodies a type equivalence to ensure that the Membership -- points the first element. leadership :: Membership (y : xs) x -> (x :~: y -> r) -> (Membership xs x -> r) -> r -- | x is a member of xs class Member xs x membership :: Member xs x => Membership xs x -- | Remember that Member xs x from Membership. remember :: forall xs x r. Membership xs x -> (Member xs x => r) -> r -- | Unicode flipped alias for Member type x ∈ xs = Member xs x -- | FindType types -- | Every type-level list is an instance of Generate. class Generate (xs :: [k]) -- | Enumerate all possible Memberships of xs. henumerate :: Generate xs => (forall x. Membership xs x -> r -> r) -> r -> r -- | Count the number of memberships. hcount :: Generate xs => proxy xs -> Int -- | Enumerate Memberships and construct an HList. hgenerateList :: (Generate xs, Applicative f) => (forall x. Membership xs x -> f (h x)) -> f (HList h xs) -- | Every element in xs satisfies c class (ForallF c xs, Generate xs) => Forall (c :: k -> Constraint) (xs :: [k]) -- | Enumerate all possible Memberships of xs with an -- additional context. henumerateFor :: Forall c xs => proxy c -> proxy' xs -> (forall x. c x => Membership xs x -> r -> r) -> r -> r hgenerateListFor :: (Forall c xs, Applicative f) => proxy c -> (forall x. c x => Membership xs x -> f (h x)) -> f (HList h xs) -- | HACK: Without this, the constraints are not propagated well. -- | The kind of key-value pairs data Assoc k v (:>) :: k -> v -> Assoc k v -- | A synonym for (:>) type >: = '(:>) -- | Associate k v xs is essentially identical to (k -- :> v) ∈ xs , but the type v is inferred from -- k and xs. class Associate k v xs | k xs -> v association :: Associate k v xs => Membership xs (k :> v) -- | Find a type associated to the specified key. -- | Make the result more readable -- | A readable type search result data Elaborated k v Expecting :: v -> Elaborated k v Missing :: k -> Elaborated k v Duplicate :: k -> Elaborated k v instance forall k (c :: k -> GHC.Types.Constraint). Data.Extensible.Class.Forall c '[] instance forall a (c :: a -> GHC.Types.Constraint) (x :: a) (xs :: [a]). (c x, Data.Extensible.Class.Forall c xs) => Data.Extensible.Class.Forall c (x : xs) instance Data.Extensible.Class.Generate '[] instance forall k (xs :: [k]) (x :: k). Data.Extensible.Class.Generate xs => Data.Extensible.Class.Generate (x : xs) module Data.Extensible.Sum -- | The extensible sum type -- --
-- (:|) :: (k -> *) -> [k] -> * --data (h :: k -> *) (:|) (s :: [k]) [EmbedAt] :: !(Membership xs x) -> h x -> h :| xs -- | Change the wrapper. hoist :: (forall x. g x -> h x) -> g :| xs -> h :| xs -- | O(1) lift a value. embed :: (x ∈ xs) => h x -> h :| xs -- | Try to extract something you want. strike :: forall h x xs. (x ∈ xs) => h :| xs -> Maybe (h x) -- | Try to extract something you want. strikeAt :: forall h x xs. Membership xs x -> h :| xs -> Maybe (h x) -- | O(1) Naive pattern match (<:|) :: (h x -> r) -> (h :| xs -> r) -> h :| (x : xs) -> r infixr 1 <:| -- | There is no empty union. exhaust :: h :| '[] -> r -- | Embed a value, but focuses on its key. embedAssoc :: Associate k a xs => h (k :> a) -> h :| xs instance forall k (xs :: [k]). GHC.Enum.Enum (Data.Proxy.Proxy Data.Extensible.Sum.:| xs) instance forall k (xs :: [k]). (Data.Extensible.Internal.Last xs Data.Extensible.Internal.∈ xs) => GHC.Enum.Bounded (Data.Proxy.Proxy Data.Extensible.Sum.:| xs) instance (GHC.Base.Applicative f, Data.Profunctor.Choice.Choice p) => Data.Extensible.Class.Extensible f p (Data.Extensible.Sum.:|) -- | Mutable structs module Data.Extensible.Struct -- | Mutable type-indexed struct. data Struct s (h :: k -> *) (xs :: [k]) -- | Write a value in a Struct. set :: PrimMonad m => Struct (PrimState m) h xs -> Membership xs x -> h x -> m () -- | Read a value from a Struct. get :: PrimMonad m => Struct (PrimState m) h xs -> Membership xs x -> m (h x) -- | Create a new Struct using the supplied initializer. new :: forall h m xs. (PrimMonad m, Generate xs) => (forall x. Membership xs x -> h x) -> m (Struct (PrimState m) h xs) -- | Create a Struct full of the specified value. newRepeat :: forall h m xs. (PrimMonad m, Generate xs) => (forall x. h x) -> m (Struct (PrimState m) h xs) -- | Create a new Struct using the supplied initializer with a -- context. newFor :: forall proxy c h m xs. (PrimMonad m, Forall c xs) => proxy c -> (forall x. c x => Membership xs x -> h x) -> m (Struct (PrimState m) h xs) -- | Create a new Struct from an HList. newFromHList :: forall h m xs. PrimMonad m => HList h xs -> m (Struct (PrimState m) h xs) -- | A pointer to an element in a Struct. data WrappedPointer s h a [WrappedPointer] :: !(Struct s h xs) -> !(Membership xs x) -> WrappedPointer s h (Repr h x) -- | Get a WrappedPointer from a name. (-$>) :: forall k h xs v s. (Associate k v xs) => Struct s h xs -> Proxy k -> WrappedPointer s h (Repr h (k :> v)) -- | Atomically modify an element in a Struct. atomicModify :: PrimMonad m => Struct (PrimState m) h xs -> Membership xs x -> (h x -> (h x, a)) -> m a -- | Strict version of atomicModify. atomicModify' :: PrimMonad m => Struct (PrimState m) h xs -> Membership xs x -> (h x -> (h x, a)) -> m a -- | Apply a function to an element atomically. atomicModify_ :: PrimMonad m => Struct (PrimState m) h xs -> Membership xs x -> (h x -> h x) -> m (h x) -- | Strict version of atomicModify_. atomicModify'_ :: PrimMonad m => Struct (PrimState m) h xs -> Membership xs x -> (h x -> h x) -> m (h x) -- | The type of extensible products. -- --
-- (:*) :: (k -> *) -> [k] -> * --data (h :: k -> *) (:*) (s :: [k]) -- | Turn Struct into an immutable product. The original -- Struct may not be used. unsafeFreeze :: PrimMonad m => Struct (PrimState m) h xs -> m (h :* xs) -- | Create a new Struct using the contents of a product. newFrom :: forall g h m xs. (PrimMonad m) => g :* xs -> (forall x. Membership xs x -> g x -> h x) -> m (Struct (PrimState m) h xs) -- | Get an element in a product. hlookup :: Membership xs x -> h :* xs -> h x -- | The size of a product. hlength :: h :* xs -> Int -- | Concatenate type level lists -- | Combine products. happend :: (h :* xs) -> (h :* ys) -> (h :* (xs ++ ys)) -- | Right-associative fold of a product. hfoldrWithIndex :: (forall x. Membership xs x -> h x -> r -> r) -> r -> h :* xs -> r -- | Create a new Struct from a product. thaw :: PrimMonad m => h :* xs -> m (Struct (PrimState m) h xs) -- | Create a product from an ST action which returns a -- Struct. hfrozen :: (forall s. ST s (Struct s h xs)) -> h :* xs -- | Turn a product into a Struct temporarily. hmodify :: (forall s. Struct s h xs -> ST s ()) -> h :* xs -> h :* xs -- | Convert a product into an HList. toHList :: forall h xs. h :* xs -> HList h xs instance (Data.Profunctor.Rep.Corepresentable p, Control.Comonad.Comonad (Data.Profunctor.Rep.Corep p), GHC.Base.Functor f) => Data.Extensible.Class.Extensible f p (Data.Extensible.Struct.:*) instance forall k s (h :: k -> *) a. (s ~ GHC.Prim.RealWorld, Data.Extensible.Wrapper.Wrapper h) => Data.StateVar.HasGetter (Data.Extensible.Struct.WrappedPointer s h a) a instance forall k s (h :: k -> *) a. (s ~ GHC.Prim.RealWorld, Data.Extensible.Wrapper.Wrapper h) => Data.StateVar.HasSetter (Data.Extensible.Struct.WrappedPointer s h a) a instance forall k s (h :: k -> *) a. (s ~ GHC.Prim.RealWorld, Data.Extensible.Wrapper.Wrapper h) => Data.StateVar.HasUpdate (Data.Extensible.Struct.WrappedPointer s h a) a a module Data.Extensible.Product -- | The type of extensible products. -- --
-- (:*) :: (k -> *) -> [k] -> * --data (h :: k -> *) (:*) (s :: [k]) -- | An empty product. nil :: h :* '[] -- | O(n) Prepend an element onto a product. Expressions like a <: b -- <: c <: nil are transformed to a single fromHList. (<:) :: h x -> h :* xs -> h :* (x : xs) infixr 0 <: -- | Strict version of (<:). ( h :* xs -> h :* (x : xs) infixr 0 Int -- | Concatenate type level lists -- | Combine products. happend :: (h :* xs) -> (h :* ys) -> (h :* (xs ++ ys)) -- | Transform every element in a product, preserving the order. -- --
-- hmap id ≡ id -- hmap (f . g) ≡ hmap f . hmap g --hmap :: (forall x. g x -> h x) -> g :* xs -> h :* xs -- | Map a function to every element of a product. hmapWithIndex :: (forall x. Membership xs x -> g x -> h x) -> g :* xs -> h :* xs -- | Map a function to every element of a product. hmapWithIndexFor :: Forall c xs => proxy c -> (forall x. c x => Membership xs x -> g x -> h x) -> g :* xs -> h :* xs -- | zipWith for heterogeneous product hzipWith :: (forall x. f x -> g x -> h x) -> f :* xs -> g :* xs -> h :* xs -- | zipWith3 for heterogeneous product hzipWith3 :: (forall x. f x -> g x -> h x -> i x) -> f :* xs -> g :* xs -> h :* xs -> i :* xs -- | Map elements to a monoid and combine the results. -- --
-- hfoldMap f . hmap g ≡ hfoldMap (f . g) --hfoldMap :: Monoid a => (forall x. h x -> a) -> h :* xs -> a -- | hfoldMap with the membership of elements. hfoldMapWithIndex :: Monoid a => (forall x. Membership xs x -> g x -> a) -> g :* xs -> a -- | Right-associative fold of a product. hfoldrWithIndex :: (forall x. Membership xs x -> h x -> r -> r) -> r -> h :* xs -> r -- | Perform a strict left fold over the elements. hfoldlWithIndex :: (forall x. Membership xs x -> r -> h x -> r) -> r -> h :* xs -> r -- | Traverse all elements and combine the result sequentially. -- htraverse (fmap f . g) ≡ fmap (hmap f) . htraverse g htraverse pure ≡ -- pure htraverse (Comp . fmap g . f) ≡ Comp . fmap (htraverse g) . -- htraverse f htraverse :: Applicative f => (forall x. g x -> f (h x)) -> g :* xs -> f (h :* xs) -- | htraverse with Memberships. htraverseWithIndex :: Applicative f => (forall x. Membership xs x -> g x -> f (h x)) -> g :* xs -> f (h :* xs) -- | sequence analog for extensible products hsequence :: Applicative f => Comp f h :* xs -> f (h :* xs) -- | Constrained hfoldMap hfoldMapFor :: (Forall c xs, Monoid a) => proxy c -> (forall x. c x => h x -> a) -> h :* xs -> a -- | hfoldMapWithIndex with a constraint for each element. hfoldMapWithIndexFor :: (Forall c xs, Monoid a) => proxy c -> (forall x. c x => Membership xs x -> h x -> a) -> h :* xs -> a -- | hfoldrWithIndex with a constraint for each element. hfoldrWithIndexFor :: (Forall c xs) => proxy c -> (forall x. c x => Membership xs x -> h x -> r -> r) -> r -> h :* xs -> r -- | Constrained hfoldlWithIndex hfoldlWithIndexFor :: (Forall c xs) => proxy c -> (forall x. c x => Membership xs x -> r -> h x -> r) -> r -> h :* xs -> r -- | Evaluate every element in a product. hforce :: h :* xs -> h :* xs -- | Accumulate sums on a product. haccumMap :: Foldable f => (a -> g :| xs) -> (forall x. Membership xs x -> g x -> h x -> h x) -> h :* xs -> f a -> h :* xs -- |
-- haccum = haccumMap id --haccum :: Foldable f => (forall x. Membership xs x -> g x -> h x -> h x) -> h :* xs -> f (g :| xs) -> h :* xs -- | Group sums by type. hpartition :: (Foldable f, Generate xs) => (a -> h :| xs) -> f a -> Comp [] h :* xs -- | Get an element in a product. hlookup :: Membership xs x -> h :* xs -> h x -- | Flipped hlookup hindex :: h :* xs -> Membership xs x -> h x -- | Every type-level list is an instance of Generate. class Generate (xs :: [k]) -- | Enumerate all possible Memberships of xs. henumerate :: Generate xs => (forall x. Membership xs x -> r -> r) -> r -> r -- | Count the number of memberships. hcount :: Generate xs => proxy xs -> Int -- | Enumerate Memberships and construct an HList. hgenerateList :: (Generate xs, Applicative f) => (forall x. Membership xs x -> f (h x)) -> f (HList h xs) -- | Applicative version of htabulate. hgenerate :: (Generate xs, Applicative f) => (forall x. Membership xs x -> f (h x)) -> f (h :* xs) -- | Construct a product using a function which takes a Membership. -- --
-- hmap f (htabulate g) ≡ htabulate (f . g) -- htabulate (hindex m) ≡ m -- hindex (htabulate k) ≡ k --htabulate :: Generate xs => (forall x. Membership xs x -> h x) -> h :* xs -- | A product filled with the specified value. hrepeat :: Generate xs => (forall x. h x) -> h :* xs -- | The dual of htraverse hcollect :: (Functor f, Generate xs) => (a -> h :* xs) -> f a -> Comp f h :* xs -- | The dual of hsequence hdistribute :: (Functor f, Generate xs) => f (h :* xs) -> Comp f h :* xs -- | Convert HList into a product. fromHList :: HList h xs -> h :* xs -- | Convert a product into an HList. toHList :: forall h xs. h :* xs -> HList h xs -- | Every element in xs satisfies c class (ForallF c xs, Generate xs) => Forall (c :: k -> Constraint) (xs :: [k]) -- | Enumerate all possible Memberships of xs with an -- additional context. henumerateFor :: Forall c xs => proxy c -> proxy' xs -> (forall x. c x => Membership xs x -> r -> r) -> r -> r hgenerateListFor :: (Forall c xs, Applicative f) => proxy c -> (forall x. c x => Membership xs x -> f (h x)) -> f (HList h xs) -- | Applicative version of htabulateFor. hgenerateFor :: (Forall c xs, Applicative f) => proxy c -> (forall x. c x => Membership xs x -> f (h x)) -> f (h :* xs) -- | Pure version of hgenerateFor. htabulateFor :: Forall c xs => proxy c -> (forall x. c x => Membership xs x -> h x) -> h :* xs -- | A product filled with the specified value. hrepeatFor :: Forall c xs => proxy c -> (forall x. c x => h x) -> h :* xs module Data.Extensible.Plain -- | Alias for plain products type AllOf xs = Identity :* xs -- | Alias for plain sums type OneOf xs = Identity :| xs -- | O(log n) Add a plain value to a product. (<%) :: x -> AllOf xs -> AllOf (x : xs) infixr 5 <% -- | Extract a plain value. pluck :: (x ∈ xs) => AllOf xs -> x -- | Embed a plain value. bury :: (x ∈ xs) => x -> OneOf xs -- | Naive pattern matching for a plain value. (<%|) :: (x -> r) -> (OneOf xs -> r) -> OneOf (x : xs) -> r infixr 1 <%| -- | An accessor for newtype constructors. accessing :: (Coercible x a, x ∈ xs, Extensible f p t, ExtensibleConstr t Identity xs x) => (a -> x) -> Optic' p f (t Identity xs) a -- | Pattern matching module Data.Extensible.Match -- | Retrieve the contents so that they matches and pass both to the given -- function. matchWith :: (forall x. f x -> g x -> r) -> f :* xs -> g :| xs -> r -- | Turn a wrapper type into a clause for it. newtype Match h r x Match :: (h x -> r) -> Match h r x [runMatch] :: Match h r x -> h x -> r -- | O(1) Perform pattern matching. match :: Match h a :* xs -> h :| xs -> a -- | Applies a function to the result of Match. mapMatch :: (a -> b) -> Match h a x -> Match h b x -- | Flipped match caseOf :: h :| xs -> Match h a :* xs -> a infix 0 `caseOf` instance forall k (h :: k -> *) r (x :: k). GHC.Base.Monoid r => GHC.Base.Monoid (Data.Extensible.Match.Match h r x) instance forall k (h :: k -> *) r (x :: k). Data.Semigroup.Semigroup r => Data.Semigroup.Semigroup (Data.Extensible.Match.Match h r x) instance forall k (h :: k -> *) r (x :: k). GHC.Generics.Generic (Data.Extensible.Match.Match h r x) instance forall k (h :: k -> *) r. Data.Extensible.Wrapper.Wrapper h => Data.Extensible.Wrapper.Wrapper (Data.Extensible.Match.Match h r) module Data.Extensible.Inclusion -- | Unicode alias for Include type xs ⊆ ys = Include ys xs -- | ys contains xs type Include ys = Forall (Member ys) -- | Reify the inclusion of type level sets. inclusion :: forall xs ys. Include ys xs => Membership ys :* xs -- | O(n) Select some elements. shrink :: (xs ⊆ ys) => h :* ys -> h :* xs -- | O(1) Embed to a larger union. spread :: (xs ⊆ ys) => h :| xs -> h :| ys -- | Similar to Include, but this focuses on keys. type IncludeAssoc ys = Forall (Associated ys) -- | Associated xs (k ':> v) is equivalent to -- Associate k v xs class Associated' xs t => Associated xs t -- | Reify the inclusion of type level sets. inclusionAssoc :: forall xs ys. IncludeAssoc ys xs => Membership ys :* xs -- | O(n) Select some elements. shrinkAssoc :: (IncludeAssoc ys xs) => h :* ys -> h :* xs -- | O(1) Embed to a larger union. spreadAssoc :: (IncludeAssoc ys xs) => h :| xs -> h :| ys instance forall k1 v1 (xs :: [Data.Extensible.Internal.Assoc k1 v1]) (t :: Data.Extensible.Internal.Assoc k1 v1) (k2 :: k1) (v2 :: v1). (Data.Extensible.Inclusion.Associated' xs t, t ~ (k2 'Data.Extensible.Internal.:> v2)) => Data.Extensible.Inclusion.Associated xs t module Data.Extensible.Nullable -- | A product filled with Nullable Nothing vacancy :: Generate xs => Nullable h :* xs -- | The inverse of inclusion. coinclusion :: (Include ys xs, Generate ys) => Nullable (Membership xs) :* ys -- | Extend a product and fill missing fields by Null. wrench :: (Generate ys, xs ⊆ ys) => h :* xs -> Nullable h :* ys -- | Narrow the range of the sum, if possible. retrench :: (Generate ys, xs ⊆ ys) => h :| ys -> Nullable ((:|) h) xs -- | Wrapped Maybe newtype Nullable h x Nullable :: Maybe (h x) -> Nullable h x [getNullable] :: Nullable h x -> Maybe (h x) -- | Apply a function to its content. mapNullable :: (g x -> h y) -> Nullable g x -> Nullable h y instance forall k (h :: k -> *) (x :: k). Data.Hashable.Class.Hashable (h x) => Data.Hashable.Class.Hashable (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> *) (x :: k). Test.QuickCheck.Arbitrary.Arbitrary (h x) => Test.QuickCheck.Arbitrary.Arbitrary (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> *) (x :: k). Control.DeepSeq.NFData (h x) => Control.DeepSeq.NFData (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> *) (x :: k). GHC.Generics.Generic (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> *) (x :: k). GHC.Classes.Ord (h x) => GHC.Classes.Ord (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> *) (x :: k). GHC.Classes.Eq (h x) => GHC.Classes.Eq (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> *) (x :: k). GHC.Show.Show (h x) => GHC.Show.Show (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> *). Data.Extensible.Wrapper.Wrapper h => Data.Extensible.Wrapper.Wrapper (Data.Extensible.Nullable.Nullable h) instance forall k (h :: k -> *) (x :: k). Data.Semigroup.Semigroup (h x) => Data.Semigroup.Semigroup (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> *) (x :: k). Data.Semigroup.Semigroup (h x) => GHC.Base.Monoid (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> *) (a :: k). Language.Haskell.TH.Syntax.Lift (h a) => Language.Haskell.TH.Syntax.Lift (Data.Extensible.Nullable.Nullable h a) -- | Flexible records and variants module Data.Extensible.Field -- | A Field h (k ':> v) is h v annotated with -- the field name k. -- --
-- Field :: (v -> *) -> Assoc k v -> * --newtype Field (h :: v -> Type) (kv :: Assoc k v) Field :: h (AssocValue kv) -> Field [getField] :: Field -> h (AssocValue kv) -- | Annotate a value by the field name. -- --
-- foo :: Record '["num" >: Int, "str" >: String] -- foo = #num = 42 -- <: #str = "foo" -- <: nil --(@=) :: Wrapper h => FieldName k -> Repr h v -> Field h (k :> v) infix 1 @= -- | Lifted (@=) foo :: IO (Record '["num" >: Int, -- "str" >: String]) foo = hsequence $ #num <=> readLn -- #str <@= getLine <: nil @ (<@=>) :: (Functor f, Wrapper h) => FieldName k -> f (Repr h v) -> Comp f (Field h) (k :> v) infix 1 <@=> -- | Annotate a value by the field name without Wrapper. (@:>) :: FieldName k -> h v -> Field h (k :> v) infix 1 @:> -- | Kind-monomorphic, unwrapped version of ('=')@ (@==) :: FieldName (k :: Symbol) -> v -> Field Identity (k :> v) infix 1 @== -- | FieldOptic s is a type of optics that points a -- field/constructor named s. -- -- The yielding fields can be Lenses for Records and -- Prisms for Variants. -- --
-- FieldOptic "foo" = Associate "foo" a xs => Lens' (Record xs) a -- FieldOptic "foo" = Associate "foo" a xs => Prism' (Variant xs) a ---- -- FieldOptics can be generated using mkField defined in -- the Data.Extensible.TH module. type FieldOptic k = forall kind. forall f p t xs (h :: kind -> Type) (v :: kind). (Extensible f p t, ExtensibleConstr t (Field h) xs (k :> v), Associate k v xs, Labelling k p, Wrapper h) => Optic' p f (t (Field h) xs) (Repr h v) -- | When you see this type as an argument, it expects a -- FieldLens. This type is used to resolve the name of the field -- internally. type FieldName k = Optic' (LabelPhantom k) Proxy (Inextensible (Field Proxy) '[k :> ()]) () -- | Lift a function for the content. liftField :: (g (AssocValue kv) -> h (AssocValue kv)) -> Field g kv -> Field h kv -- | Lift a function for the content. liftField2 :: (f (AssocValue kv) -> g (AssocValue kv) -> h (AssocValue kv)) -> Field f kv -> Field g kv -> Field h kv -- | The type of records which contain several fields. -- --
-- RecordOf :: (v -> *) -> [Assoc k v] -> * --type RecordOf h = (:*) (Field h) -- | Simple record type Record = RecordOf Identity -- | An empty Record. emptyRecord :: Record '[] -- | The dual of RecordOf -- --
-- VariantOf :: (v -> *) -> [Assoc k v] -> * --type VariantOf h = (:|) (Field h) -- | Simple variant type Variant = VariantOf Identity -- | Select a corresponding field of a variant. matchWithField :: (forall x. f x -> g x -> r) -> RecordOf f xs -> VariantOf g xs -> r -- | Pattern matching on a Variant matchField :: RecordOf (Match h r) xs -> VariantOf h xs -> r -- | Take the type of the key -- | Take the type of the value -- | Combined constraint for Assoc class (pk (AssocKey kv), pv (AssocValue kv)) => KeyValue pk pv kv -- | Proxy-level AssocKey. This is useful when using -- symbolVal. proxyAssocKey :: proxy kv -> Proxy (AssocKey kv) -- | Proxy-level AssocValue. proxyAssocValue :: proxy kv -> Proxy (AssocValue kv) -- | Get a string from a proxy of Assoc Symbol v. stringAssocKey :: (IsString a, KnownSymbol (AssocKey kv)) => proxy kv -> a -- | Constraint applied to AssocKey class (pk (AssocKey kv)) => KeyIs pk kv -- | Constraint applied to AssocValue class (pv (AssocValue kv)) => ValueIs pv kv -- | A ghostly type which spells the field name data LabelPhantom s a b -- | Signifies a field name internally -- | The trivial inextensible data type data Inextensible (h :: k -> Type) (xs :: [k]) instance forall v (h :: v -> *) k (kv :: Data.Extensible.Internal.Assoc k v). GHC.Generics.Generic (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Classes.Eq (h (Data.Extensible.Field.AssocValue kv)) => GHC.Classes.Eq (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Classes.Ord (h (Data.Extensible.Field.AssocValue kv)) => GHC.Classes.Ord (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Num.Num (h (Data.Extensible.Field.AssocValue kv)) => GHC.Num.Num (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Real.Integral (h (Data.Extensible.Field.AssocValue kv)) => GHC.Real.Integral (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Real.Fractional (h (Data.Extensible.Field.AssocValue kv)) => GHC.Real.Fractional (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Float.Floating (h (Data.Extensible.Field.AssocValue kv)) => GHC.Float.Floating (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Real.Real (h (Data.Extensible.Field.AssocValue kv)) => GHC.Real.Real (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Float.RealFloat (h (Data.Extensible.Field.AssocValue kv)) => GHC.Float.RealFloat (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Real.RealFrac (h (Data.Extensible.Field.AssocValue kv)) => GHC.Real.RealFrac (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). Data.Semigroup.Semigroup (h (Data.Extensible.Field.AssocValue kv)) => Data.Semigroup.Semigroup (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). Foreign.Storable.Storable (h (Data.Extensible.Field.AssocValue kv)) => Foreign.Storable.Storable (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Base.Monoid (h (Data.Extensible.Field.AssocValue kv)) => GHC.Base.Monoid (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Enum.Enum (h (Data.Extensible.Field.AssocValue kv)) => GHC.Enum.Enum (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). GHC.Enum.Bounded (h (Data.Extensible.Field.AssocValue kv)) => GHC.Enum.Bounded (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). Control.DeepSeq.NFData (h (Data.Extensible.Field.AssocValue kv)) => Control.DeepSeq.NFData (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). Test.QuickCheck.Arbitrary.Arbitrary (h (Data.Extensible.Field.AssocValue kv)) => Test.QuickCheck.Arbitrary.Arbitrary (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). Data.Hashable.Class.Hashable (h (Data.Extensible.Field.AssocValue kv)) => Data.Hashable.Class.Hashable (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). Data.Csv.Conversion.FromField (h (Data.Extensible.Field.AssocValue kv)) => Data.Csv.Conversion.FromField (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). Data.Csv.Conversion.ToField (h (Data.Extensible.Field.AssocValue kv)) => Data.Csv.Conversion.ToField (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). Data.Aeson.Types.FromJSON.FromJSON (h (Data.Extensible.Field.AssocValue kv)) => Data.Aeson.Types.FromJSON.FromJSON (Data.Extensible.Field.Field h kv) instance forall k v (h :: v -> *) (kv :: Data.Extensible.Internal.Assoc k v). Data.Aeson.Types.ToJSON.ToJSON (h (Data.Extensible.Field.AssocValue kv)) => Data.Aeson.Types.ToJSON.ToJSON (Data.Extensible.Field.Field h kv) instance forall k (s :: k). Data.Profunctor.Unsafe.Profunctor (Data.Extensible.Field.LabelPhantom s) instance (GHC.Base.Functor f, Data.Profunctor.Unsafe.Profunctor p) => Data.Extensible.Class.Extensible f p Data.Extensible.Field.Inextensible instance forall k v (h :: v -> *) (x :: Data.Extensible.Internal.Assoc k v). Data.Vector.Unboxed.Base.Unbox (h (Data.Extensible.Field.AssocValue x)) => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Data.Extensible.Field.Field h x) instance forall k v (h :: v -> *) (x :: Data.Extensible.Internal.Assoc k v). Data.Vector.Unboxed.Base.Unbox (h (Data.Extensible.Field.AssocValue x)) => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Data.Extensible.Field.Field h x) instance forall k v (h :: v -> *) (x :: Data.Extensible.Internal.Assoc k v). Data.Vector.Unboxed.Base.Unbox (h (Data.Extensible.Field.AssocValue x)) => Data.Vector.Unboxed.Base.Unbox (Data.Extensible.Field.Field h x) instance forall k v (h :: v -> *) (x :: Data.Extensible.Internal.Assoc k v). Language.Haskell.TH.Syntax.Lift (h (Data.Extensible.Field.AssocValue x)) => Language.Haskell.TH.Syntax.Lift (Data.Extensible.Field.Field h x) instance forall k v (h :: v -> *). Data.Extensible.Wrapper.Wrapper h => Data.Extensible.Wrapper.Wrapper (Data.Extensible.Field.Field h) instance forall v1 (k :: GHC.Types.Symbol) (h :: v1 -> *) (v2 :: v1). (GHC.TypeLits.KnownSymbol k, Data.Extensible.Wrapper.Wrapper h, GHC.Show.Show (Data.Extensible.Wrapper.Repr h v2)) => GHC.Show.Show (Data.Extensible.Field.Field h (k 'Data.Extensible.Internal.:> v2)) instance forall v1 (k :: GHC.Types.Symbol) (h :: v1 -> *) (v2 :: v1). (GHC.TypeLits.KnownSymbol k, Data.Text.Prettyprint.Doc.Internal.Pretty (h v2)) => Data.Text.Prettyprint.Doc.Internal.Pretty (Data.Extensible.Field.Field h (k 'Data.Extensible.Internal.:> v2)) instance forall k1 v1 (pv :: v1 -> GHC.Types.Constraint) (v2 :: v1) (k2 :: k1). pv v2 => Data.Extensible.Field.ValueIs pv (k2 'Data.Extensible.Internal.:> v2) instance forall v1 k1 (pk :: k1 -> GHC.Types.Constraint) (k2 :: k1) (v2 :: v1). pk k2 => Data.Extensible.Field.KeyIs pk (k2 'Data.Extensible.Internal.:> v2) instance forall v1 k1 (pk :: k1 -> GHC.Types.Constraint) (k2 :: k1) (pv :: v1 -> GHC.Types.Constraint) (v2 :: v1). (pk k2, pv v2) => Data.Extensible.Field.KeyValue pk pv (k2 'Data.Extensible.Internal.:> v2) -- | Extensible tangles module Data.Extensible.Tangle -- | TangleT h xs m is the monad of computations that may -- depend on the elements in xs. newtype TangleT h xs m a TangleT :: RWST (Comp (TangleT h xs m) h :* xs) () (Nullable h :* xs) m a -> TangleT h xs m a [unTangleT] :: TangleT h xs m a -> RWST (Comp (TangleT h xs m) h :* xs) () (Nullable h :* xs) m a -- | Hitch an element associated to the FieldName through a wrapper. lasso :: forall k v m h xs. (Monad m, Associate k v xs, Wrapper h) => FieldName k -> TangleT h xs m (Repr h (k :> v)) -- | Take a value from the tangles. The result is memoized. hitchAt :: Monad m => Membership xs x -> TangleT h xs m (h x) -- | Run a TangleT action and return the result and the calculated -- values. runTangleT :: Monad m => Comp (TangleT h xs m) h :* xs -> Nullable h :* xs -> TangleT h xs m a -> m (a, Nullable h :* xs) -- | Run a TangleT action. evalTangleT :: Monad m => Comp (TangleT h xs m) h :* xs -> Nullable h :* xs -> TangleT h xs m a -> m a -- | Run tangles and collect all the results as a Record. runTangles :: Monad m => Comp (TangleT h xs m) h :* xs -> Nullable h :* xs -> m (h :* xs) instance forall k (h :: k -> *) (xs :: [k]) (m :: * -> *). GHC.Base.Monad m => GHC.Base.Monad (Data.Extensible.Tangle.TangleT h xs m) instance forall k (h :: k -> *) (xs :: [k]) (m :: * -> *). GHC.Base.Monad m => GHC.Base.Applicative (Data.Extensible.Tangle.TangleT h xs m) instance forall k (h :: k -> *) (xs :: [k]) (m :: * -> *). GHC.Base.Functor m => GHC.Base.Functor (Data.Extensible.Tangle.TangleT h xs m) instance forall k (h :: k -> *) (xs :: [k]). Control.Monad.Trans.Class.MonadTrans (Data.Extensible.Tangle.TangleT h xs) instance forall k (m :: * -> *) a (h :: k -> *) (xs :: [k]). (GHC.Base.Monad m, Data.Semigroup.Semigroup a) => Data.Semigroup.Semigroup (Data.Extensible.Tangle.TangleT h xs m a) instance forall k (m :: * -> *) a (h :: k -> *) (xs :: [k]). (GHC.Base.Monad m, GHC.Base.Monoid a) => GHC.Base.Monoid (Data.Extensible.Tangle.TangleT h xs m a) -- | Bidirectional conversion from/to records module Data.Extensible.Record -- | The class of types that can be converted to/from a Record. class IsRecord a where { type family RecFields a :: [Assoc Symbol *]; } recordFromList :: IsRecord a => HList (Field Identity) (RecFields a) -> a recordToList :: IsRecord a => a -> HList (Field Identity) (RecFields a) -- | Convert a value into a Record. toRecord :: IsRecord a => a -> Record (RecFields a) -- | Convert a Record to a value. fromRecord :: IsRecord a => Record (RecFields a) -> a -- |
-- record :: IsRecord a => Iso' a (Record (RecFields a)) --record :: (IsRecord a, Functor f, Profunctor p) => Optic' p f a (Record (RecFields a)) -- | Create an IsRecord instance for a normal record declaration. deriveIsRecord :: Name -> DecsQ instance Data.Extensible.Record.IsRecord () -- | Experimental API for OverloadedLabels. GHC 8.0+ only module Data.Extensible.Label -- | Specialised version of itemAssoc. 訊 :: Proxy k -> FieldOptic k instance k ~ l => GHC.OverloadedLabels.IsLabel k (Data.Proxy.Proxy l) instance forall v1 (f :: * -> *) (p :: * -> * -> *) (e :: (Data.Extensible.Internal.Assoc GHC.Types.Symbol v1 -> *) -> [Data.Extensible.Internal.Assoc GHC.Types.Symbol v1] -> *) (k :: GHC.Types.Symbol) (v2 :: v1) (xs :: [Data.Extensible.Internal.Assoc GHC.Types.Symbol v1]) (h :: v1 -> *) rep s t rep'. (Data.Extensible.Class.Extensible f p e, Data.Extensible.Internal.Associate k v2 xs, Data.Extensible.Field.Labelling k p, Data.Extensible.Wrapper.Wrapper h, Data.Extensible.Class.ExtensibleConstr e (Data.Extensible.Field.Field h) xs (k 'Data.Extensible.Internal.:> v2), rep ~ Data.Extensible.Wrapper.Repr h v2, s ~ e (Data.Extensible.Field.Field h) xs, s ~ t, rep ~ rep') => GHC.OverloadedLabels.IsLabel k (p rep (f rep') -> p s (f t)) -- | A wrapper for GetOpt. -- -- See also: GetOpt and extensible records - School of Haskell module Data.Extensible.GetOpt -- | OptDescr with a default data OptionDescr h a OptionDescr :: (s -> h a) -> !s -> (OptDescr (s -> s)) -> OptionDescr h a -- | Simple option descriptor type OptDescr' = OptionDescr Identity -- | Parse option arguments. getOptRecord :: RecordOf (OptionDescr h) xs -> [String] -> (RecordOf h xs, [String], [String], String -> String) -- | An all-in-one utility function. When there's an error, print it along -- with the usage info to stderr and terminate with exitFailure. withGetOpt :: MonadIO m => String -> RecordOf (OptionDescr h) xs -> (RecordOf h xs -> [String] -> m a) -> m a -- | True when specified optFlag :: [Char] -> [String] -> String -> OptDescr' Bool -- | Takes the last argument when more than one is specified. optLastArg :: [Char] -> [String] -> String -> String -> OptDescr' (Maybe String) -- | Option without an argument; the result is the total count of this -- option. optNoArg :: [Char] -> [String] -> String -> OptDescr' Int -- | Option with an argument optReqArg :: [Char] -> [String] -> String -> String -> OptDescr' [String] -- | Wrapper-generic version of optNoArg optionNoArg :: (Int -> h a) -> [Char] -> [String] -> String -> OptionDescr h a -- | Wrapper-generic version of optReqArg optionReqArg :: ([String] -> h a) -> [Char] -> [String] -> String -> String -> OptionDescr h a -- | Construct an option with an optional argument optionOptArg :: ([Maybe String] -> h a) -> [Char] -> [String] -> String -> String -> OptionDescr h a instance GHC.Base.Functor h => GHC.Base.Functor (Data.Extensible.GetOpt.OptionDescr h) instance forall k (h :: k -> *). Data.Extensible.Wrapper.Wrapper (Data.Extensible.GetOpt.OptionDescr h) -- | Name-based extensible effects module Data.Extensible.Effect -- | A unit of named effects. This is a variant of (:|) -- specialised for 'Type -> Type'. data Instruction (xs :: [Assoc k (* -> *)]) a [Instruction] :: !(Membership xs kv) -> AssocValue kv a -> Instruction xs a -- | The extensible operational monad type Eff xs = Skeleton (Instruction xs) -- | Lift an instruction onto an Eff action. liftEff :: forall s t xs a. Associate s t xs => Proxy s -> t a -> Eff xs a -- | Lift an instruction onto an Eff action and apply a function to -- the result. liftsEff :: forall s t xs a r. Associate s t xs => Proxy s -> t a -> (a -> r) -> Eff xs r -- | Censor a specific type of effects in an action. hoistEff :: forall s t xs a. Associate s t xs => Proxy s -> (forall x. t x -> t x) -> Eff xs a -> Eff xs a -- | Upcast an action. castEff :: IncludeAssoc ys xs => Eff xs a -> Eff ys a -- | Transformation between effects newtype Interpreter f g Interpreter :: (forall a. g a -> f a) -> Interpreter f g [runInterpreter] :: Interpreter f g -> forall a. g a -> f a -- | Process an Eff action using a record of Interpreters. handleEff :: RecordOf (Interpreter m) xs -> Eff xs a -> MonadView m (Eff xs) a -- | Build a relay-style handler from a triple of functions. -- --
-- runStateEff = peelEff1 (a s -> return (a, s)) -- (m k s -> let (a, s') = runState m s in k a s') --peelEff :: forall k t xs a r. Rebinder xs r -> (a -> r) -> (forall x. t x -> (x -> r) -> r) -> Eff ((k >: t) : xs) a -> r -- | A function to bind an Instruction in peelEff. type Rebinder xs r = forall x. Instruction xs x -> (x -> r) -> r -- | A common value for the second argument of peelEff. Binds an -- instruction directly. rebindEff0 :: Rebinder xs (Eff xs r) -- | peelEff specialised for continuations with no argument peelEff0 :: forall k t xs a r. (a -> Eff xs r) -> (forall x. t x -> (x -> Eff xs r) -> Eff xs r) -> Eff ((k >: t) : xs) a -> Eff xs r -- | A pre-defined value for the second argument of peelEff. -- Preserves the argument of the continuation. rebindEff1 :: Rebinder xs (a -> Eff xs r) -- | peelEff specialised for 1-argument continuation peelEff1 :: forall k t xs a b r. (a -> b -> Eff xs r) -> (forall x. t x -> (x -> b -> Eff xs r) -> b -> Eff xs r) -> Eff ((k >: t) : xs) a -> b -> Eff xs r -- | A pre-defined value for the second argument of peelEff. -- Preserves two arguments of the continuation. rebindEff2 :: Rebinder xs (a -> b -> Eff xs r) -- | Reveal the final result of Eff. leaveEff :: Eff '[] a -> a -- | Tear down an action using the Monad instance of the -- instruction. retractEff :: forall k m a. Monad m => Eff '[k >: m] a -> m a -- | Anonymous representation of instructions. data Action (args :: [*]) a r [AResult] :: Action '[] a a [AArgument] :: x -> Action xs a r -> Action (x : xs) a r -- | Function [a, b, c] r is a -> b -> c -> -- r -- | Pass the arguments of Action to the supplied function. runAction :: Function xs (f a) -> Action xs a r -> f r -- | Create a Field of a Interpreter for an Action. (@!?) :: FieldName k -> Function xs (f a) -> Field (Interpreter f) (k :> Action xs a) infix 1 @!? -- | Specialised version of peelEff for Actions. You can pass -- a function a -> b -> ... -> (q -> r) -> r as a -- handler for Action '[a, b, ...] q. peelAction :: forall k ps q xs a r. (forall x. Instruction xs x -> (x -> r) -> r) -> (a -> r) -> Function ps ((q -> r) -> r) -> Eff ((k >: Action ps q) : xs) a -> r -- | Non continuation-passing variant of peelAction. peelAction0 :: forall k ps q xs a. Function ps (Eff xs q) -> Eff ((k >: Action ps q) : xs) a -> Eff xs a -- | The reader monad is characterised by a type equality between the -- result type and the enviroment type. type ReaderEff = (:~:) -- | Fetch the environment. askEff :: forall k r xs. Associate k (ReaderEff r) xs => Proxy k -> Eff xs r -- | Pass the environment to a function. asksEff :: forall k r xs a. Associate k (ReaderEff r) xs => Proxy k -> (r -> a) -> Eff xs a -- | Modify the enviroment locally. localEff :: forall k r xs a. Associate k (ReaderEff r) xs => Proxy k -> (r -> r) -> Eff xs a -> Eff xs a -- | Run the frontal reader effect. runReaderEff :: forall k r xs a. Eff ((k >: ReaderEff r) : xs) a -> r -> Eff xs a -- | A state monad parameterized by the type s of the state to -- carry. -- -- The return function leaves the state unchanged, while -- >>= uses the final state of the first computation as -- the initial state of the second. type State s = StateT s Identity -- | Get the current state. getEff :: forall k s xs. Associate k (State s) xs => Proxy k -> Eff xs s -- | Pass the current state to a function. getsEff :: forall k s a xs. Associate k (State s) xs => Proxy k -> (s -> a) -> Eff xs a -- | Replace the state with a new value. putEff :: forall k s xs. Associate k (State s) xs => Proxy k -> s -> Eff xs () -- | Modify the state. modifyEff :: forall k s xs. Associate k (State s) xs => Proxy k -> (s -> s) -> Eff xs () -- | Lift a state modification function. stateEff :: forall k s xs a. Associate k (State s) xs => Proxy k -> (s -> (a, s)) -> Eff xs a -- | Run the frontal state effect. runStateEff :: forall k s xs a. Eff ((k >: State s) : xs) a -> s -> Eff xs (a, s) -- | Run the frontal state effect and return the final state. execStateEff :: forall k s xs a. Eff ((k >: State s) : xs) a -> s -> Eff xs s -- | Run the frontal state effect and return the final result. evalStateEff :: forall k s xs a. Eff ((k >: State s) : xs) a -> s -> Eff xs a -- | (,) already is a writer monad. type WriterEff w = (,) w -- | Write the second element and return the first element. writerEff :: forall k w xs a. (Associate k (WriterEff w) xs) => Proxy k -> (a, w) -> Eff xs a -- | Write a value. tellEff :: forall k w xs. (Associate k (WriterEff w) xs) => Proxy k -> w -> Eff xs () -- | Squash the outputs into one step and return it. listenEff :: forall k w xs a. (Associate k (WriterEff w) xs, Monoid w) => Proxy k -> Eff xs a -> Eff xs (a, w) -- | Modify the output using the function in the result. passEff :: forall k w xs a. (Associate k (WriterEff w) xs, Monoid w) => Proxy k -> Eff xs (a, w -> w) -> Eff xs a -- | Run the frontal writer effect. runWriterEff :: forall k w xs a. Monoid w => Eff ((k >: WriterEff w) : xs) a -> Eff xs (a, w) -- | Run the frontal state effect. execWriterEff :: forall k w xs a. Monoid w => Eff ((k >: WriterEff w) : xs) a -> Eff xs w -- | An effect with no result type MaybeEff = Const () -- | Break out of the computation. Similar to Nothing. nothingEff :: Associate k MaybeEff xs => Proxy k -> Eff xs a -- | Run an effect which may fail in the name of k. runMaybeEff :: forall k xs a. Eff ((k >: MaybeEff) : xs) a -> Eff xs (Maybe a) -- | Throwing an exception type EitherEff = Const -- | Throw an exception e, throwing the rest of the computation -- away. throwEff :: Associate k (EitherEff e) xs => Proxy k -> e -> Eff xs a -- | Attach a handler for an exception. catchEff :: forall k e xs a. (Associate k (EitherEff e) xs) => Proxy k -> Eff xs a -> (e -> Eff xs a) -> Eff xs a -- | Run an action and abort on throwEff. runEitherEff :: forall k e xs a. Eff ((k >: EitherEff e) : xs) a -> Eff xs (Either e a) -- | Identity functor and monad. (a non-strict monad) data Identity a :: * -> * -- | Put a milestone on a computation. tickEff :: Associate k Identity xs => Proxy k -> Eff xs () -- | Run a computation until the first call of tickEff. runIterEff :: Eff ((k >: Identity) : xs) a -> Eff xs (Either a (Eff ((k >: Identity) : xs) a)) -- | The continuation monad transformer. Can be used to add continuation -- handling to any type constructor: the Monad instance and most -- of the operations do not require m to be a monad. -- -- ContT is not a functor on the category of monads, and many -- operations cannot be lifted through it. data ContT k (r :: k) (m :: k -> *) a :: forall k. () => k -> (k -> *) -> * -> * -- | Place a continuation-passing action. contEff :: Associate k (ContT r m) xs => Proxy k -> ((a -> m r) -> m r) -> Eff xs a -- | Unwrap a continuation. runContEff :: forall k r xs a. Eff ((k >: ContT r (Eff xs)) : xs) a -> (a -> Eff xs r) -> Eff xs r module Data.Extensible.TH -- | Generate fields using itemAssoc. mkField "foo -- Bar" defines: -- --
-- foo :: FieldOptic "foo" -- foo = itemAssoc (Proxy :: Proxy "foo") -- _Bar :: FieldOptic Bar -- _Bar = itemAssoc (Proxy :: Proxy Bar) --mkField :: String -> DecsQ -- | mkFieldAs (mkName "foo") "bar" defines a field for -- "bar" as foo. mkFieldAs :: Name -> String -> DecsQ -- | Generate named effects from a GADT declaration. -- --
-- decEffects [d| -- data Blah a b x where -- Blah :: Int -> a -> Blah a b b -- |] ---- -- generates -- --
-- type Blah a b = "Blah" >: Action '[Int, a] b -- blah :: forall xs a b -- . Associate "Blah" (Action '[Int, a] b) xs -- => Int -> a -> Eff xs b -- blah a0 a1 -- = liftEff -- (Data.Proxy.Proxy :: Data.Proxy.Proxy "Blah") -- (AArgument a0 (AArgument a1 AResult)) --decEffects :: DecsQ -> DecsQ -- | Instead of making a type synonym for individual actions, it defines a -- list of actions. decEffectSet :: DecsQ -> DecsQ -- | Generates type synonyms for the set of actions and also individual -- actions. decEffectSuite :: DecsQ -> DecsQ -- | Generate effect suite with custom settings. customDecEffects :: Bool -> Bool -> DecsQ -> DecsQ -- | Default monad runners and MonadIO, MonadReader, -- MonadWriter, MonadState, MonadError instances module Data.Extensible.Effect.Default -- | mtl-compatible reader type ReaderDef r = "Reader" >: ReaderEff r -- | Specialised version of runReaderEff compatible with the -- MonadReader instance. runReaderDef :: Eff (ReaderDef r : xs) a -> r -> Eff xs a -- | mtl-compatible state type StateDef s = "State" >: State s -- | runStateEff specialised for the MonadState instance. runStateDef :: Eff (StateDef s : xs) a -> s -> Eff xs (a, s) -- | evalStateEff specialised for the MonadState instance. evalStateDef :: Eff (StateDef s : xs) a -> s -> Eff xs a -- | execStateEff specialised for the MonadState instance. execStateDef :: Eff (StateDef s : xs) a -> s -> Eff xs s -- | mtl-compatible writer type WriterDef w = "Writer" >: WriterEff w -- | runWriterDef specialised for the MonadWriter instance. runWriterDef :: Monoid w => Eff (WriterDef w : xs) a -> Eff xs (a, w) -- | execWriterDef specialised for the MonadWriter instance. execWriterDef :: Monoid w => Eff (WriterDef w : xs) a -> Eff xs w -- | Same as EitherDef () type MaybeDef = "Either" >: EitherEff () -- | Similar to runMaybeT, but on Eff runMaybeDef :: Eff (MaybeDef : xs) a -> Eff xs (Maybe a) -- | mtl-compatible either effect type EitherDef e = "Either" >: EitherEff e -- | Similar to runExceptT, but on Eff runEitherDef :: Eff (EitherDef e : xs) a -> Eff xs (Either e a) instance (Control.Monad.IO.Class.MonadIO m, Data.Extensible.Internal.Associate "IO" m xs) => Control.Monad.IO.Class.MonadIO (Data.Extensible.Effect.Eff xs) instance Data.Extensible.Internal.Associate "Reader" ((Data.Type.Equality.:~:) r) xs => Control.Monad.Reader.Class.MonadReader r (Data.Extensible.Effect.Eff xs) instance Data.Extensible.Internal.Associate "State" (Control.Monad.Trans.State.Strict.State s) xs => Control.Monad.State.Class.MonadState s (Data.Extensible.Effect.Eff xs) instance (GHC.Base.Monoid w, Data.Extensible.Internal.Associate "Writer" ((,) w) xs) => Control.Monad.Writer.Class.MonadWriter w (Data.Extensible.Effect.Eff xs) instance Data.Extensible.Internal.Associate "Either" (Data.Functor.Const.Const e) xs => Control.Monad.Error.Class.MonadError e (Data.Extensible.Effect.Eff xs) instance (GHC.Base.Monoid e, Data.Extensible.Internal.Associate "Either" (Data.Functor.Const.Const e) xs) => GHC.Base.Alternative (Data.Extensible.Effect.Eff xs) instance (GHC.Base.Monoid e, Data.Extensible.Internal.Associate "Either" (Data.Functor.Const.Const e) xs) => GHC.Base.MonadPlus (Data.Extensible.Effect.Eff xs) -- | Reification of constraints using extensible data types. Also includes -- orphan instances. module Data.Extensible.Dictionary -- | Reify a collection of dictionaries, as you wish. library :: forall c xs. Forall c xs => Comp Dict c :* xs -- | Forall upon a wrapper type WrapForall c h = Forall (Instance1 c h) -- | Composition for a class and a wrapper class c (h x) => Instance1 c h x class (f x, g x) => And f g x instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall GHC.Show.Show h xs => GHC.Show.Show (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Text.Prettyprint.Doc.Internal.Pretty h xs => Data.Text.Prettyprint.Doc.Internal.Pretty (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall GHC.Classes.Eq h xs => GHC.Classes.Eq (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). (GHC.Classes.Eq (h Data.Extensible.Struct.:* xs), Data.Extensible.Dictionary.WrapForall GHC.Classes.Ord h xs) => GHC.Classes.Ord (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Semigroup.Semigroup h xs => Data.Semigroup.Semigroup (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). (Data.Extensible.Dictionary.WrapForall Data.Semigroup.Semigroup h xs, Data.Extensible.Dictionary.WrapForall GHC.Base.Monoid h xs) => GHC.Base.Monoid (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Hashable.Class.Hashable h xs => Data.Hashable.Class.Hashable (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall GHC.Enum.Bounded h xs => GHC.Enum.Bounded (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Language.Haskell.TH.Syntax.Lift h xs => Language.Haskell.TH.Syntax.Lift (h Data.Extensible.Struct.:* xs) instance forall a (h :: a -> *) (x :: a) (xs :: [a]). Data.Extensible.Dictionary.WrapForall Data.Vector.Unboxed.Base.Unbox h (x : xs) => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (h Data.Extensible.Struct.:* (x : xs)) instance forall a (h :: a -> *) (x :: a) (xs :: [a]). Data.Extensible.Dictionary.WrapForall Data.Vector.Unboxed.Base.Unbox h (x : xs) => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (h Data.Extensible.Struct.:* (x : xs)) instance forall a (h :: a -> *) (x :: a) (xs :: [a]). Data.Extensible.Dictionary.WrapForall Data.Vector.Unboxed.Base.Unbox h (x : xs) => Data.Vector.Unboxed.Base.Unbox (h Data.Extensible.Struct.:* (x : xs)) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Test.QuickCheck.Arbitrary.Arbitrary h xs => Test.QuickCheck.Arbitrary.Arbitrary (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Control.DeepSeq.NFData h xs => Control.DeepSeq.NFData (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Csv.Conversion.FromField h xs => Data.Csv.Conversion.FromRecord (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Csv.Conversion.ToField h xs => Data.Csv.Conversion.ToRecord (h Data.Extensible.Struct.:* xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall GHC.Show.Show h xs => GHC.Show.Show (h Data.Extensible.Sum.:| xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall GHC.Classes.Eq h xs => GHC.Classes.Eq (h Data.Extensible.Sum.:| xs) instance forall k (h :: k -> *) (xs :: [k]). (GHC.Classes.Eq (h Data.Extensible.Sum.:| xs), Data.Extensible.Dictionary.WrapForall GHC.Classes.Ord h xs) => GHC.Classes.Ord (h Data.Extensible.Sum.:| xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Control.DeepSeq.NFData h xs => Control.DeepSeq.NFData (h Data.Extensible.Sum.:| xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Hashable.Class.Hashable h xs => Data.Hashable.Class.Hashable (h Data.Extensible.Sum.:| xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Language.Haskell.TH.Syntax.Lift h xs => Language.Haskell.TH.Syntax.Lift (h Data.Extensible.Sum.:| xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Test.QuickCheck.Arbitrary.Arbitrary h xs => Test.QuickCheck.Arbitrary.Arbitrary (h Data.Extensible.Sum.:| xs) instance forall k (h :: k -> *) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Text.Prettyprint.Doc.Internal.Pretty h xs => Data.Text.Prettyprint.Doc.Internal.Pretty (h Data.Extensible.Sum.:| xs) instance forall v (h :: v -> *) (xs :: [Data.Extensible.Internal.Assoc GHC.Types.Symbol v]). Data.Extensible.Class.Forall (Data.Extensible.Field.KeyValue GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Csv.Conversion.FromField h)) xs => Data.Csv.Conversion.FromNamedRecord (Data.Extensible.Field.Field h Data.Extensible.Struct.:* xs) instance forall v (h :: v -> *) (xs :: [Data.Extensible.Internal.Assoc GHC.Types.Symbol v]). Data.Extensible.Class.Forall (Data.Extensible.Field.KeyValue GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Csv.Conversion.ToField h)) xs => Data.Csv.Conversion.ToNamedRecord (Data.Extensible.Field.Field h Data.Extensible.Struct.:* xs) instance forall v (h :: v -> *) (xs :: [Data.Extensible.Internal.Assoc GHC.Types.Symbol v]). Data.Extensible.Class.Forall (Data.Extensible.Field.KeyValue GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Aeson.Types.FromJSON.FromJSON h)) xs => Data.Aeson.Types.FromJSON.FromJSON (Data.Extensible.Field.Field h Data.Extensible.Struct.:* xs) instance forall v (h :: v -> *) (xs :: [Data.Extensible.Internal.Assoc GHC.Types.Symbol v]). Data.Extensible.Class.Forall (Data.Extensible.Field.KeyValue GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Aeson.Types.ToJSON.ToJSON h)) xs => Data.Aeson.Types.ToJSON.ToJSON (Data.Extensible.Field.Field h Data.Extensible.Struct.:* xs) instance forall v (h :: v -> *) (xs :: [Data.Extensible.Internal.Assoc GHC.Types.Symbol v]). Data.Extensible.Class.Forall (Data.Extensible.Field.KeyValue GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Aeson.Types.FromJSON.FromJSON h)) xs => Data.Aeson.Types.FromJSON.FromJSON (Data.Extensible.Nullable.Nullable (Data.Extensible.Field.Field h) Data.Extensible.Struct.:* xs) instance forall v (h :: v -> *) (xs :: [Data.Extensible.Internal.Assoc GHC.Types.Symbol v]). Data.Extensible.Class.Forall (Data.Extensible.Field.KeyValue GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Aeson.Types.ToJSON.ToJSON h)) xs => Data.Aeson.Types.ToJSON.ToJSON (Data.Extensible.Nullable.Nullable (Data.Extensible.Field.Field h) Data.Extensible.Struct.:* xs) instance forall k1 k2 (c :: k2 -> GHC.Types.Constraint) (h :: k1 -> k2) (x :: k1). c (h x) => Data.Extensible.Dictionary.Instance1 c h x instance forall k (f :: k -> GHC.Types.Constraint) (x :: k) (g :: k -> GHC.Types.Constraint). (f x, g x) => Data.Extensible.Dictionary.And f g x instance Data.Text.Prettyprint.Doc.Internal.Pretty a => Data.Text.Prettyprint.Doc.Internal.Pretty (Data.Functor.Identity.Identity a) instance forall k a (b :: k). Data.Text.Prettyprint.Doc.Internal.Pretty a => Data.Text.Prettyprint.Doc.Internal.Pretty (Data.Functor.Const.Const a b) instance Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift (Data.Functor.Identity.Identity a) instance forall k a (b :: k). Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift (Data.Functor.Const.Const a b) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Data.Functor.Identity.Identity a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Data.Functor.Identity.Identity a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Unboxed.Base.Unbox (Data.Functor.Identity.Identity a) instance forall k a (b :: k). Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Data.Extensible.Wrapper.Const' a b) instance forall k a (b :: k). Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Data.Extensible.Wrapper.Const' a b) instance forall k a (b :: k). Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Unboxed.Base.Unbox (Data.Extensible.Wrapper.Const' a b) -- | Bit-packed records module Data.Extensible.Bits -- | Bit-vector product. It has similar interface as (:*) but -- fields are packed into r. newtype BitProd r (h :: k -> *) (xs :: [k]) BitProd :: r -> BitProd r [unBitProd] :: BitProd r -> r -- | Conversion between a value and a bit representation. -- -- Instances of FromBits must satisfy the following laws: -- --
-- fromBits (x `shiftL` W .|. toBits a) ≡ a -- toBits a `shiftR` W == zeroBits ---- -- where W is the BitWidth. class (Bits r, KnownNat (BitWidth a)) => FromBits r a where { type family BitWidth a :: Nat; } fromBits :: FromBits r a => r -> a toBits :: FromBits r a => a -> r -- | Total BitWidth -- | Fields are instances of FromBits and fit in the representation. type BitFields r h xs = (FromBits r r, TotalBits h xs <= BitWidth r, Forall (Instance1 (FromBits r) h) xs) -- | hlookup for BitProd blookup :: forall x r h xs. (BitFields r h xs, FromBits r (h x)) => Membership xs x -> BitProd r h xs -> h x -- | Update a field of a BitProd. bupdate :: forall x r h xs. (BitFields r h xs, FromBits r (h x)) => Membership xs x -> BitProd r h xs -> h x -> BitProd r h xs -- | Convert a normal extensible record into a bit record. toBitProd :: forall r h xs. BitFields r h xs => h :* xs -> BitProd r h xs -- | Convert a normal extensible record into a bit record. fromBitProd :: forall r h xs. BitFields r h xs => BitProd r h xs -> h :* xs -- | Bit-packed record type BitRecordOf r h = BitProd r (Field h) -- | Bit-packed record type BitRecord r = BitRecordOf r Identity instance forall r k (h :: k -> *) (xs :: [k]). Foreign.Storable.Storable r => Foreign.Storable.Storable (Data.Extensible.Bits.BitProd r h xs) instance forall r k (h :: k -> *) (xs :: [k]). Data.Hashable.Class.Hashable r => Data.Hashable.Class.Hashable (Data.Extensible.Bits.BitProd r h xs) instance forall r k (h :: k -> *) (xs :: [k]). GHC.Generics.Generic (Data.Extensible.Bits.BitProd r h xs) instance forall r k (h :: k -> *) (xs :: [k]). GHC.Arr.Ix r => GHC.Arr.Ix (Data.Extensible.Bits.BitProd r h xs) instance forall r k (h :: k -> *) (xs :: [k]). GHC.Enum.Bounded r => GHC.Enum.Bounded (Data.Extensible.Bits.BitProd r h xs) instance forall r k (h :: k -> *) (xs :: [k]). GHC.Enum.Enum r => GHC.Enum.Enum (Data.Extensible.Bits.BitProd r h xs) instance forall r k (h :: k -> *) (xs :: [k]). GHC.Classes.Ord r => GHC.Classes.Ord (Data.Extensible.Bits.BitProd r h xs) instance forall r k (h :: k -> *) (xs :: [k]). GHC.Classes.Eq r => GHC.Classes.Eq (Data.Extensible.Bits.BitProd r h xs) instance forall k (h :: k -> *) (xs :: [k]) r. (Data.Extensible.Class.Forall (Data.Extensible.Dictionary.Instance1 GHC.Show.Show h) xs, Data.Extensible.Bits.BitFields r h xs) => GHC.Show.Show (Data.Extensible.Bits.BitProd r h xs) instance (Data.Profunctor.Rep.Corepresentable p, Control.Comonad.Comonad (Data.Profunctor.Rep.Corep p), GHC.Base.Functor f) => Data.Extensible.Class.Extensible f p (Data.Extensible.Bits.BitProd r) instance forall k r (h :: k -> *) (xs :: [k]). (Data.Bits.Bits r, GHC.TypeNats.KnownNat (Data.Extensible.Bits.TotalBits h xs)) => Data.Extensible.Bits.FromBits r (Data.Extensible.Bits.BitProd r h xs) instance Data.Bits.Bits r => Data.Extensible.Bits.FromBits r () instance forall k r (a :: k). Data.Bits.Bits r => Data.Extensible.Bits.FromBits r (Data.Proxy.Proxy a) instance Data.Extensible.Bits.FromBits GHC.Word.Word64 GHC.Word.Word64 instance Data.Extensible.Bits.FromBits GHC.Word.Word64 GHC.Types.Bool instance Data.Extensible.Bits.FromBits GHC.Word.Word64 GHC.Word.Word8 instance Data.Extensible.Bits.FromBits GHC.Word.Word64 GHC.Word.Word16 instance Data.Extensible.Bits.FromBits GHC.Word.Word64 GHC.Word.Word32 instance Data.Extensible.Bits.FromBits GHC.Word.Word64 GHC.Int.Int8 instance Data.Extensible.Bits.FromBits GHC.Word.Word64 GHC.Int.Int16 instance Data.Extensible.Bits.FromBits GHC.Word.Word64 GHC.Int.Int32 instance Data.Extensible.Bits.FromBits r a => Data.Extensible.Bits.FromBits r (Data.Functor.Identity.Identity a) instance (Data.Extensible.Bits.FromBits r a, Data.Extensible.Bits.FromBits r b, n ~ (Data.Extensible.Bits.BitWidth a GHC.TypeNats.+ Data.Extensible.Bits.BitWidth b), n GHC.TypeNats.<= Data.Extensible.Bits.BitWidth r, GHC.TypeNats.KnownNat n) => Data.Extensible.Bits.FromBits r (a, b) instance forall k r a (b :: k). Data.Extensible.Bits.FromBits r a => Data.Extensible.Bits.FromBits r (Data.Extensible.Wrapper.Const' a b) instance forall k v r (h :: v -> *) (x :: Data.Extensible.Internal.Assoc k v). (Data.Bits.Bits r, Data.Extensible.Bits.FromBits r (h (Data.Extensible.Field.AssocValue x))) => Data.Extensible.Bits.FromBits r (Data.Extensible.Field.Field h x) -- | This module just reexports everything. -- -- module Data.Extensible