Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
Pronounced "with code", this datatype is the representation for user-land values. It pairs
a value up with its representation as Haskell Code
. It should be manipulated using
Quapplicative
.
Since: 0.1.0.0
type Code a = Q (TExp a) Source #
A type alias for typed template haskell code, which represents the Haskell AST for a given value.
Since: 0.1.0.0
class Quapplicative q where Source #
This class is used to manipulate the representations of both user-land values and defunctionalised representations. It can be used to construct these values as well as extract their underlying value and code representation on demand.
It is named after the Applicative
class, with the Q
standing for "code". The (
operator
is analogous to >*<
)(<*>)
and makeQ
analogous to pure
.
Since: 0.1.0.0
makeQ :: a -> Code a -> q a Source #
Combines a value with its representation to build one of the representation types.
Since: 0.1.0.0
Extracts the regular value out of the representation.
Since: 0.1.0.0
_code :: q a -> Code a Source #
Extracts the representation of the value as code.
Since: 0.1.0.0
(>*<) :: q (a -> b) -> q a -> q b infixl 9 Source #
Pronounced "quapp", this can be used to combine the code of a function with the code of a value.
const5 = makeQ const [||const||] >*< makeQ 5 [||5||]
is the same as saying
const5 = makeQ (const 5) [||const 5||]
It is more idiomatically found as the output to the IdiomsPlugin
.
Since: 0.1.0.0
Instances
Quapplicative WQ Source # | This instance is used to manipulate values of Since: 0.1.0.0 |
Quapplicative Defunc Source # | This instance is used to manipulate values of Since: 0.1.0.0 |
intercalate :: Monoid w => w -> [w] -> w Source #
intercalateDiff :: (a -> a) -> [a -> a] -> a -> a Source #