plumbers-0.0.1: Pointless plumbing combinators

PortabilityGHC only
MaintainerMichael Sloan <>
Safe HaskellNone




This module is used to generate operators that follow the plumbers symbolic convention for routing parameters.



data PlumberSpec Source

Specifies all of the information needed to implement a plumber.




plumberOpE :: Exp -> Exp -> Exp

The plumber implementation

plumberTypes :: Maybe PlumberTypes

Optional explicit type signatures

plumberArities :: [Int]

Arities to generate - 26 is max

plumberPrefix :: String

Prefix to use for operator

baseSpec :: String -> String -> PlumberSpecSource

Creates a plumber spec for the given prefix for the generated operators, and the name of the infix operator to use to construct the implementation.

data PlumberTypes Source

Specifies all of the information needed to construct type declarations for the plumber.




leftType :: Type

Type of the left argument's result

rightType :: Type

Type of the right argument's result

resultType :: Type

Results type. This needs to be wrapped in a forall naming all of the utilized type variables.

baseTypes :: PlumberTypesSource

A basic set of types, which make r' the left type, and r'' the right type. The resultType is a forall that introduces these type variables, and has undefined content. Therefore any implementation in terms of baseTypes needs to redefine resultType, as the Forall has undefined as its content.

implementPlumbers :: PlumberSpec -> DecsQSource

Implements all of the plumbers specified by the given PlumberSpec.

implementPlumber :: PlumberSpec -> String -> DecsQSource

Implement only the specific plumber requested.

operatorNames :: PlumberSpec -> [[String]]Source

All of the operator names that the given PlumberSpec would implement.

aritiesString :: PlumberSpec -> StringSource

For now this is just a string-yielding function, to be evaluated by the user, to generate the line defining the fixities. This code should be pasted below the TH invocation of implementPlumbers

TH Utilities