@@ -154,14 +154,15 @@ expression (L span expr) =
154 return $ function [] (stmts ++ [ ReturnStmt () (Just exp) ]) `call` []
154 return $ function [] (stmts ++ [ ReturnStmt () (Just exp) ]) `call` []
156 MultiIf branches ->
156 MultiIf branches ->
157− do branches' <- forM branches $ \(b,e) -> (,) <$> expression b <*> expression e
157+ do branches' <- forM branches $ \(b,e) -> (,) <$> expression b <*> expression e
158− return $ case last branches of
158+ return $ case last branches of
159− (L _ (Var "Basics.otherwise"), e) -> ifs (init branches') (snd (last branches'))
159+ (L _ (Var "Basics.otherwise"), _) -> els branches'
160− _ -> ifs branches'
160+ (L _ (Literal (Boolean True)), _) -> els branches'
161− (obj "_E.If" `call` [ ref "$moduleName", string (show span) ])
161+ _ -> ifs branches' (obj "_E.If" `call` [ ref "$moduleName", string (show span) ])
163+ els branches = ifs (init branches) (snd (last branches))
163− ifs branches finally = foldr iff finally branches
164+ ifs branches finally = foldr iff finally branches
164− iff (if', then') else' = CondExpr () if' then' else'
165+ iff (if', then') else' = CondExpr () if' then' else'
166 Case e cases ->
167 Case e cases ->
167 do (tempVar,initialMatch) <- Case.toMatch cases
168 do (tempVar,initialMatch) <- Case.toMatch cases