@@ -36,7 +36,7 @@ import Idris.Parser.Ops
36import Idris.Termination
36import Idris.Termination
37import Idris.Unlit
37import Idris.Unlit
39−import qualified Util.Pretty as P
39+import qualified Util.Pretty
40import Util.System (readSource)
40import Util.System (readSource)
42import Prelude hiding (pi)
42import Prelude hiding (pi)
@@ -59,9 +59,9 @@ import qualified System.Directory as Dir (makeAbsolute)
59import System.FilePath
59import System.FilePath
60import Text.PrettyPrint.ANSI.Leijen (Doc, plain)
60import Text.PrettyPrint.ANSI.Leijen (Doc, plain)
61import qualified Text.PrettyPrint.ANSI.Leijen as ANSI
61import qualified Text.PrettyPrint.ANSI.Leijen as ANSI
62−import Text.Trifecta hiding (Err, char, charLiteral, natural, span, string,
62+import Text.Trifecta ((<?>))
63− stringLiteral, symbol, whiteSpace)
63+import qualified Text.Trifecta as P
64−import Text.Trifecta.Delta
64+import qualified Text.Trifecta.Delta as P
@@ -84,17 +84,17 @@ import Text.Trifecta.Delta
86moduleHeader :: IdrisParser (Maybe (Docstring ()), [String], [(FC, OutputAnnotation)])
86moduleHeader :: IdrisParser (Maybe (Docstring ()), [String], [(FC, OutputAnnotation)])
87−moduleHeader = try (do docs <- optional docComment
87+moduleHeader = P.try (do docs <- optional docComment
88− noArgs docs
88+ noArgs docs
89− reservedHL "module"
89+ reservedHL "module"
90− (i, ifc) <- identifier
90+ (i, ifc) <- identifier
91− option ';' (lchar ';')
91+ P.option ';' (lchar ';')
92− let modName = moduleName i
92+ let modName = moduleName i
93− return (fmap fst docs,
93+ return (fmap fst docs,
95− [(ifc, AnnNamespace (map T.pack modName) Nothing)]))
95+ [(ifc, AnnNamespace (map T.pack modName) Nothing)]))
96− <|> try (do lchar '%'; reserved "unqualified"
96+ <|> P.try (do lchar '%'; reserved "unqualified"
97− return (Nothing, [], []))
97+ return (Nothing, [], []))
98 <|> return (Nothing, moduleName "Main", [])
98 <|> return (Nothing, moduleName "Main", [])
99 where moduleName x = case span (/='.') x of
99 where moduleName x = case span (/='.') x of
100 (x, "") -> [x]
100 (x, "") -> [x]
@@ -119,12 +119,11 @@ data ImportInfo = ImportInfo { import_reexport :: Bool
119import_ :: IdrisParser ImportInfo
119import_ :: IdrisParser ImportInfo
120import_ = do fc <- getFC
120import_ = do fc <- getFC
121 reservedHL "import"
121 reservedHL "import"
122− reexport <- option False (do reservedHL "public"
122+ reexport <- P.option False (True <$ reservedHL "public")
124 (id, idfc) <- identifier
123 (id, idfc) <- identifier
125 newName <- optional (do reservedHL "as"
124 newName <- optional (do reservedHL "as"
126 identifier)
125 identifier)
127− option ';' (lchar ';')
126+ P.option ';' (lchar ';')
128 return $ ImportInfo reexport (toPath id)
127 return $ ImportInfo reexport (toPath id)
129 (fmap (\(n, fc) -> (toPath n, fc)) newName)
128 (fmap (\(n, fc) -> (toPath n, fc)) newName)
130 (map T.pack $ ns id) fc idfc
129 (map T.pack $ ns id) fc idfc
@@ -143,7 +142,7 @@ prog syn = do whiteSpace
143 decls <- many (decl syn)
142 decls <- many (decl syn)
144 let c = concat decls
143 let c = concat decls
145 case maxline syn of
144 case maxline syn of
146− Nothing -> do notOpenBraces; eof
145+ Nothing -> do notOpenBraces; P.eof
147 _ -> return ()
146 _ -> return ()
148 ist <- get
147 ist <- get
149 fc <- getFC
148 fc <- getFC
@@ -172,7 +171,7 @@ Decl ::=
174decl :: SyntaxInfo -> IdrisParser [PDecl]
173decl :: SyntaxInfo -> IdrisParser [PDecl]
175−decl syn = try (externalDecl syn)
174+decl syn = P.try (externalDecl syn)
176 <|> internalDecl syn
175 <|> internalDecl syn
177 <?> "declaration"
176 <?> "declaration"
@@ -195,13 +194,13 @@ internalDecl syn
195 if continue then
194 if continue then
196 do notEndBlock
195 do notEndBlock
197 declBody continue
196 declBody continue
198− else try (do notEndBlock
197+ else P.try (do notEndBlock
199− declBody continue)
198+ declBody continue)
200 <|> fail "End of readable input"
199 <|> fail "End of readable input"
201 where declBody :: Bool -> IdrisParser [PDecl]
200 where declBody :: Bool -> IdrisParser [PDecl]
202 declBody b =
201 declBody b =
203− try (implementation True syn)
202+ P.try (implementation True syn)
204− <|> try (openInterface syn)
203+ <|> P.try (openInterface syn)
205 <|> declBody' b
204 <|> declBody' b
206 <|> using_ syn
205 <|> using_ syn
207 <|> params syn
206 <|> params syn
@@ -276,9 +275,9 @@ declExtensions syn rules = declExtension syn [] (filter isDeclRule rules)
276declExtension :: SyntaxInfo -> [Maybe (Name, SynMatch)] -> [Syntax]
275declExtension :: SyntaxInfo -> [Maybe (Name, SynMatch)] -> [Syntax]
277 -> IdrisParser [PDecl]
276 -> IdrisParser [PDecl]
278declExtension syn ns rules =
277declExtension syn ns rules =
279− choice $ flip map (groupBy (ruleGroup `on` syntaxSymbols) rules) $ \rs ->
278+ P.choice $ flip map (groupBy (ruleGroup `on` syntaxSymbols) rules) $ \rs ->
280 case head rs of -- can never be []
279 case head rs of -- can never be []
281− DeclRule (symb:_) _ -> try $ do
280+ DeclRule (symb:_) _ -> P.try $ do
282 n <- extSymbol symb
281 n <- extSymbol symb
283 declExtension syn (n : ns) [DeclRule ss t | (DeclRule (_:ss) t) <- rs]
282 declExtension syn (n : ns) [DeclRule ss t | (DeclRule (_:ss) t) <- rs]
284 -- If we have more than one Rule in this bucket, our grammar is
283 -- If we have more than one Rule in this bucket, our grammar is
@@ -427,28 +426,28 @@ SyntaxSym ::= '[' Name_t ']'
428syntaxRule :: SyntaxInfo -> IdrisParser Syntax
427syntaxRule :: SyntaxInfo -> IdrisParser Syntax
429syntaxRule syn
428syntaxRule syn
430− = do sty <- try (do
429+ = do sty <- P.try (do
431 pushIndent
430 pushIndent
432− sty <- option AnySyntax
431+ sty <- P.option AnySyntax
433− (do reservedHL "term"; return TermSyntax
432+ (TermSyntax <$ reservedHL "term"
434− <|> do reservedHL "pattern"; return PatternSyntax)
433+ <|> PatternSyntax <$ reservedHL "pattern")
435 reservedHL "syntax"
434 reservedHL "syntax"
436 return sty)
435 return sty)
437 syms <- some syntaxSym
436 syms <- some syntaxSym
438− when (all isExpr syms) $ unexpected "missing keywords in syntax rule"
437+ when (all isExpr syms) $ P.unexpected "missing keywords in syntax rule"
439 let ns = mapMaybe getName syms
438 let ns = mapMaybe getName syms
440 when (length ns /= length (nub ns))
439 when (length ns /= length (nub ns))
441− $ unexpected "repeated variable in syntax rule"
440+ $ P.unexpected "repeated variable in syntax rule"
442 lchar '='
441 lchar '='
443 tm <- typeExpr (allowImp syn) >>= uniquifyBinders [n | Binding n <- syms]
442 tm <- typeExpr (allowImp syn) >>= uniquifyBinders [n | Binding n <- syms]
444 terminator
443 terminator
445 return (Rule (mkSimple syms) tm sty)
444 return (Rule (mkSimple syms) tm sty)
446 <|> do reservedHL "decl"; reservedHL "syntax"
445 <|> do reservedHL "decl"; reservedHL "syntax"
447 syms <- some syntaxSym
446 syms <- some syntaxSym
448− when (all isExpr syms) $ unexpected "missing keywords in syntax rule"
447+ when (all isExpr syms) $ P.unexpected "missing keywords in syntax rule"
449 let ns = mapMaybe getName syms
448 let ns = mapMaybe getName syms
450 when (length ns /= length (nub ns))
449 when (length ns /= length (nub ns))
451− $ unexpected "repeated variable in syntax rule"
450+ $ P.unexpected "repeated variable in syntax rule"
452 lchar '='
451 lchar '='
453 openBlock
452 openBlock
454 dec <- some (decl syn)
453 dec <- some (decl syn)
@@ -544,10 +543,10 @@ SyntaxSym ::= '[' Name_t ']'
546syntaxSym :: IdrisParser SSymbol
545syntaxSym :: IdrisParser SSymbol
547−syntaxSym = try (do lchar '['; n <- fst <$> name; lchar ']'
546+syntaxSym = P.try (do lchar '['; n <- fst <$> name; lchar ']'
548− return (Expr n))
547+ return (Expr n))
549− <|> try (do lchar '{'; n <- fst <$> name; lchar '}'
548+ <|> P.try (do lchar '{'; n <- fst <$> name; lchar '}'
550− return (Binding n))
549+ return (Binding n))
551 <|> do n <- fst <$> iName []
550 <|> do n <- fst <$> iName []
552 return (Keyword n)
551 return (Keyword n)
553 <|> do sym <- fmap fst stringLiteral
552 <|> do sym <- fmap fst stringLiteral
@@ -561,11 +560,11 @@ syntaxSym = try (do lchar '['; n <- fst <$> name; lchar ']'
563fnDecl :: SyntaxInfo -> IdrisParser [PDecl]
562fnDecl :: SyntaxInfo -> IdrisParser [PDecl]
564−fnDecl syn = try (do notEndBlock
563+fnDecl syn = P.try (do notEndBlock
565− d <- fnDecl' syn
564+ d <- fnDecl' syn
566− i <- get
565+ i <- get
567− let d' = fmap (desugar syn i) d
566+ let d' = fmap (desugar syn i) d
568− return [d']) <?> "function declaration"
567+ return [d']) <?> "function declaration"
570{-| Parses a function declaration
569{-| Parses a function declaration
@@ -580,7 +579,7 @@ fnDecl syn = try (do notEndBlock
581fnDecl' :: SyntaxInfo -> IdrisParser PDecl
580fnDecl' :: SyntaxInfo -> IdrisParser PDecl
582fnDecl' syn = checkDeclFixity $
581fnDecl' syn = checkDeclFixity $
583− do (doc, argDocs, fc, opts', n, nfc, acc) <- try (do
582+ do (doc, argDocs, fc, opts', n, nfc, acc) <- P.try (do
584 pushIndent
583 pushIndent
585 (doc, argDocs) <- docstring syn
584 (doc, argDocs) <- docstring syn
586 (opts, acc) <- fnOpts
585 (opts, acc) <- fnOpts
@@ -658,41 +657,32 @@ NameTimesList ::=
659fnOpt :: IdrisParser FnOpt
658fnOpt :: IdrisParser FnOpt
660fnOpt = do reservedHL "total"; return TotalFn
659fnOpt = do reservedHL "total"; return TotalFn
661− <|> do reservedHL "partial"; return PartialFn
660+ <|> PartialFn <$ reservedHL "partial"
662− <|> do reservedHL "covering"; return CoveringFn
661+ <|> CoveringFn <$ reservedHL "covering"
663− <|> do try (lchar '%' *> reserved "export"); c <- fmap fst stringLiteral;
662+ <|> do P.try (lchar '%' *> reserved "export"); c <- fmap fst stringLiteral;
664− return $ CExport c
663+ return $ CExport c
665− <|> do try (lchar '%' *> reserved "no_implicit");
664+ <|> NoImplicit <$ P.try (lchar '%' *> reserved "no_implicit")
667− <|> do try (lchar '%' *> reserved "inline");
665+ <|> Inlinable <$ P.try (lchar '%' *> reserved "inline")
668− return Inlinable
666+ <|> StaticFn <$ P.try (lchar '%' *> reserved "static")
669− <|> do try (lchar '%' *> reserved "static");
671− <|> do try (lchar '%' *> reserved "assert_total");
667+ <|> do P.try (lchar '%' *> reserved "assert_total");
672 fc <- getFC
668 fc <- getFC
673 parserWarning fc Nothing (Msg "%assert_total is deprecated. Use the 'assert_total' function instead.")
669 parserWarning fc Nothing (Msg "%assert_total is deprecated. Use the 'assert_total' function instead.")
674 return AssertTotal
670 return AssertTotal
675− <|> do try (lchar '%' *> reserved "error_handler");
671+ <|> ErrorHandler <$ P.try (lchar '%' *> reserved "error_handler")
677− <|> do try (lchar '%' *> reserved "error_reverse");
672+ <|> ErrorReverse <$ P.try (lchar '%' *> reserved "error_reverse")
679− <|> do try (lchar '%' *> reserved "error_reduce");
673+ <|> ErrorReduce <$ P.try (lchar '%' *> reserved "error_reduce")
681− <|> do try (lchar '%' *> reserved "reflection");
683− <|> do try (lchar '%' *> reserved "hint");
674+ <|> Reflection <$ P.try (lchar '%' *> reserved "reflection")
685− <|> do try (lchar '%' *> reserved "overlapping");
675+ <|> AutoHint <$ P.try (lchar '%' *> reserved "hint")
686− return OverlappingDictionary
676+ <|> OverlappingDictionary <$ P.try (lchar '%' *> reserved "overlapping")
687 <|> do lchar '%'; reserved "specialise";
677 <|> do lchar '%'; reserved "specialise";
688− lchar '['; ns <- sepBy nameTimes (lchar ','); lchar ']';
678+ lchar '['; ns <- P.sepBy nameTimes (lchar ','); lchar ']';
689 return $ Specialise ns
679 return $ Specialise ns
690− <|> do reservedHL "implicit"; return Implicit
680+ <|> Implicit <$ reservedHL "implicit"
691 <?> "function modifier"
681 <?> "function modifier"
692 where nameTimes :: IdrisParser (Name, Maybe Int)
682 where nameTimes :: IdrisParser (Name, Maybe Int)
693 nameTimes = do n <- fst <$> fnName
683 nameTimes = do n <- fst <$> fnName
694− t <- option Nothing (do reds <- fmap fst natural
684+ t <- P.option Nothing (do reds <- fmap fst natural
695− return (Just (fromInteger reds)))
685+ return (Just (fromInteger reds)))
696 return (n, t)
686 return (n, t)
698{-| Parses a postulate
688{-| Parses a postulate
@@ -705,10 +695,10 @@ Postulate ::=
706postulate :: SyntaxInfo -> IdrisParser PDecl
696postulate :: SyntaxInfo -> IdrisParser PDecl
707postulate syn = do (doc, ext)
697postulate syn = do (doc, ext)
708− <- try $ do (doc, _) <- docstring syn
698+ <- P.try $ do (doc, _) <- docstring syn
709− pushIndent
699+ pushIndent
710− ext <- ppostDecl
700+ ext <- ppostDecl
711− return (doc, ext)
701+ return (doc, ext)
712 ist <- get
702 ist <- get
713 (opts, acc) <- fnOpts
703 (opts, acc) <- fnOpts
714 (n_in, nfc) <- fnName
704 (n_in, nfc) <- fnName
@@ -768,7 +758,7 @@ openInterface syn =
768 do reservedHL "using"
758 do reservedHL "using"
769 reservedHL "implementation"
759 reservedHL "implementation"
770 fc <- getFC
760 fc <- getFC
771− ns <- sepBy1 fnName (lchar ',')
761+ ns <- P.sepBy1 fnName (lchar ',')
773 openBlock
763 openBlock
774 ds <- many (decl syn)
764 ds <- many (decl syn)
@@ -848,14 +838,14 @@ InterfaceBlock ::=
848interfaceBlock :: SyntaxInfo -> IdrisParser (Maybe (Name, FC), Docstring (Either Err PTerm), [PDecl])
838interfaceBlock :: SyntaxInfo -> IdrisParser (Maybe (Name, FC), Docstring (Either Err PTerm), [PDecl])
849interfaceBlock syn = do reservedHL "where"
839interfaceBlock syn = do reservedHL "where"
850 openBlock
840 openBlock
851− (cn, cd) <- option (Nothing, emptyDocstring) $
841+ (cn, cd) <- P.option (Nothing, emptyDocstring) $
852− try (do (doc, _) <- option noDocs docComment
842+ P.try (do (doc, _) <- P.option noDocs docComment
853− n <- constructor
843+ n <- constructor
854− return (Just n, doc))
844+ return (Just n, doc))
855 ist <- get
845 ist <- get
856 let cd' = annotate syn ist cd
846 let cd' = annotate syn ist cd
858− ds <- many (notEndBlock >> try (implementation True syn)
848+ ds <- many (notEndBlock >> P.try (implementation True syn)
859 <|> do x <- data_ syn
849 <|> do x <- data_ syn
860 return [x]
850 return [x]
861 <|> fnDecl syn)
851 <|> fnDecl syn)
@@ -886,24 +876,24 @@ Interface ::=
887interface_ :: SyntaxInfo -> IdrisParser [PDecl]
877interface_ :: SyntaxInfo -> IdrisParser [PDecl]
888interface_ syn = do (doc, argDocs, acc)
878interface_ syn = do (doc, argDocs, acc)
889− <- try (do (doc, argDocs) <- docstring syn
879+ <- P.try (do (doc, argDocs) <- docstring syn
890− acc <- accessibility
880+ acc <- accessibility
891− interfaceKeyword
881+ interfaceKeyword
892− return (doc, argDocs, acc))
882+ return (doc, argDocs, acc))
893 fc <- getFC
883 fc <- getFC
894 cons <- constraintList syn
884 cons <- constraintList syn
895 let cons' = [(c, ty) | (_, c, _, ty) <- cons]
885 let cons' = [(c, ty) | (_, c, _, ty) <- cons]
896 (n_in, nfc) <- fnName
886 (n_in, nfc) <- fnName
897 let n = expandNS syn n_in
887 let n = expandNS syn n_in
898 cs <- many carg
888 cs <- many carg
899− fds <- option [(cn, NoFC) | (cn, _, _) <- cs] fundeps
889+ fds <- P.option [(cn, NoFC) | (cn, _, _) <- cs] fundeps
900− (cn, cd, ds) <- option (Nothing, fst noDocs, []) (interfaceBlock syn)
890+ (cn, cd, ds) <- P.option (Nothing, fst noDocs, []) (interfaceBlock syn)
901 accData acc n (concatMap declared ds)
891 accData acc n (concatMap declared ds)
902 return [PInterface doc syn fc cons' n nfc cs argDocs fds ds cn cd]
892 return [PInterface doc syn fc cons' n nfc cs argDocs fds ds cn cd]
903 <?> "interface declaration"
893 <?> "interface declaration"
905 fundeps :: IdrisParser [(Name, FC)]
895 fundeps :: IdrisParser [(Name, FC)]
906− fundeps = do lchar '|'; sepBy name (lchar ',')
896+ fundeps = do lchar '|'; P.sepBy name (lchar ',')
908 interfaceKeyword :: IdrisParser ()
898 interfaceKeyword :: IdrisParser ()
909 interfaceKeyword = reservedHL "interface"
899 interfaceKeyword = reservedHL "interface"
@@ -964,7 +954,7 @@ implementation kwopt syn
965 implementationUsing :: IdrisParser [Name]
955 implementationUsing :: IdrisParser [Name]
966 implementationUsing = do reservedHL "using"
956 implementationUsing = do reservedHL "using"
967− ns <- sepBy1 fnName (lchar ',')
957+ ns <- P.sepBy1 fnName (lchar ',')
968 return (map fst ns)
958 return (map fst ns)
969 <|> return []
959 <|> return []
@@ -972,7 +962,7 @@ implementation kwopt syn
972docstring :: SyntaxInfo
962docstring :: SyntaxInfo
973 -> IdrisParser (Docstring (Either Err PTerm),
963 -> IdrisParser (Docstring (Either Err PTerm),
974 [(Name,Docstring (Either Err PTerm))])
964 [(Name,Docstring (Either Err PTerm))])
975−docstring syn = do (doc, argDocs) <- option noDocs docComment
965+docstring syn = do (doc, argDocs) <- P.option noDocs docComment
976 ist <- get
966 ist <- get
977 let doc' = annotCode (tryFullExpr syn ist) doc
967 let doc' = annotCode (tryFullExpr syn ist) doc
978 argDocs' = [ (n, annotCode (tryFullExpr syn ist) d)
968 argDocs' = [ (n, annotCode (tryFullExpr syn ist) d)
@@ -1005,8 +995,8 @@ NameList ::=
1006usingDeclList :: SyntaxInfo -> IdrisParser [Using]
996usingDeclList :: SyntaxInfo -> IdrisParser [Using]
1007usingDeclList syn
997usingDeclList syn
1008− = try (sepBy1 (usingDecl syn) (lchar ','))
998+ = P.try (P.sepBy1 (usingDecl syn) (lchar ','))
1009− <|> do ns <- sepBy1 (fst <$> name) (lchar ',')
999+ <|> do ns <- P.sepBy1 (fst <$> name) (lchar ',')
1010 lchar ':'
1000 lchar ':'
1011 t <- typeExpr (disallowImp syn)
1001 t <- typeExpr (disallowImp syn)
1012 return (map (\x -> UImplicit x t) ns)
1002 return (map (\x -> UImplicit x t) ns)
@@ -1022,10 +1012,10 @@ UsingDecl ::=
1024usingDecl :: SyntaxInfo -> IdrisParser Using
1014usingDecl :: SyntaxInfo -> IdrisParser Using
1025−usingDecl syn = try (do x <- fst <$> fnName
1015+usingDecl syn = P.try (do x <- fst <$> fnName
1026− lchar ':'
1016+ lchar ':'
1027− t <- typeExpr (disallowImp syn)
1017+ t <- typeExpr (disallowImp syn)
1028− return (UImplicit x t))
1018+ return (UImplicit x t))
1029 <|> do c <- fst <$> fnName
1019 <|> do c <- fst <$> fnName
1030 xs <- many (fst <$> fnName)
1020 xs <- many (fst <$> fnName)
1031 return (UConstraint c xs)
1021 return (UConstraint c xs)
@@ -1068,7 +1058,7 @@ ArgExpr ::= HSimpleExpr | {- In Pattern External (User-defined) Expression -};
1069argExpr :: SyntaxInfo -> IdrisParser PTerm
1059argExpr :: SyntaxInfo -> IdrisParser PTerm
1070argExpr syn = let syn' = syn { inPattern = True } in
1060argExpr syn = let syn' = syn { inPattern = True } in
1071− try (hsimpleExpr syn') <|> simpleExternalExpr syn'
1061+ P.try (hsimpleExpr syn') <|> simpleExternalExpr syn'
1072 <?> "argument expression"
1062 <?> "argument expression"
1074{-| Parse a right hand side of a function
1064{-| Parse a right hand side of a function
@@ -1090,8 +1080,8 @@ rhs syn n = do lchar '='
1090 expr syn
1080 expr syn
1091 <|> do symbol "?=";
1081 <|> do symbol "?=";
1092 fc <- getFC
1082 fc <- getFC
1093− name <- option n' (do symbol "{"; n <- fst <$> fnName; symbol "}";
1083+ name <- P.option n' (do symbol "{"; n <- fst <$> fnName; symbol "}";
1094− return n)
1084+ return n)
1095 r <- expr syn
1085 r <- expr syn
1096 return (addLet fc name r)
1086 return (addLet fc name r)
1097 <|> impossible
1087 <|> impossible
@@ -1135,7 +1125,7 @@ WhereOrTerminator ::= WhereBlock | Terminator;
1136clause :: SyntaxInfo -> IdrisParser PClause
1126clause :: SyntaxInfo -> IdrisParser PClause
1137clause syn
1127clause syn
1138− = do wargs <- try (do pushIndent; some (wExpr syn))
1128+ = do wargs <- P.try (do pushIndent; some (wExpr syn))
1139 fc <- getFC
1129 fc <- getFC
1140 ist <- get
1130 ist <- get
1141 n <- case lastParse ist of
1131 n <- case lastParse ist of
@@ -1143,11 +1133,8 @@ clause syn
1143 Nothing -> fail "Invalid clause"
1133 Nothing -> fail "Invalid clause"
1144 (do r <- rhs syn n
1134 (do r <- rhs syn n
1145 let wsyn = syn { syn_namespace = [], syn_toplevel = False }
1135 let wsyn = syn { syn_namespace = [], syn_toplevel = False }
1146− (wheres, nmap) <- choice [do x <- whereBlock n wsyn
1136+ (wheres, nmap) <- whereBlock n wsyn <* popIndent
1149− do terminator
1137+ <|> ([], []) <$ terminator
1151 return $ PClauseR fc wargs r wheres) <|> (do
1138 return $ PClauseR fc wargs r wheres) <|> (do
1152 popIndent
1139 popIndent
1153 reservedHL "with"
1140 reservedHL "with"
@@ -1158,19 +1145,16 @@ clause syn
1158 let withs = concat ds
1145 let withs = concat ds
1159 closeBlock
1146 closeBlock
1160 return $ PWithR fc wargs wval pn withs)
1147 return $ PWithR fc wargs wval pn withs)
1161− <|> do ty <- try (do pushIndent
1148+ <|> do ty <- P.try (do pushIndent
1162− ty <- simpleExpr syn
1149+ ty <- simpleExpr syn
1163− symbol "<=="
1150+ symbol "<=="
1164− return ty)
1151+ return ty)
1165 fc <- getFC
1152 fc <- getFC
1166 n_in <- fst <$> fnName; let n = expandNS syn n_in
1153 n_in <- fst <$> fnName; let n = expandNS syn n_in
1167 r <- rhs syn n
1154 r <- rhs syn n
1168 let wsyn = syn { syn_namespace = [] }
1155 let wsyn = syn { syn_namespace = [] }
1169− (wheres, nmap) <- choice [do x <- whereBlock n wsyn
1156+ (wheres, nmap) <- whereBlock n wsyn <* popIndent
1172− do terminator
1157+ <|> ([], []) <$ terminator
1174 let capp = PLet fc RigW (sMN 0 "match") NoFC
1158 let capp = PLet fc RigW (sMN 0 "match") NoFC
1176 (PMatchApp fc n)
1160 (PMatchApp fc n)
@@ -1178,7 +1162,7 @@ clause syn
1178 ist <- get
1162 ist <- get
1179 put (ist { lastParse = Just n })
1163 put (ist { lastParse = Just n })
1180 return $ PClause fc n capp [] r wheres
1164 return $ PClause fc n capp [] r wheres
1181− <|> do (l, op, nfc) <- try (do
1165+ <|> do (l, op, nfc) <- P.try (do
1182 pushIndent
1166 pushIndent
1183 l <- argExpr syn
1167 l <- argExpr syn
1184 (op, nfc) <- symbolicOperatorFC
1168 (op, nfc) <- symbolicOperatorFC
@@ -1191,11 +1175,8 @@ clause syn
1191 wargs <- many (wExpr syn)
1175 wargs <- many (wExpr syn)
1192 (do rs <- rhs syn n
1176 (do rs <- rhs syn n
1193 let wsyn = syn { syn_namespace = [] }
1177 let wsyn = syn { syn_namespace = [] }
1194− (wheres, nmap) <- choice [do x <- whereBlock n wsyn
1178+ (wheres, nmap) <- whereBlock n wsyn <* popIndent
1197− do terminator
1179+ <|> ([], []) <$ terminator
1199 ist <- get
1180 ist <- get
1200 let capp = PApp fc (PRef nfc [nfc] n) [pexp l, pexp r]
1181 let capp = PApp fc (PRef nfc [nfc] n) [pexp l, pexp r]
1201 put (ist { lastParse = Just n })
1182 put (ist { lastParse = Just n })
@@ -1215,18 +1196,15 @@ clause syn
1215 <|> do pushIndent
1196 <|> do pushIndent
1216 (n_in, nfc) <- fnName; let n = expandNS syn n_in
1197 (n_in, nfc) <- fnName; let n = expandNS syn n_in
1217 fc <- getFC
1198 fc <- getFC
1218− args <- many (try (implicitArg (syn { inPattern = True } ))
1199+ args <- many (P.try (implicitArg (syn { inPattern = True } ))
1219− <|> try (constraintArg (syn { inPattern = True }))
1200+ <|> P.try (constraintArg (syn { inPattern = True }))
1220 <|> (fmap pexp (argExpr syn)))
1201 <|> (fmap pexp (argExpr syn)))
1221 wargs <- many (wExpr syn)
1202 wargs <- many (wExpr syn)
1222 let capp = PApp fc (PRef nfc [nfc] n) args
1203 let capp = PApp fc (PRef nfc [nfc] n) args
1223 (do r <- rhs syn n
1204 (do r <- rhs syn n
1224 let wsyn = syn { syn_namespace = [] }
1205 let wsyn = syn { syn_namespace = [] }
1225− (wheres, nmap) <- choice [do x <- whereBlock n wsyn
1206+ (wheres, nmap) <- whereBlock n wsyn <* popIndent
1228− do terminator
1207+ <|> ([], []) <$ terminator
1230 ist <- get
1208 ist <- get
1231 put (ist { lastParse = Just n })
1209 put (ist { lastParse = Just n })
1232 return $ PClause fc n capp wargs r wheres) <|> (do
1210 return $ PClause fc n capp wargs r wheres) <|> (do
@@ -1243,9 +1221,9 @@ clause syn
1243 return $ PWith fc n capp wargs wval pn withs)
1221 return $ PWith fc n capp wargs wval pn withs)
1244 <?> "function clause"
1222 <?> "function clause"
1246− optProof = option Nothing (do reservedHL "proof"
1224+ optProof = P.option Nothing (do reservedHL "proof"
1247− n <- fnName
1225+ n <- fnName
1248− return (Just n))
1226+ return (Just n))
1250 fillLHS :: Name -> PTerm -> [PTerm] -> PClause -> PClause
1228 fillLHS :: Name -> PTerm -> [PTerm] -> PClause -> PClause
1251 fillLHS n capp owargs (PClauseR fc wargs v ws)
1229 fillLHS n capp owargs (PClauseR fc wargs v ws)
@@ -1336,74 +1314,74 @@ Directive' ::= 'lib' CodeGen String_t
1338directive :: SyntaxInfo -> IdrisParser [PDecl]
1316directive :: SyntaxInfo -> IdrisParser [PDecl]
1339−directive syn = do try (lchar '%' *> reserved "lib")
1317+directive syn = do P.try (lchar '%' *> reserved "lib")
1340 cgn <- codegen_
1318 cgn <- codegen_
1341 lib <- fmap fst stringLiteral
1319 lib <- fmap fst stringLiteral
1342 return [PDirective (DLib cgn lib)]
1320 return [PDirective (DLib cgn lib)]
1343− <|> do try (lchar '%' *> reserved "link")
1321+ <|> do P.try (lchar '%' *> reserved "link")
1344 cgn <- codegen_; obj <- fst <$> stringLiteral
1322 cgn <- codegen_; obj <- fst <$> stringLiteral
1345 return [PDirective (DLink cgn obj)]
1323 return [PDirective (DLink cgn obj)]
1346− <|> do try (lchar '%' *> reserved "flag")
1324+ <|> do P.try (lchar '%' *> reserved "flag")
1347 cgn <- codegen_; flag <- fst <$> stringLiteral
1325 cgn <- codegen_; flag <- fst <$> stringLiteral
1348 return [PDirective (DFlag cgn flag)]
1326 return [PDirective (DFlag cgn flag)]
1349− <|> do try (lchar '%' *> reserved "include")
1327+ <|> do P.try (lchar '%' *> reserved "include")
1350 cgn <- codegen_
1328 cgn <- codegen_
1351 hdr <- fst <$> stringLiteral
1329 hdr <- fst <$> stringLiteral
1352 return [PDirective (DInclude cgn hdr)]
1330 return [PDirective (DInclude cgn hdr)]
1353− <|> do try (lchar '%' *> reserved "hide"); n <- fst <$> fnName
1331+ <|> do P.try (lchar '%' *> reserved "hide"); n <- fst <$> fnName
1354 return [PDirective (DHide n)]
1332 return [PDirective (DHide n)]
1355− <|> do try (lchar '%' *> reserved "freeze"); n <- fst <$> iName []
1333+ <|> do P.try (lchar '%' *> reserved "freeze"); n <- fst <$> iName []
1356 return [PDirective (DFreeze n)]
1334 return [PDirective (DFreeze n)]
1357− <|> do try (lchar '%' *> reserved "thaw"); n <- fst <$> iName []
1335+ <|> do P.try (lchar '%' *> reserved "thaw"); n <- fst <$> iName []
1358 return [PDirective (DThaw n)]
1336 return [PDirective (DThaw n)]
1359 -- injectivity assertins are intended for debugging purposes
1337 -- injectivity assertins are intended for debugging purposes
1360 -- only, and won't be documented/could be removed at any point
1338 -- only, and won't be documented/could be removed at any point
1361− <|> do try (lchar '%' *> reserved "assert_injective"); n <- fst <$> fnName
1339+ <|> do P.try (lchar '%' *> reserved "assert_injective"); n <- fst <$> fnName
1362 return [PDirective (DInjective n)]
1340 return [PDirective (DInjective n)]
1363 -- Assert totality of something after definition. This is
1341 -- Assert totality of something after definition. This is
1364 -- here as a debugging aid, so commented out...
1342 -- here as a debugging aid, so commented out...
1365−-- <|> do try (lchar '%' *> reserved "assert_set_total"); n <- fst <$> fnName
1343+-- <|> do P.try (lchar '%' *> reserved "assert_set_total"); n <- fst <$> fnName
1366-- return [PDirective (DSetTotal n)]
1344-- return [PDirective (DSetTotal n)]
1367− <|> do try (lchar '%' *> reserved "access")
1345+ <|> do P.try (lchar '%' *> reserved "access")
1368 acc <- accessibility
1346 acc <- accessibility
1369 ist <- get
1347 ist <- get
1370 put ist { default_access = acc }
1348 put ist { default_access = acc }
1371 return [PDirective (DAccess acc)]
1349 return [PDirective (DAccess acc)]
1372− <|> do try (lchar '%' *> reserved "default"); tot <- totality
1350+ <|> do P.try (lchar '%' *> reserved "default"); tot <- totality
1373 i <- get
1351 i <- get
1374 put (i { default_total = tot } )
1352 put (i { default_total = tot } )
1375 return [PDirective (DDefault tot)]
1353 return [PDirective (DDefault tot)]
1376− <|> do try (lchar '%' *> reserved "logging")
1354+ <|> do P.try (lchar '%' *> reserved "logging")
1377 i <- fst <$> natural
1355 i <- fst <$> natural
1378 return [PDirective (DLogging i)]
1356 return [PDirective (DLogging i)]
1379− <|> do try (lchar '%' *> reserved "dynamic")
1357+ <|> do P.try (lchar '%' *> reserved "dynamic")
1380− libs <- sepBy1 (fmap fst stringLiteral) (lchar ',')
1358+ libs <- P.sepBy1 (fmap fst stringLiteral) (lchar ',')
1381 return [PDirective (DDynamicLibs libs)]
1359 return [PDirective (DDynamicLibs libs)]
1382− <|> do try (lchar '%' *> reserved "name")
1360+ <|> do P.try (lchar '%' *> reserved "name")
1383 (ty, tyFC) <- fnName
1361 (ty, tyFC) <- fnName
1384− ns <- sepBy1 name (lchar ',')
1362+ ns <- P.sepBy1 name (lchar ',')
1385 return [PDirective (DNameHint ty tyFC ns)]
1363 return [PDirective (DNameHint ty tyFC ns)]
1386− <|> do try (lchar '%' *> reserved "error_handlers")
1364+ <|> do P.try (lchar '%' *> reserved "error_handlers")
1387 (fn, nfc) <- fnName
1365 (fn, nfc) <- fnName
1388 (arg, afc) <- fnName
1366 (arg, afc) <- fnName
1389− ns <- sepBy1 name (lchar ',')
1367+ ns <- P.sepBy1 name (lchar ',')
1390 return [PDirective (DErrorHandlers fn nfc arg afc ns) ]
1368 return [PDirective (DErrorHandlers fn nfc arg afc ns) ]
1391− <|> do try (lchar '%' *> reserved "language"); ext <- pLangExt;
1369+ <|> do P.try (lchar '%' *> reserved "language"); ext <- pLangExt;
1392 return [PDirective (DLanguage ext)]
1370 return [PDirective (DLanguage ext)]
1393− <|> do try (lchar '%' *> reserved "deprecate")
1371+ <|> do P.try (lchar '%' *> reserved "deprecate")
1394 n <- fst <$> fnName
1372 n <- fst <$> fnName
1395− alt <- option "" (fst <$> stringLiteral)
1373+ alt <- P.option "" (fst <$> stringLiteral)
1396 return [PDirective (DDeprecate n alt)]
1374 return [PDirective (DDeprecate n alt)]
1397− <|> do try (lchar '%' *> reserved "fragile")
1375+ <|> do P.try (lchar '%' *> reserved "fragile")
1398 n <- fst <$> fnName
1376 n <- fst <$> fnName
1399− alt <- option "" (fst <$> stringLiteral)
1377+ alt <- P.option "" (fst <$> stringLiteral)
1400 return [PDirective (DFragile n alt)]
1378 return [PDirective (DFragile n alt)]
1401 <|> do fc <- getFC
1379 <|> do fc <- getFC
1402− try (lchar '%' *> reserved "used")
1380+ P.try (lchar '%' *> reserved "used")
1403 fn <- fst <$> fnName
1381 fn <- fst <$> fnName
1404 arg <- fst <$> iName []
1382 arg <- fst <$> iName []
1405 return [PDirective (DUsed fc fn arg)]
1383 return [PDirective (DUsed fc fn arg)]
1406− <|> do try (lchar '%' *> reserved "auto_implicits")
1384+ <|> do P.try (lchar '%' *> reserved "auto_implicits")
1407 b <- on_off
1385 b <- on_off
1408 return [PDirective (DAutoImplicits b)]
1386 return [PDirective (DAutoImplicits b)]
1409 <?> "directive"
1387 <?> "directive"
@@ -1440,12 +1418,12 @@ ProviderWhat ::= 'proof' | 'term' | 'type' | 'postulate'
1442provider :: SyntaxInfo -> IdrisParser [PDecl]
1420provider :: SyntaxInfo -> IdrisParser [PDecl]
1443−provider syn = do doc <- try (do (doc, _) <- docstring syn
1421+provider syn = do doc <- P.try (do (doc, _) <- docstring syn
1444− fc1 <- getFC
1422+ fc1 <- getFC
1445− lchar '%'
1423+ lchar '%'
1446− fc2 <- reservedFC "provide"
1424+ fc2 <- reservedFC "provide"
1447− highlightP (spanFC fc1 fc2) AnnKeyword
1425+ highlightP (spanFC fc1 fc2) AnnKeyword
1448− return doc)
1426+ return doc)
1449 provideTerm doc <|> providePostulate doc
1427 provideTerm doc <|> providePostulate doc
1450 <?> "type provider"
1428 <?> "type provider"
1451 where provideTerm doc =
1429 where provideTerm doc =
@@ -1469,7 +1447,7 @@ Transform ::= '%' 'transform' Expr '==>' Expr
1471transform :: SyntaxInfo -> IdrisParser [PDecl]
1449transform :: SyntaxInfo -> IdrisParser [PDecl]
1472−transform syn = do try (lchar '%' *> reserved "transform")
1450+transform syn = do P.try (lchar '%' *> reserved "transform")
1473 -- leave it unchecked, until we work out what this should
1451 -- leave it unchecked, until we work out what this should
1474 -- actually mean...
1452 -- actually mean...
1475-- safety <- option True (do reserved "unsafe"
1453-- safety <- option True (do reserved "unsafe"
@@ -1489,10 +1467,10 @@ RunElabDecl ::= '%' 'runElab' Expr
1490runElabDecl :: SyntaxInfo -> IdrisParser PDecl
1468runElabDecl :: SyntaxInfo -> IdrisParser PDecl
1491runElabDecl syn =
1469runElabDecl syn =
1492− do kwFC <- try (do fc <- getFC
1470+ do kwFC <- P.try (do fc <- getFC
1493− lchar '%'
1471+ lchar '%'
1494− fc' <- reservedFC "runElab"
1472+ fc' <- reservedFC "runElab"
1495− return (spanFC fc fc'))
1473+ return (spanFC fc fc'))
1496 script <- expr syn <?> "elaborator script"
1474 script <- expr syn <?> "elaborator script"
1497 highlightP kwFC AnnKeyword
1475 highlightP kwFC AnnKeyword
1498 return $ PRunElabDecl kwFC script (syn_namespace syn)
1476 return $ PRunElabDecl kwFC script (syn_namespace syn)
@@ -1500,19 +1478,19 @@ runElabDecl syn =
1501{- * Loading and parsing -}
1479{- * Loading and parsing -}
1502{-| Parses an expression from input -}
1480{-| Parses an expression from input -}
1503−parseExpr :: IState -> String -> Result PTerm
1481+parseExpr :: IState -> String -> P.Result PTerm
1504parseExpr st = runparser (fullExpr defaultSyntax) st "(input)"
1482parseExpr st = runparser (fullExpr defaultSyntax) st "(input)"
1506{-| Parses a constant form input -}
1484{-| Parses a constant form input -}
1507−parseConst :: IState -> String -> Result Const
1485+parseConst :: IState -> String -> P.Result Const
1508parseConst st = runparser (fmap fst constant) st "(input)"
1486parseConst st = runparser (fmap fst constant) st "(input)"
1510{-| Parses a tactic from input -}
1488{-| Parses a tactic from input -}
1511−parseTactic :: IState -> String -> Result PTactic
1489+parseTactic :: IState -> String -> P.Result PTactic
1512parseTactic st = runparser (fullTactic defaultSyntax) st "(input)"
1490parseTactic st = runparser (fullTactic defaultSyntax) st "(input)"
1514{-| Parses a do-step from input (used in the elab shell) -}
1492{-| Parses a do-step from input (used in the elab shell) -}
1515−parseElabShellStep :: IState -> String -> Result (Either ElabShellCmd PDo)
1493+parseElabShellStep :: IState -> String -> P.Result (Either ElabShellCmd PDo)
1516parseElabShellStep ist = runparser (fmap Right (do_ defaultSyntax) <|> fmap Left elabShellCmd) ist "(input)"
1494parseElabShellStep ist = runparser (fmap Right (do_ defaultSyntax) <|> fmap Left elabShellCmd) ist "(input)"
1517 where elabShellCmd = char ':' >>
1495 where elabShellCmd = char ':' >>
1518 (reserved "qed" >> pure EQED ) <|>
1496 (reserved "qed" >> pure EQED ) <|>
@@ -1525,7 +1503,7 @@ parseElabShellStep ist = runparser (fmap Right (do_ defaultSyntax) <|> fmap Left
1525 (expressionTactic ["search"] ESearch ) <|>
1503 (expressionTactic ["search"] ESearch ) <|>
1526 (do reserved "doc"
1504 (do reserved "doc"
1527 doc <- (Right . fst <$> constant) <|> (Left . fst <$> fnName)
1505 doc <- (Right . fst <$> constant) <|> (Left . fst <$> fnName)
1529 return (EDocStr doc))
1507 return (EDocStr doc))
1530 <?> "elab command"
1508 <?> "elab command"
1531 expressionTactic cmds tactic =
1509 expressionTactic cmds tactic =
@@ -1536,26 +1514,26 @@ parseElabShellStep ist = runparser (fmap Right (do_ defaultSyntax) <|> fmap Left
1536 spaced parser = indentGt *> parser
1514 spaced parser = indentGt *> parser
1538-- | Parse module header and imports
1516-- | Parse module header and imports
1539−parseImports :: FilePath -> String -> Idris (Maybe (Docstring ()), [String], [ImportInfo], Maybe Delta)
1517+parseImports :: FilePath -> String -> Idris (Maybe (Docstring ()), [String], [ImportInfo], Maybe P.Delta)
1540parseImports fname input
1518parseImports fname input
1541 = do i <- getIState
1519 = do i <- getIState
1542− case parseString (runInnerParser (evalStateT imports i)) (Directed (UTF8.fromString fname) 0 0 0 0) input of
1520+ case P.parseString (runInnerParser (evalStateT imports i)) (P.Directed (UTF8.fromString fname) 0 0 0 0) input of
1543− Failure (ErrInfo err _) -> ifail $ show err
1521+ P.Failure (P.ErrInfo err _) -> ifail $ show err
1544− Success (x, annots, i) ->
1522+ P.Success (x, annots, i) ->
1545 do putIState i
1523 do putIState i
1546 fname' <- runIO $ Dir.makeAbsolute fname
1524 fname' <- runIO $ Dir.makeAbsolute fname
1547 sendHighlighting $ addPath annots fname'
1525 sendHighlighting $ addPath annots fname'
1548 return x
1526 return x
1549 where imports :: IdrisParser ((Maybe (Docstring ()), [String],
1527 where imports :: IdrisParser ((Maybe (Docstring ()), [String],
1550 [ImportInfo],
1528 [ImportInfo],
1551− Maybe Delta),
1529+ Maybe P.Delta),
1552 [(FC, OutputAnnotation)], IState)
1530 [(FC, OutputAnnotation)], IState)
1553 imports = do optional shebang
1531 imports = do optional shebang
1554 whiteSpace
1532 whiteSpace
1555 (mdoc, mname, annots) <- moduleHeader
1533 (mdoc, mname, annots) <- moduleHeader
1556 ps_exp <- many import_
1534 ps_exp <- many import_
1557− mrk <- mark
1535+ mrk <- P.mark
1558− isEof <- lookAheadMatches eof
1536+ isEof <- lookAheadMatches P.eof
1559 let mrk' = if isEof
1537 let mrk' = if isEof
1560 then Nothing
1538 then Nothing
1561 else Just mrk
1539 else Just mrk
@@ -1572,7 +1550,7 @@ parseImports fname input
1572 addPath (annot:annots) path = annot : addPath annots path
1550 addPath (annot:annots) path = annot : addPath annots path
1574 shebang :: IdrisParser ()
1552 shebang :: IdrisParser ()
1575− shebang = string "#!" *> many (satisfy $ not . isEol) *> eol *> pure ()
1553+ shebang = string "#!" *> many (P.satisfy $ not . isEol) *> eol *> pure ()
1577-- | There should be a better way of doing this...
1555-- | There should be a better way of doing this...
1578findFC :: Doc -> (FC, String)
1556findFC :: Doc -> (FC, String)
@@ -1596,12 +1574,12 @@ fixColour True doc = doc
1597-- | A program is a list of declarations, possibly with associated
1575-- | A program is a list of declarations, possibly with associated
1598-- documentation strings.
1576-- documentation strings.
1599−parseProg :: SyntaxInfo -> FilePath -> String -> Maybe Delta ->
1577+parseProg :: SyntaxInfo -> FilePath -> String -> Maybe P.Delta ->
1600 Idris [PDecl]
1578 Idris [PDecl]
1601parseProg syn fname input mrk
1579parseProg syn fname input mrk
1602 = do i <- getIState
1580 = do i <- getIState
1603 case runparser mainProg i fname input of
1581 case runparser mainProg i fname input of
1604− Failure (ErrInfo doc _) -> do -- FIXME: Get error location from trifecta
1582+ P.Failure (P.ErrInfo doc _) -> do -- FIXME: Get error location from trifecta
1605 -- this can't be the solution!
1583 -- this can't be the solution!
1606 -- Issue #1575 on the issue tracker.
1584 -- Issue #1575 on the issue tracker.
1607 -- https://github.com/idris-lang/Idris-dev/issues/1575
1585 -- https://github.com/idris-lang/Idris-dev/issues/1575
@@ -1609,17 +1587,17 @@ parseProg syn fname input mrk
1609 i <- getIState
1587 i <- getIState
1610 case idris_outputmode i of
1588 case idris_outputmode i of
1611 RawOutput h -> iputStrLn (show $ fixColour (idris_colourRepl i) doc)
1589 RawOutput h -> iputStrLn (show $ fixColour (idris_colourRepl i) doc)
1612− IdeMode n h -> iWarn fc (P.text msg)
1590+ IdeMode n h -> iWarn fc (Util.Pretty.text msg)
1613 putIState (i { errSpan = Just fc })
1591 putIState (i { errSpan = Just fc })
1614 return []
1592 return []
1615− Success (x, i) -> do putIState i
1593+ P.Success (x, i) -> do putIState i
1616− reportParserWarnings
1594+ reportParserWarnings
1617− return $ collect x
1595+ return $ collect x
1618 where mainProg :: IdrisParser ([PDecl], IState)
1596 where mainProg :: IdrisParser ([PDecl], IState)
1619 mainProg = case mrk of
1597 mainProg = case mrk of
1620 Nothing -> do i <- get; return ([], i)
1598 Nothing -> do i <- get; return ([], i)
1621 Just mrk -> do
1599 Just mrk -> do
1622− release mrk
1600+ P.release mrk
1623 ds <- prog syn
1601 ds <- prog syn
1624 i' <- get
1602 i' <- get
1625 return (ds, i')
1603 return (ds, i')