Copyright | (c) Sirui Lu 2024 |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | siruilu@cs.washington.edu |
Stability | Experimental |
Portability | GHC only |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Grisette.Internal.TH.Ctor.UnifiedConstructor
Description
Synopsis
- makeUnifiedCtorWith :: (String -> String) -> Name -> Q [Dec]
- makePrefixedUnifiedCtor :: String -> Name -> Q [Dec]
- makeNamedUnifiedCtor :: [String] -> Name -> Q [Dec]
- makeUnifiedCtor :: Name -> Q [Dec]
Documentation
makeUnifiedCtorWith :: (String -> String) -> Name -> Q [Dec] Source #
Generate smart constructors to create unified values with provided name transformer.
For a type T mode a b c
with constructors T1
, T2
, etc., this function
will generate smart constructors with the name transformed, e.g., given the
name transformer (name -> "mk" ++ name)
, it will generate mkT1
, mkT2
,
mkT2
, etc.
The generated smart constructors will contruct values of type
GetData mode (T mode a b c)
.
makePrefixedUnifiedCtor Source #
Arguments
:: String | Prefix for generated wrappers |
-> Name | The type to generate the wrappers for |
-> Q [Dec] |
Generate smart constructors to create unified values.
For a type T mode a b c
with constructors T1
, T2
, etc., this function
will generate smart constructors with the given prefix, e.g., mkT1
, mkT2
,
etc.
The generated smart constructors will contruct values of type
GetData mode (T mode a b c)
.
Arguments
:: [String] | Names for generated wrappers |
-> Name | The type to generate the wrappers for |
-> Q [Dec] |
Generate smart constructors to create unified values.
For a type T mode a b c
with constructors T1
, T2
, etc., this function
will generate smart constructors with the given names.
The generated smart constructors will contruct values of type
GetData mode (T mode a b c)
.
Generate smart constructors to create unified values.
For a type T mode a b c
with constructors T1
, T2
, etc., this function
will generate smart constructors with the names decapitalized, e.g.,
t1
, t2
, etc.
The generated smart constructors will contruct values of type
GetData mode (T mode a b c)
.