names-th-0.2.0.3: Manipulate name strings for TH

Copyright | 2013 Kei Hibino
License | BSD3
Maintainer | ex8k.hibino@gmail.com
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Language.Haskell.TH.Name.CamelCase

Contents

- Types to wrap `Name`
- Functions to make camel-cased names
- Functions to generate haskell template from names

Description

This module provides camelcased `Name` for Template Haskell

Synopsis

- newtype ConName = ConName {
  - conName :: Name
  }
- toConName :: String -> ConName
- newtype VarName = VarName {
  - varName :: Name
  }
- toVarName :: String -> VarName
- conCamelcaseName :: String -> ConName
- varCamelcaseName :: String -> VarName
- varNameWithPrefix :: String -> String -> VarName
- toTypeCon :: ConName -> TypeQ
- toDataCon :: ConName -> ExpQ
- toVarExp :: VarName -> ExpQ
- toVarPat :: VarName -> PatQ

# Types to wrap `Name`

Wrap `Name` to distinguish constructor names and variable names.

newtype ConName Source #

Type to wrap constructor's `Name`.

Constructors

ConName |

Fields

- conName :: Name

  Get wrapped `Name`

toConName :: String -> ConName Source #

Make constructor name from `String`.

newtype VarName Source #

Type to wrap variable's `Name`.

Constructors

VarName |

Fields

- varName :: Name

  Get wrapped `Name`

toVarName :: String -> VarName Source #

Make variable name from `String`.

# Functions to make camel-cased names

Make camel-cased names.

conCamelcaseName :: String -> ConName Source #

Make camel-cased constructor name from `String`.

varCamelcaseName :: String -> VarName Source #

Make camel-cased variable name from `String`.

varNameWithPrefix :: String -> String -> VarName Source #

Make camel-cased variable name with prefix like below.

     name `varNamePrefix` prefix

# Functions to generate haskell template from names

Make haskell templates from names.

toTypeCon :: ConName -> TypeQ Source #

Make type constructor `TypeQ` monad from constructor name type.

toDataCon :: ConName -> ExpQ Source #

Make data constructor `ExpQ` monad from constructor name type.

toVarExp :: VarName -> ExpQ Source #

Make variable `ExpQ` monad from variable name type.

toVarPat :: VarName -> PatQ Source #

Make pattern `PatQ` monad from variable name type.