Moduleone-liner-2.1Haskell2010
Generics.OneLiner.Binary
These generic functions allow changing the types of the constant leaves. They require type classes with 2 parameters, the first for the input type and the second for the output type.
All functions without postfix are for instances of Generic, and functions
with postfix 1 are for instances of Generic1 (with kind Type -> Type) which
get an extra argument to specify how to deal with the parameter.
Functions with postfix 01 are also for Generic1 but they get yet another
argument that, like the Generic functions, allows handling of constant leaves.
- 9 types
- 11 classes
- 25 values
- Packageone-liner-2.1
- Exports46
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceBinary.hs
Traversing values
9 declarationsMap each component of a structure to an action linearly, evaluate these actions from left to right, and collect the results.
gltraverse is generic specialized to linear Kleisli.
gtraverse1 is generic1 specialized to Star.
gltraverse1 is generic1 specialized to linear Kleisli.
gltraverse01 is generic01 specialized to linear Kleisli, requiring Movable for constants.
Combining values
2 declarationsFunctions for records
5 declarationsThese functions only work for single constructor data types.
gcotraverse1 is record1 specialized to Costar.
Generic programming with profunctors
9 declarationsAll the above functions have been implemented using these functions,
using different profunctors.
Classes
class (Profunctor p, GenericUnitProfunctor p, GenericProductProfunctor p) => GenericRecordProfunctor (p :: Type -> Type -> Type)A generic function using a GenericRecordProfunctor works on any data type with exactly one constructor, a.k.a. records, with multiple fields (mult) or no fields (unit).
GenericRecordProfunctor is similar to ProductProfuctor from the
product-profunctor package, but using types from GHC.Generics.
Instances1GenericRecordProfunctor
(Profunctor p, GenericUnitProfunctor p, GenericProductProfunctor p) => GenericRecordProfunctor pDefined in one-liner-2.1 · Generics.OneLiner.Classes
class (GenericRecordProfunctor p, GenericSumProfunctor p) => GenericNonEmptyProfunctor (p :: Type -> Type -> Type)A generic function using a GenericNonEmptyProfunctor works on any data type with at least one constructor.
Instances1GenericNonEmptyProfunctor
(GenericRecordProfunctor p, GenericSumProfunctor p) => GenericNonEmptyProfunctor pDefined in one-liner-2.1 · Generics.OneLiner.Classes
class (GenericNonEmptyProfunctor p, GenericEmptyProfunctor p) => GenericProfunctor (p :: Type -> Type -> Type)A generic function using a GenericProfunctor works on any
algebraic data type of kind Type, including those with no constructors and constants.
Instances1GenericProfunctor
(GenericNonEmptyProfunctor p, GenericEmptyProfunctor p) => GenericProfunctor pDefined in one-liner-2.1 · Generics.OneLiner.Classes
class (GenericProfunctor p, GenericConstantProfunctor p) => Generic1Profunctor (p :: Type -> Type -> Type)A generic function using a Generic1Profunctor works on any
algebraic data type of kind Type -> Type, including those with no constructors and constants.
Instances1Generic1Profunctor
(GenericProfunctor p, GenericConstantProfunctor p) => Generic1Profunctor pDefined in one-liner-2.1 · Generics.OneLiner.Classes
Instances13GenericUnitProfunctor, …
Applicative f => GenericUnitProfunctor (Zip f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesApplicative f => GenericUnitProfunctor (Kleisli f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericUnitProfunctor CtorDefined in one-liner-2.1 · Generics.OneLiner.InternalGenericUnitProfunctor TaggedDefined in one-liner-2.1 · Generics.OneLiner.ClassesApplicative f => GenericUnitProfunctor (Star f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesFunctor f => GenericUnitProfunctor (Costar f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericUnitProfunctor (->)Defined in one-liner-2.1 · Generics.OneLiner.ClassesDivisible f => GenericUnitProfunctor (Clown f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesApplicative f => GenericUnitProfunctor (Joker f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericUnitProfunctor (FUN 'One)Defined in one-liner-2.1 · Generics.OneLiner.Classes(GenericUnitProfunctor p, GenericUnitProfunctor q) => GenericUnitProfunctor (Product p q)Defined in one-liner-2.1 · Generics.OneLiner.Classes(Applicative f, GenericUnitProfunctor p) => GenericUnitProfunctor (Tannen f p)Defined in one-liner-2.1 · Generics.OneLiner.Classes(Functor f, Applicative g, Profunctor p, GenericUnitProfunctor p) => GenericUnitProfunctor (Biff p f g)Defined in one-liner-2.1 · Generics.OneLiner.Classes
Instances13GenericProductProfunctor, …
Applicative f => GenericProductProfunctor (Zip f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesApplicative f => GenericProductProfunctor (Kleisli f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericProductProfunctor CtorDefined in one-liner-2.1 · Generics.OneLiner.InternalGenericProductProfunctor TaggedDefined in one-liner-2.1 · Generics.OneLiner.ClassesApplicative f => GenericProductProfunctor (Star f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesFunctor f => GenericProductProfunctor (Costar f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericProductProfunctor (->)Defined in one-liner-2.1 · Generics.OneLiner.ClassesDivisible f => GenericProductProfunctor (Clown f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesApplicative f => GenericProductProfunctor (Joker f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericProductProfunctor (FUN 'One)Defined in one-liner-2.1 · Generics.OneLiner.Classes(GenericProductProfunctor p, GenericProductProfunctor q) => GenericProductProfunctor (Product p q)Defined in one-liner-2.1 · Generics.OneLiner.Classes(Applicative f, GenericProductProfunctor p) => GenericProductProfunctor (Tannen f p)Defined in one-liner-2.1 · Generics.OneLiner.Classes(Functor f, Applicative g, Profunctor p, GenericProductProfunctor p) => GenericProductProfunctor (Biff p f g)Defined in one-liner-2.1 · Generics.OneLiner.Classes
Instances10GenericSumProfunctor, …
Alternative f => GenericSumProfunctor (Zip f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesApplicative f => GenericSumProfunctor (Kleisli f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericSumProfunctor CtorDefined in one-liner-2.1 · Generics.OneLiner.InternalApplicative f => GenericSumProfunctor (Star f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericSumProfunctor (->)Defined in one-liner-2.1 · Generics.OneLiner.ClassesDecidable f => GenericSumProfunctor (Clown f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesAlternative f => GenericSumProfunctor (Joker f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericSumProfunctor (FUN 'One)Defined in one-liner-2.1 · Generics.OneLiner.Classes(GenericSumProfunctor p, GenericSumProfunctor q) => GenericSumProfunctor (Product p q)Defined in one-liner-2.1 · Generics.OneLiner.Classes(Applicative f, GenericSumProfunctor p) => GenericSumProfunctor (Tannen f p)Defined in one-liner-2.1 · Generics.OneLiner.Classes
Instances10GenericEmptyProfunctor, …
Functor f => GenericEmptyProfunctor (Zip f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesApplicative f => GenericEmptyProfunctor (Kleisli f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericEmptyProfunctor CtorDefined in one-liner-2.1 · Generics.OneLiner.InternalFunctor f => GenericEmptyProfunctor (Star f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericEmptyProfunctor (->)Defined in one-liner-2.1 · Generics.OneLiner.ClassesDecidable f => GenericEmptyProfunctor (Clown f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesAlternative f => GenericEmptyProfunctor (Joker f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericEmptyProfunctor (FUN 'One)Defined in one-liner-2.1 · Generics.OneLiner.Classes(GenericEmptyProfunctor p, GenericEmptyProfunctor q) => GenericEmptyProfunctor (Product p q)Defined in one-liner-2.1 · Generics.OneLiner.Classes(Applicative f, GenericEmptyProfunctor p) => GenericEmptyProfunctor (Tannen f p)Defined in one-liner-2.1 · Generics.OneLiner.Classes
Methods
identity :: p c c
Instances10GenericConstantProfunctor, …
Alternative f => GenericConstantProfunctor (Zip f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesApplicative f => GenericConstantProfunctor (Kleisli f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericConstantProfunctor CtorDefined in one-liner-2.1 · Generics.OneLiner.InternalApplicative f => GenericConstantProfunctor (Star f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericConstantProfunctor (->)Defined in one-liner-2.1 · Generics.OneLiner.ClassesDecidable f => GenericConstantProfunctor (Clown f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesAlternative f => GenericConstantProfunctor (Joker f)Defined in one-liner-2.1 · Generics.OneLiner.ClassesGenericConstantProfunctor (FUN 'One)Defined in one-liner-2.1 · Generics.OneLiner.Classes(GenericConstantProfunctor p, GenericConstantProfunctor q) => GenericConstantProfunctor (Product p q)Defined in one-liner-2.1 · Generics.OneLiner.Classes(Applicative f, GenericConstantProfunctor p) => GenericConstantProfunctor (Tannen f p)Defined in one-liner-2.1 · Generics.OneLiner.Classes
Types
12 declarationstype ADTNonEmpty t t' = (Generic t, Generic t', ADTNonEmpty' (Rep t) (Rep t'), Constraints t t' AnyType)ADTNonEmpty is a constraint type synonym. An instance is an ADT with *at least* one constructor.
type ADTRecord t t' = (Generic t, Generic t', ADTRecord' (Rep t) (Rep t'), Constraints t t' AnyType)type Constraints t t' (c :: Type -> Type -> Constraint) = Constraints' (Rep t) (Rep t') c AnyTypeConstraints is a constraint type synonym, containing the constraint
requirements for an instance for t of class c.
It requires an instance of class c for each component of t.
type ADTNonEmpty1 (t :: Type -> Type) (t' :: Type -> Type) = (Generic1 t, Generic1 t', ADTNonEmpty1' (Rep1 t) (Rep1 t'), Constraints1 t t' AnyType)type ADTRecord1 (t :: Type -> Type) (t' :: Type -> Type) = (Generic1 t, Generic1 t', ADTRecord1' (Rep1 t) (Rep1 t'), Constraints1 t t' AnyType)type Constraints1 (t :: Type -> Type) (t' :: Type -> Type) (c :: (Type -> Type) -> (Type -> Type) -> Constraint) = Constraints' (Rep1 t) (Rep1 t') AnyType ctype Constraints01 (t :: Type -> Type) (t' :: Type -> Type) (c0 :: Type -> Type -> Constraint) (c1 :: (Type -> Type) -> (Type -> Type) -> Constraint) = Constraints' (Rep1 t) (Rep1 t') c0 c1Automatically apply a lifted function to a polymorphic argument as many times as possible.
A constraint `FunConstraint c t` is equivalent to the conjunction of
constraints `c s` for every argument type of t.
If r is not a function type:
c a :- FunConstraints c (a -> r)
(c a, c b) :- FunConstraints c (a -> b -> r)
(c a, c b, c d) :- FunConstraints c (a -> b -> d -> r)
Instances2FunConstraints
FunResult r ~ r => FunConstraints c rDefined in one-liner-2.1 · Generics.OneLiner.Internal(c a, FunConstraints c b) => FunConstraints c (a -> b)Defined in one-liner-2.1 · Generics.OneLiner.Internal
Instances1AnyType
AnyType a bDefined in one-liner-2.1 · Generics.OneLiner.Internal