Template Haskell code is untyped, which is a bummer and leads to late error reporting. We make code expressions typed, at least for our particular domain.

- data Code a
- data Var a
- type QCode a = Q (Code a)
- reflectQC :: Q (Code a) -> Q Exp
- showQC :: Q (Code a) -> IO ()
- op'add :: Num a => Code (a -> a -> a)
- op'sub :: Num a => Code (a -> a -> a)
- op'mul :: Num a => Code (a -> a -> a)
- op'div :: Fractional a => Code (a -> a -> a)
- op'negate :: Num a => Code (a -> a)
- op'recip :: Fractional a => Code (a -> a)
- op'sin :: Floating a => Code (a -> a)
- op'cos :: Floating a => Code (a -> a)
- op'pi :: Floating a => Code a
- appC :: Code (a -> b) -> Code a -> Code b
- integerC :: Num a => Integer -> Code a
- rationalC :: Fractional a => Rational -> Code a
- new'diffVar :: Q (Var a)
- var'exp :: Var a -> Code a
- reflectDF :: Var a -> Code a -> QCode (a -> a)
- on'varC :: Var a -> Code b -> Maybe (Either (Var a) (Var b))
- on'litC :: Code a -> Maybe (Code a)
- on'litRationalC :: Code a -> Maybe Rational
- on'1opC :: Code (a -> b) -> Code d -> Maybe (Code a)
- on'2opC :: Code (a -> b -> c) -> Code d -> Maybe (Code a, Code b)

# Documentation

The data type of a typed TH code experssion. The phantom parameter `a`

is the type.

reflectQC :: Q (Code a) -> Q ExpSource

This function is useful when splicing code expressions See DiffTest.hs for the examples of its use.

op'div :: Fractional a => Code (a -> a -> a)Source

op'recip :: Fractional a => Code (a -> a)Source

rationalC :: Fractional a => Rational -> Code aSource

new'diffVar :: Q (Var a)Source

A distinguished variable (over which we differentiate)

on'litC :: Code a -> Maybe (Code a)Source

Intensional code analysis Alas, TH.Exp is not a GADT. So, we have to do their emulation...

on'litRationalC :: Code a -> Maybe RationalSource