Maintainer | hapytexeu+gh@gmail.com |
---|---|
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
A module hat defines template Haskell expressions to define typeclass instances to prepend and append tuples.
Synopsis
- defineTupleAddUpto :: QuasiQuoter
- defineTupleAppendUpto :: QuasiQuoter
- defineUnboxedTupleAppendFunctionsUpto :: QuasiQuoter
- tupleAddL :: Int -> Dec
- tupleAddR :: Int -> Dec
- tupleAdd :: Int -> [Dec]
- tupleAppend :: Int -> Int -> Dec
- tupleAppendFor :: Int -> [Dec]
- boxedTupleAddLFun :: Name -> Type -> [Type] -> [Dec]
- boxedTupleAddRFun :: Name -> [Type] -> Type -> [Dec]
- boxedTupleAppendFun :: Name -> [Type] -> [Type] -> [Dec]
- unboxedTupleAddLFun :: Name -> Type -> [Type] -> [Dec]
- unboxedTupleAddRFun :: Name -> [Type] -> Type -> [Dec]
- unboxedTupleAppendFun :: Name -> [Type] -> [Type] -> [Dec]
- makeBoxedTupleAddLFun :: Name -> Type -> [Type] -> DecsQ
- makeBoxedTupleAddRFun :: Name -> [Type] -> Type -> DecsQ
- makeBoxedTupleAppendFun :: Name -> [Type] -> [Type] -> DecsQ
- makeUnboxedTupleAddLFun :: Name -> Type -> [Type] -> DecsQ
- makeUnboxedTupleAddRFun :: Name -> [Type] -> Type -> DecsQ
- makeUnboxedTupleAppendFun :: Name -> [Type] -> [Type] -> DecsQ
- boxedAddLClause :: Int -> Name -> Dec
- boxedAddRClause :: Int -> Name -> Dec
- boxedAppendClause :: Int -> Int -> Name -> Dec
- unboxedAddLClause :: Int -> Name -> Dec
- unboxedAddRClause :: Int -> Name -> Dec
- unboxedAppendClause :: Int -> Int -> Name -> Dec
Quasiquoters for typeclass instances
:: QuasiQuoter | A |
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 #
:: QuasiQuoter | A |
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 #
:: QuasiQuoter | A |
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
:: Int | The given length n of the tuples to prepend an element. |
-> Dec | A type instance declaration for an instance of the |
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.
:: Int | The given length n of the tuples to append with an element. |
-> Dec | A type instance declaration for an instance of the |
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.
:: Int | The length m of the first tuple. |
-> Int | The length n of the second tuple. |
-> Dec | An instance of the |
Define a typeclass instance for TupleAppend
where it appens tuples with m and n items with m and n the parameters of the function.
:: Int | The given number l for which typeclass instances of |
-> [Dec] | A list of typeclass instances for the |
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
:: 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 |
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.
:: 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 |
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.
:: 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 |
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.
:: 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 |
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.
:: 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 |
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 #
:: 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 |
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 #
:: 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 #
:: 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 #
:: 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 #
:: 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 #
:: 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 #
:: 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
:: 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.
:: 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.
:: 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
:: 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.
:: 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.
:: 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.