tuple-append-0.1.0.0: A package to append items and tuples into new tuples.
Maintainerhapytexeu+gh@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Data.Tuple.Append.TemplateHaskell

Description

A module hat defines template Haskell expressions to define typeclass instances to prepend and append tuples.

Synopsis

Quasiquoters for typeclass instances

defineTupleAddUpto Source #

Arguments

:: QuasiQuoter

A QuasiQuoter that will construct typeclass instance declarations.

A QuasiQuoter that constructs instances for TupleAddL and TupleAddR for tuples up to length n where n is read as text input for the quasi quoter.

defineTupleAppendUpto Source #

Arguments

:: QuasiQuoter

A QuasiQuoter that will construct typeclass instance declarations.

A QuasiQuoter that constructs instances for TupleAppend for tuples up to length n where n is read as text input for the quasi quoter. For a single n it thus will construct n+1 instances for each tuple length.

Quasiquoters for unboxed tuples

defineUnboxedTupleAppendFunctionsUpto Source #

Arguments

:: QuasiQuoter

A QuasiQuoter that will construct function definitions.

A QuasiQuoter that constructs function declarations with the name unboxedAppend_i_j with i and j the number of items of the unboxed tuples. The items sum up to at most n where n is read as text input for the quasi quoter. For a single n it thus will construct n+1 instances for each tuple length.

Functions to construct typeclass instance declarations

tupleAddL Source #

Arguments

:: Int

The given length n of the tuples to prepend an element.

-> Dec

A type instance declaration for an instance of the TupleAddL typeclass for an n-tuple.

Define a typeclass instance for TupleAddL for a tuple with n elements and an item to construct a tuple with n+1 elements where the item is added at the left side.

tupleAddR Source #

Arguments

:: Int

The given length n of the tuples to append with an element.

-> Dec

A type instance declaration for an instance of the TupleAddR typeclass for an n-tuple.

Define a typeclass instance for TupleAddR for a tuple with n elements and an item to construct a tuple with n+1 elements where the item is added at the right side.

tupleAdd Source #

Arguments

:: Int

The given length n of the tuples to prepend and append with an element.

-> [Dec]

A list of two type instance declarations that contains typeclass instances for TupleAddL and TupleAddR.

Define typeclass instances for TupleAddL and TupleAddR for a tuple with n elements and an item to construct a tuple with n+1 elements where the item is added at the left or the right side.

tupleAppend Source #

Arguments

:: Int

The length m of the first tuple.

-> Int

The length n of the second tuple.

-> Dec

An instance of the TupleAppend typeclass that appends tuples with lengths m and n to a tuple with length m+n.

Define a typeclass instance for TupleAppend where it appens tuples with m and n items with m and n the parameters of the function.

tupleAppendFor Source #

Arguments

:: Int

The given number l for which typeclass instances of TupleAppend will be made with m and n such that l=m+n.

-> [Dec]

A list of typeclass instances for the TupleAppend typeclass.

Define typeclass instances for TupleAppend that will append any tuple of at least size two with any tuple of at least size two such that the sum is the given number.

Function declarations

boxedTupleAddLFun Source #

Arguments

:: Name

The name of the function to construct.

-> Type

The type of the item to add to the tuple, should be a lifted type.

-> [Type]

The types of the boxed tuple, all items should be lifted types.

-> [Dec]

A list that contains two Dec objects: one for the function signature declaration, and one for the function declaration.

Create a function declaration with signature to add an item with a given type to the left side of a boxed tuple with the types of the given list. This will contain two Dec items: one for the signature and one for the function declaration itself.

boxedTupleAddRFun Source #

Arguments

:: Name

The name of the function to construct.

-> [Type]

The types of the boxed tuple, all types should be lifted types.

-> Type

The type of the item to add to the tuple, should be a lifted type.

-> [Dec]

A list that contains two Dec objects: one for the function signature declaration, and one for the function declaration.

Create a function declaration with signature to add an item with a given type to the right side of a boxed tuple with the types of the given list. This will contain two Dec items: one for the signature and one for the function declaration itself.

boxedTupleAppendFun Source #

Arguments

:: Name

The name of the function to construct.

-> [Type]

The types of the first boxed tuple, all types should be lifted types.

-> [Type]

The types of the second boxed tuple, all types should be lifted types.

-> [Dec]

A list that contains two Dec objects: one for the function signature declaration, and one for the function declaration.

Create a function declaration with signature to append a boxed tuple with the types of the first list with a boxed tuple with the types of the second list. This will contain two Dec items: one for the signature and one for the function declaration itself.

unboxedTupleAddLFun Source #

Arguments

:: Name

The name of the function to construct.

-> Type

The type of the item to add to the tuple, this can be a lifted or unlifted type or a type variable.

-> [Type]

The types of the boxed tuple, all types can be lifted or unlifted types or type variables.

-> [Dec]

A list that contains two Dec objects: one for the function signature declaration, and one for the function declaration.

Create a function declaration with signature to add an item with a given type to the left side of an unboxed tuple with the types of the given list. This will contain two Dec items: one for the signature and one for the function declaration itself.

unboxedTupleAddRFun Source #

Arguments

:: Name

The name of the function to construct.

-> [Type]

The types of the boxed tuple, all types can be lifted or unlifted types or type variables.

-> Type

The type of the item to add to the tuple, this can be a lifted or unlifted type or a type variable.

-> [Dec]

A list that contains two Dec objects: one for the function signature declaration, and one for the function declaration.

Create a function declaration with signature to add an item with a given type to the right side of an unboxed tuple with the types of the given list. This will contain two Dec items: one for the signature and one for the function declaration itself.

unboxedTupleAppendFun Source #

Arguments

:: Name

The name of the function to construct.

-> [Type]

The types of the first boxed tuple, all types can be lifted or unlifted types or type variables.

-> [Type]

The types of the second boxed tuple, all types can be lifted or unlifted types or type variables.

-> [Dec]

A list that contains two Dec objects: one for the function signature declaration, and one for the function declaration.

Create a function declaration with signature to append an unboxed tuple with the types of the first list with an unboxed tuple with the types of the second list. This will contain two Dec items: one for the signature and one for the function declaration itself.

Function builders (for template Haskell)

makeBoxedTupleAddLFun Source #

Arguments

:: Name

The name of the function to construct.

-> Type

The type of the item to add to the tuple, should be a lifted type.

-> [Type]

The types of the boxed tuple, all types should be lifted types.

-> DecsQ

A builder to construct the declaration of the signature and a body of the function to add an element at the left side of a tuple.

Create a function declaration with signature to add an item with a given type to the left side of a boxed tuple with the types of the given list. This function can be used with template Haskell.

makeBoxedTupleAddRFun Source #

Arguments

:: Name

The name of the function to construct.

-> [Type]

The types of the boxed tuple, all types should be lifted types.

-> Type

The type of the item to add to the tuple, should be a lifted type.

-> DecsQ

A builder to construct the declaration of the signature and a body of the function to add an element at the right side of a tuple.

Create a function declaration with signature to add an item with a given type to the right side of a boxed tuple with the types of the given list. This function can be used with template Haskell.

makeBoxedTupleAppendFun Source #

Arguments

:: Name

The name of the function to construct.

-> [Type]

The types of the first boxed tuple, all types should be lifted types.

-> [Type]

The types of the second boxed tuple, all types should be lifted types.

-> DecsQ

A builder to construct the declaration of the signature and a body of the function to append the tuples.

Create a function declaration with signature to append a boxed tuple with the types of the first list with a boxed tuple with the types of the second list. This function can be used with template Haskell.

makeUnboxedTupleAddLFun Source #

Arguments

:: Name

The name of the function to construct.

-> Type

The type of the item to add to the tuple, this can be a lifted or unlifted type or a type variable.

-> [Type]

The types of the boxed tuple, all types can be lifted or unlifted types or type variables.

-> DecsQ

A builder to construct the declaration of the signature and a body of the function to add an element at the left side of a tuple.

Create a function declaration with signature to add an item with a given type to the left side of an unboxed tuple with the types of the given list. This function can be used with template Haskell.

makeUnboxedTupleAddRFun Source #

Arguments

:: Name

The name of the function to construct.

-> [Type]

The types of the boxed tuple, all types can be lifted or unlifted types or type variables.

-> Type

The type of the item to add to the tuple, this can be a lifted or unlifted type or a type variable.

-> DecsQ

A builder to construct the declaration of the signature and a body of the function to add an element at the right side of a tuple.

Create a function declaration with signature to add an item with a given type to the right side of an unboxed tuple with the types of the given list. This function can be used with template Haskell.

makeUnboxedTupleAppendFun Source #

Arguments

:: Name

The name of the function to construct.

-> [Type]

The types of the first boxed tuple, all types can be lifted or unlifted types or type variables.

-> [Type]

The types of the second boxed tuple, all types can be lifted or unlifted types or type variables.

-> DecsQ

A builder to construct the declaration of the signature and a body of the function to append the tuples.

Create a function declaration with signature to append an unboxed tuple with the types of the first list with an unboxed tuple with the types of the second list. This function can be used with template Haskell.

Create a function clause

Boxed tuples

boxedAddLClause Source #

Arguments

:: Int

The number of items of the boxed tuple to add an item to.

-> Name

The name of the function to define.

-> Dec

A function declaration that only contains the body of the function.

Create a function declaration to add an item to the left side of a boxed tuple in a new boxed tuple. This only contains a declaration for the body of the function, not a type signature.

boxedAddRClause Source #

Arguments

:: Int

The number of items of the boxed tuple to add an item to.

-> Name

The name of the function to define.

-> Dec

A function declaration that only contains the body of the function.

Create a function declaration to add an item to the right side of a boxed tuple in a new boxed tuple. This only contains a declaration for the body of the function, not a type signature.

boxedAppendClause Source #

Arguments

:: Int

The number of items for the first boxed tuple parameter.

-> Int

The number of items for the second boxed tuple parameter.

-> Name

The name of the function to define.

-> Dec

A function declaration that only contains the body of the function.

Create a function declaration to append two boxed tuples together in a new boxed tuple. This only contains a declaration for the body of the function, not a type signature.

Unboxed tuples

unboxedAddLClause Source #

Arguments

:: Int

The number of items of the unboxed tuple to add an item to.

-> Name

The name of the function to define.

-> Dec

A function declaration that only contains the body of the function.

Create a function declaration to add an item to the left side of an unboxed tuple in a new unboxed tuple. This only contains a declaration for the body of the function, not a type signature.

unboxedAddRClause Source #

Arguments

:: Int

The number of items of the unboxed tuple to add an item to.

-> Name

The name of the function to define.

-> Dec

A function declaration that only contains the body of the function.

Create a function declaration to add an item to the right side of an unboxed tuple in a new unboxed tuple. This only contains a declaration for the body of the function, not a type signature.

unboxedAppendClause Source #

Arguments

:: Int

The number of items for the first unboxed tuple parameter.

-> Int

The number of items for the second unboxed tuple parameter.

-> Name

The name of the function to define.

-> Dec

A function declaration that only contains the body of the function.

Create a function declaration to append two unboxed tuples together in a new unboxed tuple. This only contains a declaration for the body of the function, not a type signature.