-- 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.9 -- | 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 GHC.Base.Functor (Data.Extensible.Internal.Rig.Exchange a b s) instance Data.Profunctor.Unsafe.Profunctor (Data.Extensible.Internal.Rig.Exchange a b) module Data.Extensible.Wrapper -- | The extensible data types should take k -> Type as a -- parameter. This class allows us to take a shortcut for direct -- representation. class Wrapper (h :: k -> Type) where { -- | Repr h v is the user-facing representation of h -- v. type family Repr h (v :: k) :: Type; } -- | 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) wrap :: Wrapper h => Repr h v -> h v unwrap :: Wrapper h => 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) -- | Deprecated: Use Compose instead type Comp = Compose -- | Deprecated: Use Compose instead pattern Comp :: f (g a) -> Compose f g a -- | Deprecated: Use getCompose instead getComp :: Compose f g a -> f (g a) -- | Wrap a result of fmap comp :: Functor f => (a -> g b) -> f a -> Compose f g b -- | Poly-kinded product data Prod f g a Prod :: f a -> g a -> Prod f g a instance (Data.Traversable.Traversable f, Data.Traversable.Traversable g) => Data.Traversable.Traversable (Data.Extensible.Wrapper.Prod f g) instance (Data.Foldable.Foldable f, Data.Foldable.Foldable g) => Data.Foldable.Foldable (Data.Extensible.Wrapper.Prod f g) instance (GHC.Base.Functor f, GHC.Base.Functor g) => GHC.Base.Functor (Data.Extensible.Wrapper.Prod f g) instance forall k (f :: k -> Type) (g :: k -> Type) (a :: k). GHC.Generics.Generic (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> Type) (g :: k -> Type) (a :: k). (GHC.Classes.Ord (f a), GHC.Classes.Ord (g a)) => GHC.Classes.Ord (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> Type) (g :: k -> Type) (a :: k). (GHC.Classes.Eq (f a), GHC.Classes.Eq (g a)) => GHC.Classes.Eq (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> Type) (g :: k -> Type) (a :: k). (GHC.Show.Show (f a), GHC.Show.Show (g a)) => GHC.Show.Show (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> Type) (a :: k) (g :: k -> Type). (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 -> Type) (a :: k) (g :: k -> Type). (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 -> Type) (g :: k -> Type). (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 -> Type) (a :: k) (g :: k -> Type). (GHC.Base.Semigroup (f a), GHC.Base.Semigroup (g a)) => GHC.Base.Semigroup (Data.Extensible.Wrapper.Prod f g a) instance forall k (f :: k -> Type) (a :: k) (g :: k -> Type). (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 -> Type) (a :: k) (g :: k -> Type). (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.Functor.Identity.Identity instance Data.Extensible.Wrapper.Wrapper GHC.Maybe.Maybe instance Data.Extensible.Wrapper.Wrapper (Data.Either.Either e) instance Data.Extensible.Wrapper.Wrapper [] instance forall k (f :: Type -> Type) (g :: k -> Type). (GHC.Base.Functor f, Data.Extensible.Wrapper.Wrapper g) => Data.Extensible.Wrapper.Wrapper (Data.Functor.Compose.Compose f g) instance Data.Extensible.Wrapper.Wrapper (Data.Functor.Const.Const a) 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 -> Type) -> Type) where { type family ExtensibleConstr t (xs :: [k]) (h :: k -> Type) (x :: k) :: Constraint; type ExtensibleConstr t xs h x = (); } pieceAt :: (Extensible f p t, ExtensibleConstr t xs h x) => Membership xs x -> Optic' p f (t xs h) (h x) -- | Accessor for an element. piece :: (x ∈ xs, Extensible f p t, ExtensibleConstr t xs h x) => Optic' p f (t xs h) (h x) -- | Like piece, but reckon membership from its key. pieceAssoc :: (Lookup xs k v, Extensible f p t, ExtensibleConstr t xs h (k :> v)) => Optic' p f (t xs h) (h (k :> v)) -- | Access a specified element through a wrapper. itemAt :: (Wrapper h, Extensible f p t, ExtensibleConstr t xs h x) => Membership xs x -> Optic' p f (t xs h) (Repr h x) -- | Access an element through a wrapper. item :: (Wrapper h, Extensible f p t, x ∈ xs, ExtensibleConstr t xs h x) => proxy x -> Optic' p f (t xs h) (Repr h x) -- | Access an element specified by the key type through a wrapper. itemAssoc :: (Wrapper h, Extensible f p t, Lookup xs k v, ExtensibleConstr t xs h (k :> v)) => proxy k -> Optic' p f (t xs h) (Repr h (k :> v)) -- | Access an element specified by the key type through a wrapper. itemKey :: forall k v xs h f p t. (Wrapper h, Extensible f p t, Lookup xs k v, ExtensibleConstr t xs h (k :> v)) => Optic' p f (t xs h) (Repr h (k :> v)) -- | A witness that of x is a member of a 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 :: forall k (xs :: [k]) (x :: k) (y :: k). Membership xs x -> Membership xs y -> Either Ordering (x :~: y) -- | This Membership points to the first element leadership :: forall k (x :: k) (xs :: [k]). Membership (x : xs) x -- | x is a member of xs class Member (xs :: [k]) (x :: k) membership :: Member xs x => Membership xs x -- | Unicode flipped alias for Member type (x :: k) ∈ (xs :: [k]) = Member xs x -- | FindType types type family FindType (x :: k) (xs :: [k]) :: [Nat] -- | Every type-level list is an instance of Generate. class Generate (xs :: [k]) -- | Enumerate all possible Memberships of xs. henumerate :: Generate xs => (forall (x :: k). () => 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 :: k). () => 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 :: k). c x => Membership xs x -> r -> r) -> r -> r hgenerateListFor :: (Forall c xs, Applicative f) => proxy c -> (forall (x :: k). c x => Membership xs x -> f (h x)) -> f (HList h xs) -- | HACK: Without this, the constraints are not propagated well. type family ForallF (c :: k -> Constraint) (xs :: [k]) -- | The kind of key-value pairs data Assoc k v (:>) :: k -> v -> Assoc k v infix 0 :> -- | A synonym for (:>) type (>:) = '(:>) :: k -> v -> Assoc k v -- | Lookup xs k v is essentially identical to (k :> -- v) ∈ xs , but the type v is inferred from k and -- xs. class Lookup (xs :: [Assoc k k1]) (k2 :: k) (v :: k1) | k2 xs -> v association :: Lookup xs k2 v => Membership xs (k2 :> v) -- | First element type family Head (xs :: [k]) :: k -- | Last element type family Last (x :: [k]) :: k module Data.Extensible.Sum -- | The extensible sum type -- --
-- (:/) :: [k] -> (k -> Type) -> Type --data (xs :: [k]) :/ (h :: k -> Type) [EmbedAt] :: !Membership xs x -> h x -> xs :/ h -- | Change the wrapper. hoist :: (forall x. g x -> h x) -> (xs :/ g) -> xs :/ h -- | O(1) lift a value. embed :: x ∈ xs => h x -> xs :/ h -- | Try to extract something you want. strike :: forall h x xs. x ∈ xs => (xs :/ h) -> Maybe (h x) -- | Try to extract something you want. strikeAt :: forall h x xs. Membership xs x -> (xs :/ h) -> Maybe (h x) -- | O(1) Naive pattern match (<:|) :: (h x -> r) -> ((xs :/ h) -> r) -> ((x : xs) :/ h) -> r infixr 1 <:| -- | There is no empty union. exhaust :: ('[] :/ h) -> r -- | Embed a value, but focuses on its key. embedAssoc :: Lookup xs k a => h (k :> a) -> xs :/ h instance forall k (xs :: [k]). GHC.Enum.Enum (xs Data.Extensible.Sum.:/ Data.Proxy.Proxy) instance forall k (xs :: [k]). (Data.Extensible.Class.Last xs Type.Membership.Internal.∈ xs) => GHC.Enum.Bounded (xs Data.Extensible.Sum.:/ Data.Proxy.Proxy) 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 -> Type) (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. Lookup xs k v => 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 -> Type) -> Type --data (s :: [k]) :& (h :: k -> Type) -- | Deprecated: Use :& instead type h :* xs = xs :& h -- | Turn Struct into an immutable product. The original -- Struct may not be used. unsafeFreeze :: PrimMonad m => Struct (PrimState m) h xs -> m (xs :& h) -- | Create a new Struct using the contents of a product. newFrom :: forall g h m xs. PrimMonad m => (xs :& g) -> (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 -> (xs :& h) -> h x -- | The size of a product. hlength :: (xs :& h) -> Int -- | Concatenate type level lists type family (++) (xs :: [k]) (ys :: [k]) :: [k] infixr 5 ++ -- | Combine products. happend :: (xs :& h) -> (ys :& h) -> (xs ++ ys) :& h infixr 5 `happend` -- | Right-associative fold of a product. hfoldrWithIndex :: (forall x. Membership xs x -> h x -> r -> r) -> r -> (xs :& h) -> r -- | Create a new Struct from a product. thaw :: PrimMonad m => (xs :& h) -> 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)) -> xs :& h -- | Turn a product into a Struct temporarily. hmodify :: (forall s. Struct s h xs -> ST s ()) -> (xs :& h) -> xs :& h -- | Convert a product into an HList. toHList :: forall h xs. (xs :& h) -> 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 -> Type) a. (s GHC.Types.~ 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 -> Type) a. (s GHC.Types.~ 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 -> Type) a. (s GHC.Types.~ 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 -> Type) -> Type --data (s :: [k]) :& (h :: k -> Type) -- | 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 -> (xs :& h) -> (x : xs) :& h infixr 0 <: -- | Strict version of (<:). ( (xs :& h) -> (x : xs) :& h infixr 0 Repr h x -> (xs :& h) -> (x : xs) :& h infixr 0 =<: -- | The size of a product. hlength :: (xs :& h) -> Int -- | Concatenate type level lists type family (++) (xs :: [k]) (ys :: [k]) :: [k] infixr 5 ++ -- | Combine products. happend :: (xs :& h) -> (ys :& h) -> (xs ++ ys) :& h infixr 5 `happend` -- | 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) -> (xs :& g) -> xs :& h -- | Map a function to every element of a product. hmapWithIndex :: (forall x. Membership xs x -> g x -> h x) -> (xs :& g) -> xs :& h -- | zipWith for heterogeneous product hzipWith :: (forall x. f x -> g x -> h x) -> (xs :& f) -> (xs :& g) -> xs :& h -- | zipWith3 for heterogeneous product hzipWith3 :: (forall x. f x -> g x -> h x -> i x) -> (xs :& f) -> (xs :& g) -> (xs :& h) -> xs :& i -- | Map elements to a monoid and combine the results. -- --
-- hfoldMap f . hmap g ≡ hfoldMap (f . g) --hfoldMap :: Monoid a => (forall x. h x -> a) -> (xs :& h) -> a -- | hfoldMap with the membership of elements. hfoldMapWithIndex :: Monoid a => (forall x. Membership xs x -> g x -> a) -> (xs :& g) -> a -- | Right-associative fold of a product. hfoldrWithIndex :: (forall x. Membership xs x -> h x -> r -> r) -> r -> (xs :& h) -> r -- | Perform a strict left fold over the elements. hfoldlWithIndex :: (forall x. Membership xs x -> r -> h x -> r) -> r -> (xs :& h) -> r -- | Traverse all elements and combine the result sequentially. -- htraverse (fmap f . g) ≡ fmap (hmap f) . htraverse g htraverse pure ≡ -- pure htraverse (Compose . fmap g . f) ≡ Compose . fmap (htraverse g) . -- htraverse f htraverse :: Applicative f => (forall x. g x -> f (h x)) -> (xs :& g) -> f (xs :& h) -- | htraverse with Memberships. htraverseWithIndex :: Applicative f => (forall x. Membership xs x -> g x -> f (h x)) -> (xs :& g) -> f (xs :& h) -- | sequence analog for extensible products hsequence :: Applicative f => (xs :& Compose f h) -> f (xs :& h) -- | 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) -> (xs :& g) -> xs :& h -- | Constrained hfoldMap hfoldMapFor :: (Forall c xs, Monoid a) => proxy c -> (forall x. c x => h x -> a) -> (xs :& h) -> 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) -> (xs :& h) -> a -- | hfoldrWithIndex with a constraint for each element. hfoldrWithIndexFor :: forall c xs h r proxy. Forall c xs => proxy c -> (forall x. c x => Membership xs x -> h x -> r -> r) -> r -> (xs :& h) -> r -- | Constrained hfoldlWithIndex hfoldlWithIndexFor :: Forall c xs => proxy c -> (forall x. c x => Membership xs x -> r -> h x -> r) -> r -> (xs :& h) -> r -- | Constrained hfoldMap hfoldMapWith :: forall c xs h a. (Forall c xs, Monoid a) => (forall x. c x => h x -> a) -> (xs :& h) -> a -- | hfoldMapWithIndex with a constraint for each element. hfoldMapWithIndexWith :: forall c xs h a. (Forall c xs, Monoid a) => (forall x. c x => Membership xs x -> h x -> a) -> (xs :& h) -> a hfoldrWithIndexWith :: forall c xs h r. Forall c xs => (forall x. c x => Membership xs x -> h x -> r -> r) -> r -> (xs :& h) -> r -- | Constrained hfoldlWithIndex hfoldlWithIndexWith :: forall c xs h r. Forall c xs => (forall x. c x => Membership xs x -> r -> h x -> r) -> r -> (xs :& h) -> r hmapWithIndexWith :: forall c xs g h. Forall c xs => (forall x. c x => Membership xs x -> g x -> h x) -> (xs :& g) -> xs :& h -- | Evaluate every element in a product. hforce :: (xs :& h) -> xs :& h -- | Accumulate sums on a product. haccumMap :: Foldable f => (a -> xs :/ g) -> (forall x. Membership xs x -> g x -> h x -> h x) -> (xs :& h) -> f a -> xs :& h -- |
-- haccum = haccumMap id --haccum :: Foldable f => (forall x. Membership xs x -> g x -> h x -> h x) -> (xs :& h) -> f (xs :/ g) -> xs :& h -- | Group sums by type. hpartition :: (Foldable f, Generate xs) => (a -> xs :/ h) -> f a -> xs :& Compose [] h -- | Get an element in a product. hlookup :: Membership xs x -> (xs :& h) -> h x -- | Flipped hlookup hindex :: (xs :& h) -> 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 :: k). () => 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 :: k). () => 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 (xs :& h) -- | 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) -> xs :& h -- | A product filled with the specified value. hrepeat :: Generate xs => (forall x. h x) -> xs :& h -- | The dual of htraverse hcollect :: (Functor f, Generate xs) => (a -> xs :& h) -> f a -> xs :& Compose f h -- | The dual of hsequence hdistribute :: (Functor f, Generate xs) => f (xs :& h) -> xs :& Compose f h -- | Convert HList into a product. fromHList :: HList h xs -> xs :& h -- | Convert a product into an HList. toHList :: forall h xs. (xs :& h) -> 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 :: k). c x => Membership xs x -> r -> r) -> r -> r hgenerateListFor :: (Forall c xs, Applicative f) => proxy c -> (forall (x :: k). 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 (xs :& h) -- | Pure version of hgenerateFor. htabulateFor :: Forall c xs => proxy c -> (forall x. c x => Membership xs x -> h x) -> xs :& h -- | A product filled with the specified value. hrepeatFor :: Forall c xs => proxy c -> (forall x. c x => h x) -> xs :& h -- | Applicative version of htabulateFor. hgenerateWith :: forall c xs f h. (Forall c xs, Applicative f) => (forall x. c x => Membership xs x -> f (h x)) -> f (xs :& h) -- | Pure version of hgenerateFor. htabulateWith :: forall c xs h. Forall c xs => (forall x. c x => Membership xs x -> h x) -> xs :& h -- | A product filled with the specified value. hrepeatWith :: forall c xs h. Forall c xs => (forall x. c x => h x) -> xs :& h module Data.Extensible.Plain -- | Alias for plain products type AllOf xs = xs :& Identity -- | Alias for plain sums type OneOf xs = xs :/ Identity -- | 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 xs Identity x) => (a -> x) -> Optic' p f (t xs Identity) 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) -> (xs :& f) -> (xs :/ g) -> 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 :: (xs :& Match h a) -> (xs :/ h) -> a -- | Applies a function to the result of Match. mapMatch :: (a -> b) -> Match h a x -> Match h b x -- | Flipped match caseOf :: (xs :/ h) -> (xs :& Match h a) -> a infix 0 `caseOf` instance forall k (h :: k -> Type) r (x :: k). GHC.Base.Monoid r => GHC.Base.Monoid (Data.Extensible.Match.Match h r x) instance forall k (h :: k -> Type) r (x :: k). GHC.Base.Semigroup r => GHC.Base.Semigroup (Data.Extensible.Match.Match h r x) instance forall k (h :: k -> Type) r (x :: k). GHC.Generics.Generic (Data.Extensible.Match.Match h r x) instance forall k (h :: k -> Type) 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 => xs :& Membership ys -- | O(n) Select some elements. shrink :: xs ⊆ ys => (ys :& h) -> xs :& h -- | O(1) Embed to a larger union. spread :: xs ⊆ ys => (xs :/ h) -> ys :/ h -- | 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 type family Associated' (xs :: [Assoc k v]) (t :: Assoc k v) :: Constraint -- | Reify the inclusion of type level sets. inclusionAssoc :: forall xs ys. IncludeAssoc ys xs => xs :& Membership ys -- | O(n) Select some elements. shrinkAssoc :: IncludeAssoc ys xs => (ys :& h) -> xs :& h -- | O(1) Embed to a larger union. spreadAssoc :: IncludeAssoc ys xs => (xs :/ h) -> ys :/ h instance forall k1 v1 (xs :: [Type.Membership.Internal.Assoc k1 v1]) (t :: Type.Membership.Internal.Assoc k1 v1) (k2 :: k1) (v2 :: v1). (Data.Extensible.Inclusion.Associated' xs t, t GHC.Types.~ (k2 'Type.Membership.Internal.:> v2)) => Data.Extensible.Inclusion.Associated xs t module Data.Extensible.Nullable -- | A product filled with Nullable Nothing vacancy :: Generate xs => xs :& Nullable h -- | The inverse of inclusion. coinclusion :: (Include ys xs, Generate ys) => ys :& Nullable (Membership xs) -- | Extend a product and fill missing fields by Null. wrench :: (Generate ys, xs ⊆ ys) => (xs :& h) -> ys :& Nullable h -- | Narrow the range of the sum, if possible. retrench :: (Generate ys, xs ⊆ ys) => (ys :/ h) -> Nullable ((:/) xs) h -- | 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 -- | fromMaybe for Nullable. fromNullable :: h x -> Nullable h x -> h x instance forall k (h :: k -> Type) (x :: k). Language.Haskell.TH.Syntax.Lift (h x) => Language.Haskell.TH.Syntax.Lift (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> Type) (x :: k). Data.Hashable.Class.Hashable (h x) => Data.Hashable.Class.Hashable (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> Type) (x :: k). Test.QuickCheck.Arbitrary.Arbitrary (h x) => Test.QuickCheck.Arbitrary.Arbitrary (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> Type) (x :: k). Control.DeepSeq.NFData (h x) => Control.DeepSeq.NFData (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> Type) (x :: k). GHC.Generics.Generic (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> Type) (x :: k). GHC.Classes.Ord (h x) => GHC.Classes.Ord (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> Type) (x :: k). GHC.Classes.Eq (h x) => GHC.Classes.Eq (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> Type) (x :: k). GHC.Show.Show (h x) => GHC.Show.Show (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> Type). Data.Extensible.Wrapper.Wrapper h => Data.Extensible.Wrapper.Wrapper (Data.Extensible.Nullable.Nullable h) instance forall k (h :: k -> Type) (x :: k). GHC.Base.Semigroup (h x) => GHC.Base.Semigroup (Data.Extensible.Nullable.Nullable h x) instance forall k (h :: k -> Type) (x :: k). GHC.Base.Semigroup (h x) => GHC.Base.Monoid (Data.Extensible.Nullable.Nullable h x) -- | 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 xs h m a TangleT :: RWST (xs :& Compose (TangleT xs h m) h) () (xs :& Nullable h) m a -> TangleT xs h m a [unTangleT] :: TangleT xs h m a -> RWST (xs :& Compose (TangleT xs h m) h) () (xs :& Nullable h) m a -- | Hitch an element associated to the FieldName through a -- wrapper. lasso :: forall k v m h xs. (Monad m, Lookup xs k v, Wrapper h) => Proxy k -> TangleT xs h m (Repr h (k :> v)) -- | Take a value from the tangles. The result is memoized. hitchAt :: Monad m => Membership xs x -> TangleT xs h m (h x) -- | Run a TangleT action and return the result and the calculated -- values. runTangleT :: Monad m => (xs :& Compose (TangleT xs h m) h) -> (xs :& Nullable h) -> TangleT xs h m a -> m (a, xs :& Nullable h) -- | Run a TangleT action. evalTangleT :: Monad m => (xs :& Compose (TangleT xs h m) h) -> (xs :& Nullable h) -> TangleT xs h m a -> m a -- | Run tangles and collect all the results as a Record. runTangles :: Monad m => (xs :& Compose (TangleT xs h m) h) -> (xs :& Nullable h) -> m (xs :& h) instance forall k (xs :: [k]) (h :: k -> Type) (m :: Type -> Type). GHC.Base.Monad m => GHC.Base.Monad (Data.Extensible.Tangle.TangleT xs h m) instance forall k (xs :: [k]) (h :: k -> Type) (m :: Type -> Type). GHC.Base.Monad m => GHC.Base.Applicative (Data.Extensible.Tangle.TangleT xs h m) instance forall k (xs :: [k]) (h :: k -> Type) (m :: Type -> Type). GHC.Base.Functor m => GHC.Base.Functor (Data.Extensible.Tangle.TangleT xs h m) instance forall k (xs :: [k]) (h :: k -> Type). Control.Monad.Trans.Class.MonadTrans (Data.Extensible.Tangle.TangleT xs h) instance forall k (m :: Type -> Type) a (xs :: [k]) (h :: k -> Type). (GHC.Base.Monad m, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Data.Extensible.Tangle.TangleT xs h m a) instance forall k (m :: Type -> Type) a (xs :: [k]) (h :: k -> Type). (GHC.Base.Monad m, GHC.Base.Monoid a) => GHC.Base.Monoid (Data.Extensible.Tangle.TangleT xs h m 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 -> Type) -> Assoc k v -> Type --newtype Field (h :: v -> Type) (kv :: Assoc k v) Field :: h (TargetOf kv) -> Field (h :: v -> Type) (kv :: Assoc k v) [getField] :: Field (h :: v -> Type) (kv :: Assoc k v) -> h (TargetOf kv) -- | Annotate a value by the field name. -- --
-- foo :: Record '["num" >: Int, "str" >: String] -- foo = #num @= 42 -- <: #str @= "foo" -- <: nil --(@=) :: Wrapper h => Proxy 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) => Proxy k -> f (Repr h v) -> Compose f (Field h) (k :> v) infix 1 <@=> -- | Annotate a value by the field name without Wrapper. (@:>) :: Proxy k -> h v -> Field h (k :> v) infix 1 @:> -- | Kind-monomorphic, unwrapped version of @= (@==) :: Proxy (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" = Lookup xs "foo" a => Lens' (Record xs) a -- FieldOptic "foo" = Lookup xs "foo" a => 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 xs (Field h) (k :> v), Lookup xs k v, Wrapper h) => Optic' p f (t xs (Field h)) (Repr h v) -- | Specialised version of itemAssoc. Stands for "eXtensible LaBel" xlb :: Proxy k -> FieldOptic k -- | Lift a function for the content. liftField :: (g (TargetOf kv) -> h (TargetOf kv)) -> Field g kv -> Field h kv -- | Lift a function for the content. liftField2 :: (f (TargetOf kv) -> g (TargetOf kv) -> h (TargetOf kv)) -> Field f kv -> Field g kv -> Field h kv -- | The type of records which contain several fields. -- --
-- RecordOf :: (v -> Type) -> [Assoc k v] -> Type --type RecordOf h xs = xs :& Field h -- | Simple record type Record xs = RecordOf Identity xs -- | An empty Record. emptyRecord :: Record '[] -- | The dual of RecordOf -- --
-- VariantOf :: (v -> Type) -> [Assoc k v] -> Type --type VariantOf h xs = xs :/ Field h -- | Simple variant type Variant xs = VariantOf Identity xs -- | 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 type family KeyOf (kv :: Assoc k v) :: k -- | Proxy-level KeyOf. This is useful when using symbolVal. proxyKeyOf :: forall k v proxy (kv :: Assoc k v). proxy kv -> Proxy (KeyOf kv) -- | Get a string from a proxy of Assoc Symbol v. stringKeyOf :: forall v a (kv :: Assoc Symbol v) proxy. (IsString a, KnownSymbol (KeyOf kv)) => proxy kv -> a -- | Take the type of the value type family TargetOf (kv :: Assoc k v) :: v -- | Proxy-level TargetOf. proxyTargetOf :: forall k1 k2 proxy (kv :: Assoc k1 k2). proxy kv -> Proxy (TargetOf kv) -- | Constraint applied to KeyOf class pk KeyOf kv => KeyIs (pk :: k -> Constraint) (kv :: Assoc k v) -- | Constraint applied to TargetOf class pv TargetOf kv => TargetIs (pv :: k -> Constraint) (kv :: Assoc k1 k) -- | Combined constraint for Assoc class (pk KeyOf kv, pv TargetOf kv) => KeyTargetAre (pk :: k -> Constraint) (pv :: k1 -> Constraint) (kv :: Assoc k k1) instance forall v (h :: v -> Type) k (kv :: Type.Membership.Internal.Assoc k v). GHC.Generics.Generic (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Classes.Eq (h (Type.Membership.TargetOf kv)) => GHC.Classes.Eq (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Classes.Ord (h (Type.Membership.TargetOf kv)) => GHC.Classes.Ord (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Num.Num (h (Type.Membership.TargetOf kv)) => GHC.Num.Num (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Real.Integral (h (Type.Membership.TargetOf kv)) => GHC.Real.Integral (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Real.Fractional (h (Type.Membership.TargetOf kv)) => GHC.Real.Fractional (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Float.Floating (h (Type.Membership.TargetOf kv)) => GHC.Float.Floating (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Real.Real (h (Type.Membership.TargetOf kv)) => GHC.Real.Real (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Float.RealFloat (h (Type.Membership.TargetOf kv)) => GHC.Float.RealFloat (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Real.RealFrac (h (Type.Membership.TargetOf kv)) => GHC.Real.RealFrac (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Base.Semigroup (h (Type.Membership.TargetOf kv)) => GHC.Base.Semigroup (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). Foreign.Storable.Storable (h (Type.Membership.TargetOf kv)) => Foreign.Storable.Storable (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Base.Monoid (h (Type.Membership.TargetOf kv)) => GHC.Base.Monoid (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Enum.Enum (h (Type.Membership.TargetOf kv)) => GHC.Enum.Enum (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). GHC.Enum.Bounded (h (Type.Membership.TargetOf kv)) => GHC.Enum.Bounded (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). Control.DeepSeq.NFData (h (Type.Membership.TargetOf kv)) => Control.DeepSeq.NFData (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). Test.QuickCheck.Arbitrary.Arbitrary (h (Type.Membership.TargetOf kv)) => Test.QuickCheck.Arbitrary.Arbitrary (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). Data.Hashable.Class.Hashable (h (Type.Membership.TargetOf kv)) => Data.Hashable.Class.Hashable (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). Data.Aeson.Types.FromJSON.FromJSON (h (Type.Membership.TargetOf kv)) => Data.Aeson.Types.FromJSON.FromJSON (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). Data.Aeson.Types.ToJSON.ToJSON (h (Type.Membership.TargetOf kv)) => Data.Aeson.Types.ToJSON.ToJSON (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). Data.Csv.Conversion.FromField (h (Type.Membership.TargetOf kv)) => Data.Csv.Conversion.FromField (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). Data.Csv.Conversion.ToField (h (Type.Membership.TargetOf kv)) => Data.Csv.Conversion.ToField (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). Data.Incremental.Incremental (h (Type.Membership.TargetOf kv)) => Data.Incremental.Incremental (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (kv :: Type.Membership.Internal.Assoc k v). Language.Haskell.TH.Syntax.Lift (h (Type.Membership.TargetOf kv)) => Language.Haskell.TH.Syntax.Lift (Data.Extensible.Field.Field h kv) instance forall v k (h :: v -> Type) (x :: Type.Membership.Internal.Assoc k v). Data.Vector.Unboxed.Base.Unbox (h (Type.Membership.TargetOf x)) => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Data.Extensible.Field.Field h x) instance forall v k (h :: v -> Type) (x :: Type.Membership.Internal.Assoc k v). Data.Vector.Unboxed.Base.Unbox (h (Type.Membership.TargetOf x)) => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Data.Extensible.Field.Field h x) instance forall v k (h :: v -> Type) (x :: Type.Membership.Internal.Assoc k v). Data.Vector.Unboxed.Base.Unbox (h (Type.Membership.TargetOf x)) => Data.Vector.Unboxed.Base.Unbox (Data.Extensible.Field.Field h x) instance forall v k (h :: v -> Type). Data.Extensible.Wrapper.Wrapper h => Data.Extensible.Wrapper.Wrapper (Data.Extensible.Field.Field h) instance forall v1 (k :: GHC.Types.Symbol) (h :: v1 -> Type) (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 'Type.Membership.Internal.:> v2)) instance forall v1 (k :: GHC.Types.Symbol) (h :: v1 -> Type) (v2 :: v1). (GHC.TypeLits.KnownSymbol k, Prettyprinter.Internal.Pretty (h v2)) => Prettyprinter.Internal.Pretty (Data.Extensible.Field.Field h (k 'Type.Membership.Internal.:> v2)) instance (k GHC.Types.~ l) => GHC.OverloadedLabels.IsLabel k (Data.Proxy.Proxy l) 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 -- | 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 Type]; type RecFields a = GRecFields (Rep a) '[]; } recordFromList :: IsRecord a => HList (Field Identity) (RecFields a) -> a recordToList :: IsRecord a => a -> HList (Field Identity) (RecFields a) recordFromList :: (IsRecord a, Generic a, GIsRecord (Rep a) '[], GRecFields (Rep a) '[] ~ RecFields a) => HList (Field Identity) (RecFields a) -> a recordToList :: (IsRecord a, Generic a, GIsRecord (Rep a) '[], GRecFields (Rep a) '[] ~ RecFields 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)) instance Data.Extensible.Record.IsRecord () instance forall k (f :: k -> Type) (g :: k -> Type) (r :: [Type.Membership.Internal.Assoc GHC.Types.Symbol Type]). (Data.Extensible.Record.GIsRecord f (Data.Extensible.Record.GRecFields g r), Data.Extensible.Record.GIsRecord g r) => Data.Extensible.Record.GIsRecord (f GHC.Generics.:*: g) r instance Data.Extensible.Record.GIsRecord (GHC.Generics.S1 ('GHC.Generics.MetaSel ('GHC.Maybe.Just name) su ss ds) (GHC.Generics.K1 i a)) r instance forall k (f :: k -> Type) (r :: [Type.Membership.Internal.Assoc GHC.Types.Symbol Type]) (i :: GHC.Generics.Meta). Data.Extensible.Record.GIsRecord f r => Data.Extensible.Record.GIsRecord (GHC.Generics.C1 i f) r instance forall k (f :: k -> Type) (r :: [Type.Membership.Internal.Assoc GHC.Types.Symbol Type]) (i :: GHC.Generics.Meta). Data.Extensible.Record.GIsRecord f r => Data.Extensible.Record.GIsRecord (GHC.Generics.D1 i f) r -- | Experimental API for OverloadedLabels. GHC 8.0+ only module Data.Extensible.Label instance forall v1 (f :: Type -> Type) (p :: Type -> Type -> Type) (e :: [Type.Membership.Internal.Assoc GHC.Types.Symbol v1] -> (Type.Membership.Internal.Assoc GHC.Types.Symbol v1 -> Type) -> Type) (xs :: [Type.Membership.Internal.Assoc GHC.Types.Symbol v1]) (k :: GHC.Types.Symbol) (v2 :: v1) (h :: v1 -> Type) rep s t rep'. (Data.Extensible.Class.Extensible f p e, Type.Membership.Internal.Lookup xs k v2, Data.Extensible.Wrapper.Wrapper h, Data.Extensible.Class.ExtensibleConstr e xs (Data.Extensible.Field.Field h) (k 'Type.Membership.Internal.:> v2), rep GHC.Types.~ Data.Extensible.Wrapper.Repr h v2, s GHC.Types.~ e xs (Data.Extensible.Field.Field h), s GHC.Types.~ t, rep GHC.Types.~ 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 -> Type). Data.Extensible.Wrapper.Wrapper (Data.Extensible.GetOpt.OptionDescr h) -- | 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 => xs :& Compose Dict c -- | 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 -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall GHC.Show.Show h xs => GHC.Show.Show (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Prettyprinter.Internal.Pretty h xs => Prettyprinter.Internal.Pretty (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall GHC.Classes.Eq h xs => GHC.Classes.Eq (xs Data.Extensible.Struct.:& h) instance forall k (xs :: [k]) (h :: k -> Type). (GHC.Classes.Eq (xs Data.Extensible.Struct.:& h), Data.Extensible.Dictionary.WrapForall GHC.Classes.Ord h xs) => GHC.Classes.Ord (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall GHC.Base.Semigroup h xs => GHC.Base.Semigroup (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). (Data.Extensible.Dictionary.WrapForall GHC.Base.Semigroup h xs, Data.Extensible.Dictionary.WrapForall GHC.Base.Monoid h xs) => GHC.Base.Monoid (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). (Data.Extensible.Dictionary.WrapForall GHC.Classes.Eq h xs, Data.Extensible.Dictionary.WrapForall Data.Hashable.Class.Hashable h xs) => Data.Hashable.Class.Hashable (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall GHC.Enum.Bounded h xs => GHC.Enum.Bounded (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Language.Haskell.TH.Syntax.Lift h xs => Language.Haskell.TH.Syntax.Lift (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (x :: k) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Vector.Unboxed.Base.Unbox h (x : xs) => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector ((x : xs) Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (x :: k) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Vector.Unboxed.Base.Unbox h (x : xs) => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector ((x : xs) Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (x :: k) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Vector.Unboxed.Base.Unbox h (x : xs) => Data.Vector.Unboxed.Base.Unbox ((x : xs) Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Test.QuickCheck.Arbitrary.Arbitrary h xs => Test.QuickCheck.Arbitrary.Arbitrary (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Control.DeepSeq.NFData h xs => Control.DeepSeq.NFData (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Csv.Conversion.FromField h xs => Data.Csv.Conversion.FromRecord (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Csv.Conversion.ToField h xs => Data.Csv.Conversion.ToRecord (xs Data.Extensible.Struct.:& h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall GHC.Show.Show h xs => GHC.Show.Show (xs Data.Extensible.Sum.:/ h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall GHC.Classes.Eq h xs => GHC.Classes.Eq (xs Data.Extensible.Sum.:/ h) instance forall k (xs :: [k]) (h :: k -> Type). (GHC.Classes.Eq (xs Data.Extensible.Sum.:/ h), Data.Extensible.Dictionary.WrapForall GHC.Classes.Ord h xs) => GHC.Classes.Ord (xs Data.Extensible.Sum.:/ h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Control.DeepSeq.NFData h xs => Control.DeepSeq.NFData (xs Data.Extensible.Sum.:/ h) instance forall k (h :: k -> Type) (xs :: [k]). (Data.Extensible.Dictionary.WrapForall GHC.Classes.Eq h xs, Data.Extensible.Dictionary.WrapForall Data.Hashable.Class.Hashable h xs) => Data.Hashable.Class.Hashable (xs Data.Extensible.Sum.:/ h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Language.Haskell.TH.Syntax.Lift h xs => Language.Haskell.TH.Syntax.Lift (xs Data.Extensible.Sum.:/ h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Test.QuickCheck.Arbitrary.Arbitrary h xs => Test.QuickCheck.Arbitrary.Arbitrary (xs Data.Extensible.Sum.:/ h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Prettyprinter.Internal.Pretty h xs => Prettyprinter.Internal.Pretty (xs Data.Extensible.Sum.:/ h) instance forall k (h :: k -> Type) (xs :: [k]). Data.Extensible.Dictionary.WrapForall Data.Incremental.Incremental h xs => Data.Incremental.Incremental (xs Data.Extensible.Struct.:& h) instance forall v (h :: v -> Type) (xs :: [Type.Membership.Internal.Assoc GHC.Types.Symbol v]). Type.Membership.Forall (Type.Membership.KeyTargetAre GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Csv.Conversion.FromField h)) xs => Data.Csv.Conversion.FromNamedRecord (xs Data.Extensible.Struct.:& Data.Extensible.Field.Field h) instance forall v (h :: v -> Type) (xs :: [Type.Membership.Internal.Assoc GHC.Types.Symbol v]). Type.Membership.Forall (Type.Membership.KeyTargetAre GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Csv.Conversion.ToField h)) xs => Data.Csv.Conversion.ToNamedRecord (xs Data.Extensible.Struct.:& Data.Extensible.Field.Field h) instance forall v (h :: v -> Type) (xs :: [Type.Membership.Internal.Assoc GHC.Types.Symbol v]). Type.Membership.Forall (Type.Membership.KeyTargetAre GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Aeson.Types.FromJSON.FromJSON h)) xs => Data.Aeson.Types.FromJSON.FromJSON (xs Data.Extensible.Struct.:& Data.Extensible.Field.Field h) instance forall v (h :: v -> Type) (xs :: [Type.Membership.Internal.Assoc GHC.Types.Symbol v]). Type.Membership.Forall (Type.Membership.KeyTargetAre GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Aeson.Types.ToJSON.ToJSON h)) xs => Data.Aeson.Types.ToJSON.ToJSON (xs Data.Extensible.Struct.:& Data.Extensible.Field.Field h) instance forall v (h :: v -> Type) (xs :: [Type.Membership.Internal.Assoc GHC.Types.Symbol v]). Type.Membership.Forall (Type.Membership.KeyTargetAre GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Aeson.Types.FromJSON.FromJSON h)) xs => Data.Aeson.Types.FromJSON.FromJSON (xs Data.Extensible.Struct.:& Data.Extensible.Nullable.Nullable (Data.Extensible.Field.Field h)) instance forall v (h :: v -> Type) (xs :: [Type.Membership.Internal.Assoc GHC.Types.Symbol v]). Type.Membership.Forall (Type.Membership.KeyTargetAre GHC.TypeLits.KnownSymbol (Data.Extensible.Dictionary.Instance1 Data.Aeson.Types.ToJSON.ToJSON h)) xs => Data.Aeson.Types.ToJSON.ToJSON (xs Data.Extensible.Struct.:& Data.Extensible.Nullable.Nullable (Data.Extensible.Field.Field h)) instance forall k1 k2 (c :: k1 -> GHC.Types.Constraint) (h :: k2 -> k1) (x :: k2). 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 forall v (xs :: [Type.Membership.Internal.Assoc GHC.Types.Symbol v]) (h :: v -> Type). Type.Membership.Forall (Type.Membership.KeyIs GHC.TypeLits.KnownSymbol) xs => Data.Csv.Conversion.DefaultOrdered (Data.Extensible.Field.RecordOf h xs) instance forall k1 v1 (xs :: [Type.Membership.Internal.Assoc k1 v1]) (k2 :: k1) (v2 :: v1) (h :: v1 -> Type) a. (Type.Membership.Internal.Lookup xs k2 v2, Data.Extensible.Wrapper.Wrapper h, Data.Extensible.Wrapper.Repr h v2 GHC.Types.~ a) => GHC.Records.HasField k2 (Data.Extensible.Field.RecordOf h xs) a -- | Bit-packed records module Data.Extensible.Bits -- | Bit-vector product. It has similar interface as (:*) but -- fields are packed into r. newtype BitProd r (xs :: [k]) (h :: k -> Type) BitProd :: r -> BitProd r (xs :: [k]) (h :: k -> Type) [unBitProd] :: BitProd r (xs :: [k]) (h :: k -> Type) -> 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 type family TotalBits h xs -- | Fields are instances of FromBits and fit in the representation. type BitFields r xs h = (FromBits r r, TotalBits h xs <= BitWidth r, Forall (Instance1 (FromBits r) h) xs) -- | hlookup for BitProd blookup :: forall x r xs h. (BitFields r xs h, FromBits r (h x)) => Membership xs x -> BitProd r xs h -> h x -- | Update a field of a BitProd. bupdate :: forall x r xs h. (BitFields r xs h, FromBits r (h x)) => Membership xs x -> BitProd r xs h -> h x -> BitProd r xs h -- | Convert a normal extensible record into a bit record. toBitProd :: forall r xs h. BitFields r xs h => (xs :& h) -> BitProd r xs h -- | Convert a normal extensible record into a bit record. fromBitProd :: forall r xs h. BitFields r xs h => BitProd r xs h -> xs :& h -- | Bit-packed record type BitRecordOf r h xs = BitProd r xs (Field h) -- | Bit-packed record type BitRecord r xs = BitRecordOf r Identity xs instance forall r k (xs :: [k]) (h :: k -> Type). Foreign.Storable.Storable r => Foreign.Storable.Storable (Data.Extensible.Bits.BitProd r xs h) instance forall r k (xs :: [k]) (h :: k -> Type). Data.Hashable.Class.Hashable r => Data.Hashable.Class.Hashable (Data.Extensible.Bits.BitProd r xs h) instance forall r k (xs :: [k]) (h :: k -> Type). GHC.Generics.Generic (Data.Extensible.Bits.BitProd r xs h) instance forall r k (xs :: [k]) (h :: k -> Type). GHC.Ix.Ix r => GHC.Ix.Ix (Data.Extensible.Bits.BitProd r xs h) instance forall r k (xs :: [k]) (h :: k -> Type). GHC.Enum.Bounded r => GHC.Enum.Bounded (Data.Extensible.Bits.BitProd r xs h) instance forall r k (xs :: [k]) (h :: k -> Type). GHC.Enum.Enum r => GHC.Enum.Enum (Data.Extensible.Bits.BitProd r xs h) instance forall r k (xs :: [k]) (h :: k -> Type). GHC.Classes.Ord r => GHC.Classes.Ord (Data.Extensible.Bits.BitProd r xs h) instance forall r k (xs :: [k]) (h :: k -> Type). GHC.Classes.Eq r => GHC.Classes.Eq (Data.Extensible.Bits.BitProd r xs h) instance forall k (h :: k -> Type) (xs :: [k]) r. (Type.Membership.Forall (Data.Extensible.Dictionary.Instance1 GHC.Show.Show h) xs, Data.Extensible.Bits.BitFields r xs h) => GHC.Show.Show (Data.Extensible.Bits.BitProd r xs h) 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 -> Type) (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 xs h) 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 GHC.Types.~ (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.Functor.Const.Const a b) instance forall v k r (h :: v -> Type) (x :: Type.Membership.Internal.Assoc k v). (Data.Bits.Bits r, Data.Extensible.Bits.FromBits r (h (Type.Membership.TargetOf x))) => Data.Extensible.Bits.FromBits r (Data.Extensible.Field.Field h x) -- | This module just reexports everything. -- --
-- >>> Proxy :: Proxy (Void, Int -> Int) -- Proxy ---- -- Proxy can even hold types of higher kinds, -- --
-- >>> Proxy :: Proxy Either -- Proxy ---- --
-- >>> Proxy :: Proxy Functor -- Proxy ---- --
-- >>> Proxy :: Proxy complicatedStructure -- Proxy --data Proxy (t :: k) Proxy :: Proxy (t :: k) -- | This class gives the string associated with a type-level symbol. There -- are instances of the class for every concrete literal: "hello", etc. class KnownSymbol (n :: Symbol) -- | Right-to-left composition of functors. The composition of applicative -- functors is always applicative, but the composition of monads is not -- always a monad. newtype Compose (f :: k -> Type) (g :: k1 -> k) (a :: k1) Compose :: f (g a) -> Compose (f :: k -> Type) (g :: k1 -> k) (a :: k1) [getCompose] :: Compose (f :: k -> Type) (g :: k1 -> k) (a :: k1) -> f (g a) infixr 9 `Compose` infixr 9 `Compose`