diff --git a/src/Gyehoek/Scheme/Expand.hs b/src/Gyehoek/Scheme/Expand.hs index 5f06f81..500f542 100644 --- a/src/Gyehoek/Scheme/Expand.hs +++ b/src/Gyehoek/Scheme/Expand.hs @@ -218,6 +218,31 @@ matches ps es = getAp . foldMap Ap $ alignWith f ps es +trans_when :: Trans +trans_when = MkTrans + { ellipsis = "..." + , keywords = [] + , rules = + [ MkRule + (PatList + [ PatVar "when" + , PatVar "test" + , PatVar "body" ] + (Just []) + Nothing) + (TemList + [ El $ TemVar "if" + , El $ TemVar "test" + , El $ TemList + [ El $ TemVar "begin" + , Ellipsis $ TemVar "body" + ] + Nothing + ] + Nothing) + ] + } + trans_and :: Trans trans_and = MkTrans { ellipsis = "..." @@ -229,5 +254,27 @@ trans_and = MkTrans Nothing Nothing) (TemLit (LitBool True)) + , MkRule + (PatList + [PatVar "and", PatVar "x"] + Nothing + Nothing) + (TemVar "x") + , MkRule + (PatList + [PatVar "and", PatVar "x", PatVar "y"] + (Just []) + Nothing) + (TemList + [ El (TemVar "if") + , El (TemVar "x") + , El (TemList + [ El (TemVar "and") + , Ellipsis (TemVar "y") + ] + Nothing) + , El . TemLit . LitBool $ False + ] + Nothing) ] }