Modulegenerics-sop-0.5.1.4Haskell2010
Generics.SOP.NP
- 3 types
- 70 values
- Packagegenerics-sop-0.5.1.4
- Exports73
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceNP.hs
Specialization of hap.
Applies a product of (lifted) functions pointwise to a product of suitable arguments.
Specialization of hap.
Applies a product of (lifted) functions pointwise to a product of suitable arguments.
Specialization of hcfoldMap.
Specialization of hcfoldMap.
Deprecated. Use cliftA2_NP instead.
Specialization of hcliftA2'.
Specialization of hcliftA2.
Specialization of hcliftA2.
Specialization of hcliftA3.
Specialization of hcliftA3.
Specialization of hcliftA.
Specialization of hcliftA.
Specialization of hcoerce.
Specialization of hcoerce.
Specialization of hcollapse.
Example:
collapse_NP (K 1 :* K 2 :* K 3 :* Nil)[1,2,3]
Specialization of hcollapse.
Example:
collapse_POP (POP ((K 'a' :* Nil) :* (K 'b' :* K 'c' :* Nil) :* Nil) :: POP (K Char) '[ '[(a :: Type)], '[b, c] ])["a","bc"]
(The type signature is only necessary in this case to fix the kind of the type variables.)
Specialization of hctraverse'.
Specialization of hctraverse'.
Specialization of hctraverse.
Specialization of hctraverse.
Specialization of hctraverse_.
Specialization of hctraverse_.
Specialization of hczipWith3, which is equivalent to hcliftA3.
Specialization of hczipWith3, which is equivalent to hcliftA3.
Specialization of hfromI.
Specialization of hfromI.
Construct a homogeneous n-ary product from a normal Haskell list.
Returns Nothing if the length of the list does not exactly match the expected size of the product.
Lift a constrained function operating on a list-indexed structure to a function on a list-of-list-indexed structure.
This is a variant of hcliftA.
Specification:
hcliftA' p f xs = hpure (fn_2 $ \ AllDictC -> f) ` hap ` allDict_NP p ` hap ` xs
Instances:
hcliftA' :: All2 c xss => proxy c -> (forall xs. All c xs => f xs -> f' xs) -> NP f xss -> NP f' xss
hcliftA' :: All2 c xss => proxy c -> (forall xs. All c xs => f xs -> f' xs) -> NS f xss -> NS f' xss
Deprecated. Use hcliftA3 or hczipWith3 instead.
Like hcliftA', but for ternary functions.
Obtain the head of an n-ary product.
Specialization of hliftA2.
Specialization of hliftA2.
Specialization of hliftA3.
Specialization of hliftA3.
Specialization of hliftA.
Specialization of hliftA.
Compute all projections from an n-ary product.
Each element of the resulting product contains one of the projections.
Specialization of hsequence'.
Specialization of hsequence'.
Specialization of hsequence.
Example:
sequence_NP (Just 1 :* Just 2 :* Nil)Just (I 1 :* I 2 :* Nil)
Specialization of hsequence.
Example:
sequence_POP (POP ((Just 1 :* Nil) :* (Just 2 :* Just 3 :* Nil) :* Nil))Just (POP ((I 1 :* Nil) :* (I 2 :* I 3 :* Nil) :* Nil))
Obtain the tail of an n-ary product.
Specialization of htoI.
Specialization of htoI.
Specialization of htrans.
Specialization of htrans.
Specialization of htraverse'.
Specialization of hctraverse'.
Specialization of htraverse_.
Specialization of htraverse_.
Unwrap a product of products.
An n-ary product.
The product is parameterized by a type constructor f and
indexed by a type-level list xs. The length of the list
determines the number of elements in the product, and if the
i-th element of the list is of type x, then the i-th
element of the product is of type f x.
The constructor names are chosen to resemble the names of the list constructors.
Two common instantiations of f are the identity functor I
and the constant functor K. For I, the product becomes a
heterogeneous list, where the type-level list describes the
types of its components. For K a, the product becomes a
homogeneous list, where the contents of the type-level list are
ignored, but its length still specifies the number of elements.
In the context of the SOP approach to generic programming, an n-ary product describes the structure of the arguments of a single data constructor.
Examples:
I 'x' :* I True :* Nil :: NP I '[ Char, Bool ]
K 0 :* K 1 :* Nil :: NP (K Int) '[ Char, Bool ]
Just 'x' :* Nothing :* Nil :: NP Maybe '[ Char, Bool ]Instances19HTrans, HAp, HCollapse, HPure, HSequence, HTraverse_, …
HTrans NP NPDefined in sop-core-0.5.0.2 · Data.SOP.NPHAp NPDefined in sop-core-0.5.0.2 · Data.SOP.NPHCollapse NPDefined in sop-core-0.5.0.2 · Data.SOP.NPHPure NPDefined in sop-core-0.5.0.2 · Data.SOP.NPHSequence NPDefined in sop-core-0.5.0.2 · Data.SOP.NPHTraverse_ NPDefined in sop-core-0.5.0.2 · Data.SOP.NPAll (Compose Eq f) xs => Eq (NP f xs)Defined in sop-core-0.5.0.2 · Data.SOP.NP(All (Compose Eq f) xs, All (Compose Ord f) xs) => Ord (NP f xs)Defined in sop-core-0.5.0.2 · Data.SOP.NPAll (Compose Show f) xs => Show (NP f xs)Defined in sop-core-0.5.0.2 · Data.SOP.NPAll (Compose Semigroup f) xs => Semigroup (NP f xs)Defined in sop-core-0.5.0.2 · Data.SOP.NP(All (Compose Monoid f) xs, All (Compose Semigroup f) xs) => Monoid (NP f xs)Defined in sop-core-0.5.0.2 · Data.SOP.NPAll (Compose NFData f) xs => NFData (NP f xs)Defined in sop-core-0.5.0.2 · Data.SOP.NPtype CollapseTo NP a = [a]Defined in sop-core-0.5.0.2 · Data.SOP.NPtype Prod NP = NPDefined in sop-core-0.5.0.2 · Data.SOP.NPtype UnProd NP = NSDefined in sop-core-0.5.0.2 · Data.SOP.NS · orphantype AllN NP c = All cDefined in sop-core-0.5.0.2 · Data.SOP.NPtype AllZipN NP c = AllZip cDefined in sop-core-0.5.0.2 · Data.SOP.NPtype Same NP = NPDefined in sop-core-0.5.0.2 · Data.SOP.NPtype SListIN NP = SListIDefined in sop-core-0.5.0.2 · Data.SOP.NP
A product of products.
This is a newtype for an NP of an NP. The elements of the
inner products are applications of the parameter f. The type
POP is indexed by the list of lists that determines the lengths
of both the outer and all the inner products, as well as the types
of all the elements of the inner products.
A POP is reminiscent of a two-dimensional table (but the inner lists can all be of different length). In the context of the SOP approach to generic programming, a POP is useful to represent information that is available for all arguments of all constructors of a datatype.
Instances19HTrans, HAp, HCollapse, HPure, HSequence, HTraverse_, …
HTrans POP POPDefined in sop-core-0.5.0.2 · Data.SOP.NPHAp POPDefined in sop-core-0.5.0.2 · Data.SOP.NPHCollapse POPDefined in sop-core-0.5.0.2 · Data.SOP.NPHPure POPDefined in sop-core-0.5.0.2 · Data.SOP.NPHSequence POPDefined in sop-core-0.5.0.2 · Data.SOP.NPHTraverse_ POPDefined in sop-core-0.5.0.2 · Data.SOP.NPEq (NP (NP f) xss) => Eq (POP f xss)Defined in sop-core-0.5.0.2 · Data.SOP.NPOrd (NP (NP f) xss) => Ord (POP f xss)Defined in sop-core-0.5.0.2 · Data.SOP.NPShow (NP (NP f) xss) => Show (POP f xss)Defined in sop-core-0.5.0.2 · Data.SOP.NPSemigroup (NP (NP f) xss) => Semigroup (POP f xss)Defined in sop-core-0.5.0.2 · Data.SOP.NPMonoid (NP (NP f) xss) => Monoid (POP f xss)Defined in sop-core-0.5.0.2 · Data.SOP.NPNFData (NP (NP f) xss) => NFData (POP f xss)Defined in sop-core-0.5.0.2 · Data.SOP.NPtype CollapseTo POP a = [[a]]Defined in sop-core-0.5.0.2 · Data.SOP.NPtype Prod POP = POPDefined in sop-core-0.5.0.2 · Data.SOP.NPtype UnProd POP = SOPDefined in sop-core-0.5.0.2 · Data.SOP.NS · orphantype AllN POP c = All2 cDefined in sop-core-0.5.0.2 · Data.SOP.NPtype AllZipN POP c = AllZip2 cDefined in sop-core-0.5.0.2 · Data.SOP.NPtype Same POP = POPDefined in sop-core-0.5.0.2 · Data.SOP.NPtype SListIN POP = SListI2Defined in sop-core-0.5.0.2 · Data.SOP.NP
The type of projections from an n-ary product.
A projection is a function from the n-ary product to a single element.