It seems I'm reinventing parts of the wheel here:
http://www.cs.nott.ac.uk/~psznhn/Publications/stancon2018.pdf https://github.com/blueripple/blueripple-research/tree/TypedExpressions/haskell-stan/src/Stan/ModelBuilder/TypedExpressions https://github.com/jfischoff/hs-cmdstan https://github.com/openbrainsrc/hstan/