I have written a simple program using the GHC API, which outputs the following for a simple module...

Fish.f [T] :: GHC.Num.Integer
[]
{ lit_auR = fromInteger 1
fromInteger = GHC.Num.fromInteger GHC.Num.Integer $dNum
lit_auQ = lit_auR
+ = (GHC.Num.+) GHC.Num.Integer $dNum
$dNum = $dNum
f = 1 + 1 }, $dNum = GHC.Num.$f3

That uses the pretty printer - so now I need to work out the data structure that GHC is using for its AST and then extract the information from it and map it into Programatica's AST.