diff options
Diffstat (limited to 'src/LambdaCube/Compiler/Parser.hs')
-rw-r--r-- | src/LambdaCube/Compiler/Parser.hs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/LambdaCube/Compiler/Parser.hs b/src/LambdaCube/Compiler/Parser.hs index e64327de..389d2364 100644 --- a/src/LambdaCube/Compiler/Parser.hs +++ b/src/LambdaCube/Compiler/Parser.hs | |||
@@ -18,7 +18,6 @@ module LambdaCube.Compiler.Parser | |||
18 | , debug, isPi, varDB, lowerDB, upDB, notClosed, cmpDB, MaxDB(..), iterateN, traceD | 18 | , debug, isPi, varDB, lowerDB, upDB, notClosed, cmpDB, MaxDB(..), iterateN, traceD |
19 | , parseLC, runDefParser | 19 | , parseLC, runDefParser |
20 | , getParamsS, addParamsS, getApps, apps', downToS, addForalls | 20 | , getParamsS, addParamsS, getApps, apps', downToS, addForalls |
21 | , mkDesugarInfo, joinDesugarInfo | ||
22 | , Up (..), up1, up | 21 | , Up (..), up1, up |
23 | , Doc, shLam, shApp, shLet, shLet_, shAtom, shAnn, shVar, epar, showDoc, showDoc_, sExpDoc, shCstr, shTuple | 22 | , Doc, shLam, shApp, shLet, shLet_, shAtom, shAnn, shVar, epar, showDoc, showDoc_, sExpDoc, shCstr, shTuple |
24 | , mtrace, sortDefs | 23 | , mtrace, sortDefs |
@@ -1008,9 +1007,6 @@ mkDesugarInfo ss = | |||
1008 | hackHList ("HNil", _) = ("HNil", Left (("hlistNilCase", -1), [("HNil", 0)])) | 1007 | hackHList ("HNil", _) = ("HNil", Left (("hlistNilCase", -1), [("HNil", 0)])) |
1009 | hackHList x = x | 1008 | hackHList x = x |
1010 | 1009 | ||
1011 | joinDesugarInfo (fm, cm) (fm', cm') = (Map.union fm fm', Map.union cm cm') | ||
1012 | |||
1013 | |||
1014 | -------------------------------------------------------------------------------- module exports | 1010 | -------------------------------------------------------------------------------- module exports |
1015 | 1011 | ||
1016 | data Export = ExportModule SIName | ExportId SIName | 1012 | data Export = ExportModule SIName | ExportId SIName |
@@ -1102,19 +1098,17 @@ parseLC f str | |||
1102 | $ str | 1098 | $ str |
1103 | 1099 | ||
1104 | --type DefParser = DesugarInfo -> (Either ParseError [Stmt], [PostponedCheck]) | 1100 | --type DefParser = DesugarInfo -> (Either ParseError [Stmt], [PostponedCheck]) |
1105 | runDefParser :: (MonadFix m, MonadError String m) => DesugarInfo -> DefParser -> m [Stmt] | 1101 | runDefParser :: (MonadFix m, MonadError String m) => DesugarInfo -> DefParser -> m ([Stmt], DesugarInfo) |
1106 | runDefParser ds_ dp = do | 1102 | runDefParser ds_ dp = do |
1107 | 1103 | ||
1108 | ((defs, dns), ds) <- mfix $ \ ~(_, ds) -> do | 1104 | (defs, dns, ds) <- mfix $ \ ~(_, _, ds) -> do |
1109 | let (x, dns) = dp ds | 1105 | let (x, dns) = dp (ds <> ds_) |
1110 | defs <- either (throwError . show) return x | 1106 | defs <- either (throwError . show) return x |
1111 | let ds' = mkDesugarInfo defs `joinDesugarInfo` ds_ | 1107 | return (defs, dns, mkDesugarInfo defs) |
1112 | return ((defs, dns), ds') | ||
1113 | 1108 | ||
1114 | mapM_ (maybe (return ()) throwError) dns | 1109 | mapM_ (maybe (return ()) throwError) dns |
1115 | 1110 | ||
1116 | return $ sortDefs ds defs | 1111 | return (sortDefs ds defs, ds) |
1117 | |||
1118 | 1112 | ||
1119 | -------------------------------------------------------------------------------- pretty print | 1113 | -------------------------------------------------------------------------------- pretty print |
1120 | 1114 | ||