diff --git a/src/Compiler/RLPC.hs b/src/Compiler/RLPC.hs index 5468223..c75ac95 100644 --- a/src/Compiler/RLPC.hs +++ b/src/Compiler/RLPC.hs @@ -183,6 +183,7 @@ putRlpcErrs opts = filter byTag byTag :: MsgEnvelope RlpcError -> Bool byTag (view msgSeverity -> SevDebug t) = t `S.member` dflags + byTag _ = True prettyRlpcMsg :: MsgEnvelope RlpcError -> String prettyRlpcMsg m@(view msgSeverity -> SevDebug _) = prettyRlpcDebugMsg m diff --git a/src/Rlp2Core.hs b/src/Rlp2Core.hs index 7fa52df..4e4d279 100644 --- a/src/Rlp2Core.hs +++ b/src/Rlp2Core.hs @@ -95,14 +95,16 @@ exprToCore :: (NameSupply :> es) => RlpExpr RlpcPs -> Eff es Expr' exprToCore (VarE n) = pure $ Var (dsNameToName n) -exprToCore (CaseE (unXRec -> e) as) = undefined +exprToCore (CaseE (unXRec -> e) as) = do + e' <- exprToCore e + Case e' <$> caseAltToCore `traverse` as -- TODO: where-binds caseAltToCore :: (NameSupply :> es) => (Alt RlpcPs, Where RlpcPs) -> Eff es Alter' -caseAltToCore (AltA (extract -> p) e, wh) = undefined - where - +caseAltToCore (AltA (unXRec -> p) e, wh) = do + e' <- exprToCore . unXRec $ e + conToRose p <&> foldFix (branchToCore e') conToRose :: forall es. (NameSupply :> es) => Pat RlpcPs -> Eff es Rose conToRose (ConP cn as) = Fix . Branch cn <$> patToForrest `traverse` as