- = tell [createArray i '\t', x, " = "] >>| fmtField l >>| tell [");\n"] >>| fmtFields i r xs
-
- fmtField :: GenType -> TPMonad
- fmtField (GenTypeCons a) = tell ["parse_", safe a, "(get"]
- fmtField (GenTypeVar a) = tell ["parse_", toString a, "(get"]
- fmtField t=:(GenTypeApp _ _)
- = let [x:xs] = ufold t in fmtField x >>| case ufold t of
- [] = tell [")"]
- xs = tell [", "] >>| sequence_ (intersperse (tell [", "]) (map (\s->fmtField s >>| tell [")"]) xs))
+ = tell [createArray i '\t', x, " = "] >>| tell (fmtField l []) >>| tell [");\n"] >>| fmtFields i r xs
+
+ fmtField :: GenType [String] -> [String]
+ fmtField (GenTypeCons a) c = ["parse_", safe a, "(get":c]
+ fmtField (GenTypeVar a) c = ["parse_", toString a, "(get":c]
+ fmtField t=:(GenTypeApp _ _) c = ufold t c