| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Ganeti.THH.Types
Description
Utility Template Haskell functions for working with types.
Synopsis
- typeOfFun :: Name -> Q Type
- funArgs :: Type -> ([Type], Type)
- tupleArgs :: Type -> Maybe [Type]
- argumentType :: Type -> Q Type
- uncurryVarType :: Type -> Q Exp
- uncurryVar :: Name -> Q Exp
- curryN :: Int -> Q Exp
- newtype OneTuple a = OneTuple {
- getOneTuple :: a
Documentation
Returns the type of a function. If the given name doesn't correspond to a function, fails.
funArgs :: Type -> ([Type], Type) #
Splits a function type into the types of its arguments and the result.
argumentType :: Type -> Q Type #
Given a type of the form m a, this function extracts a.
If the given type is of another form, it fails with an error message.
uncurryVarType :: Type -> Q Exp #
Generic uncurry that counts the number of function arguments in a type
and constructs the appropriate uncurry function into i -> o.
It the type has no arguments, it's converted into () -> o.
uncurryVar :: Name -> Q Exp #
Creates an uncurried version of a function.
If the function has no arguments, it's converted into () -> o.
This fills the gap between () and (,), providing a wrapper for
1-element tuples. It's needed for RPC, where arguments for a function are
sent as a list of values, and therefore for 1-argument functions we need
this wrapper, which packs/unpacks 1-element lists.
Constructors
| OneTuple | |
Fields
| |
Instances
| Functor OneTuple # | |
| Show a => Show (OneTuple a) # | |
| Eq a => Eq (OneTuple a) # | |
| Ord a => Ord (OneTuple a) # | |
| JSON a => JSON (OneTuple a) # | |