api-tools-0.8.0.1: DSL for generating API boilerplate and docs

Safe HaskellNone
LanguageHaskell2010

Data.API.TH

Description

This module defines some utilities for working with Template Haskell, which may be useful for defining Tools, but should be considered internal implementation details of this package.

Synopsis

Documentation

applicativeE :: ExpQ -> [ExpQ] -> ExpQ Source #

Construct an idiomatic expression (an expression in an Applicative context), i.e.

app ke []             = ke
app ke [e1,e2,...,en] = ke <$> e1 <*> e2 ... <*> en

optionalInstanceD :: ToolSettings -> Name -> [TypeQ] -> [DecQ] -> Q [Dec] Source #

Add an instance declaration for a class, if such an instance does not already exist

funSigD :: Name -> TypeQ -> [ClauseQ] -> Q [Dec] Source #

Construct a TH function with a type signature

simpleD :: Name -> ExpQ -> Q Dec Source #

Construct a simple TH definition

simpleSigD :: Name -> TypeQ -> ExpQ -> Q [Dec] Source #

Construct a simple TH definition with a type signature

fieldNameE :: FieldName -> ExpQ Source #

Field name as a string expression

fieldNameVarE :: FieldName -> ExpQ Source #

Field name as a variable