The basic binary operations.

This commit is contained in:
2019-07-15 21:00:12 -07:00
parent fa872c951a
commit ab465296f2
3 changed files with 108 additions and 12 deletions

View File

@@ -7,6 +7,9 @@ module Gen(
blank,
out,
wrapIndent,
implFor,
implFor',
implFor'',
)
where
@@ -70,4 +73,16 @@ wrapIndent val middle =
res <- indent middle
tell (replicate (fromIntegral (indentAmount gs)) ' ')
tell "}\n"
return res
return res
implFor :: String -> String -> Gen a -> Gen a
implFor trait name middle =
wrapIndent ("impl " ++ trait ++ " for " ++ name) middle
implFor' :: String -> String -> Gen a -> Gen a
implFor' trait name middle =
wrapIndent ("impl<'a> " ++ trait ++ " for " ++ name) middle
implFor'' :: String -> String -> Gen a -> Gen a
implFor'' trait name middle =
wrapIndent ("impl<'a,'b> " ++ trait ++ " for " ++ name) middle