on master help sign in
Merge pull request #4243 from eraserhd/deprecated-parser-features
1e4133bJason Felice
CHANGELOG.md+4−1
@@ -31,7 +31,10 @@
31 intMax : IO Int
31 intMax : IO Int
32 intMax = foreign FFI_C "#INT_MAX" (IO Int)
32 intMax = foreign FFI_C "#INT_MAX" (IO Int)
33 ```
33 ```
34−
34++ The deprecated keywords `%assert_total`, `abstract`, and `[static]` have
35+ been removed as well as the use of "public" instead of "public export" to
36+ expose a symbol.
37+
35## Library Updates
38## Library Updates
36
39
37+ Removed `oldeffects` library from `libs` folder, use `effects` or `Control.ST` instead.
40+ Removed `oldeffects` library from `libs` folder, use `effects` or `Control.ST` instead.
docs/reference/syntax-guide.rst−1
@@ -407,7 +407,6 @@ Options
407 %no_implicit
407 %no_implicit
408 %error_handler
408 %error_handler
409 %error_reverse
409 %error_reverse
410− %assert_total
411 %reflection
410 %reflection
412 %specialise [<name list>]
411 %specialise [<name list>]
413
412
samples/tutorial/BTreeMod.idr+5−5
@@ -1,20 +1,20 @@
1module btree
1module btree
2
2
3−abstract data BTree a = Leaf
3+export data BTree a = Leaf
4− | Node (BTree a) a (BTree a)
4+ | Node (BTree a) a (BTree a)
5
5
6−abstract
6+export
7insert : Ord a => a -> BTree a -> BTree a
7insert : Ord a => a -> BTree a -> BTree a
8insert x Leaf = Node Leaf x Leaf
8insert x Leaf = Node Leaf x Leaf
9insert x (Node l v r) = if (x < v) then (Node (insert x l) v r)
9insert x (Node l v r) = if (x < v) then (Node (insert x l) v r)
10 else (Node l v (insert x r))
10 else (Node l v (insert x r))
11
11
12−abstract
12+export
13toList : BTree a -> List a
13toList : BTree a -> List a
14toList Leaf = []
14toList Leaf = []
15toList (Node l v r) = btree.toList l ++ (v :: btree.toList r)
15toList (Node l v r) = btree.toList l ++ (v :: btree.toList r)
16
16
17−abstract
17+export
18toTree : Ord a => List a -> BTree a
18toTree : Ord a => List a -> BTree a
19toTree [] = Leaf
19toTree [] = Leaf
20toTree (x :: xs) = insert x (toTree xs)
20toTree (x :: xs) = insert x (toTree xs)
src/Idris/Parser.hs+13−5
@@ -650,9 +650,6 @@ fnOpt = do keyword "total"; return TotalFn
650 <|> NoImplicit <$ P.try (lchar '%' *> reserved "no_implicit")
650 <|> NoImplicit <$ P.try (lchar '%' *> reserved "no_implicit")
651 <|> Inlinable <$ P.try (lchar '%' *> reserved "inline")
651 <|> Inlinable <$ P.try (lchar '%' *> reserved "inline")
652 <|> StaticFn <$ P.try (lchar '%' *> reserved "static")
652 <|> StaticFn <$ P.try (lchar '%' *> reserved "static")
653− <|> do fc <- P.try $ extent $ lchar '%' *> reserved "assert_total"
654− parserWarning fc Nothing (Msg "%assert_total is deprecated. Use the 'assert_total' function instead.")
655− return AssertTotal
656 <|> ErrorHandler <$ P.try (lchar '%' *> reserved "error_handler")
653 <|> ErrorHandler <$ P.try (lchar '%' *> reserved "error_handler")
657 <|> ErrorReverse <$ P.try (lchar '%' *> reserved "error_reverse")
654 <|> ErrorReverse <$ P.try (lchar '%' *> reserved "error_reverse")
658 <|> ErrorReduce <$ P.try (lchar '%' *> reserved "error_reduce")
655 <|> ErrorReduce <$ P.try (lchar '%' *> reserved "error_reduce")
@@ -881,10 +878,15 @@ interface_ syn = do (doc, argDocs, acc)
881 fundeps :: IdrisParser [(Name, FC)]
878 fundeps :: IdrisParser [(Name, FC)]
882 fundeps = do lchar '|'; P.sepBy (withExtent name) (lchar ',')
879 fundeps = do lchar '|'; P.sepBy (withExtent name) (lchar ',')
883
880
881+ classWarning :: String
882+ classWarning = "Use of a fragile keyword `class`. " ++
883+ "`class` is provided for those coming from Haskell. " ++
884+ "Please use `interface` instead, which is equivalent."
885+
884 interfaceKeyword :: IdrisParser ()
886 interfaceKeyword :: IdrisParser ()
885 interfaceKeyword = keyword "interface"
887 interfaceKeyword = keyword "interface"
886 <|> do fc <- extent $ keyword "class"
888 <|> do fc <- extent $ keyword "class"
887− parserWarning fc Nothing (Msg "The 'class' keyword is deprecated. Use 'interface' instead.")
889+ parserWarning fc Nothing (Msg classWarning)
888
890
889 carg :: IdrisParser (Name, FC, PTerm)
891 carg :: IdrisParser (Name, FC, PTerm)
890 carg = do lchar '('; (i, ifc) <- withExtent name; lchar ':'; ty <- expr syn; lchar ')'
892 carg = do lchar '('; (i, ifc) <- withExtent name; lchar ':'; ty <- expr syn; lchar ')'
@@ -929,10 +931,16 @@ implementation syn = do (doc, argDocs) <- docstring syn
929 let n = expandNS syn n_in
931 let n = expandNS syn n_in
930 return n
932 return n
931 <?> "implementation name"
933 <?> "implementation name"
934+
935+ instanceWarning :: String
936+ instanceWarning = "Use of fragile keyword `instance`. " ++
937+ "`instance` is provided for those coming from Haskell. " ++
938+ "Please use `implementation` (which is equivalent) instead, or omit it."
939+
932 implementationKeyword :: IdrisParser ()
940 implementationKeyword :: IdrisParser ()
933 implementationKeyword = keyword "implementation"
941 implementationKeyword = keyword "implementation"
934 <|> do fc <- extent $ keyword "instance"
942 <|> do fc <- extent $ keyword "instance"
935− parserWarning fc Nothing (Msg "The 'instance' keyword is deprecated. Use 'implementation' (or omit it) instead.")
943+ parserWarning fc Nothing (Msg instanceWarning)
936
944
937 implementationUsing :: IdrisParser [Name]
945 implementationUsing :: IdrisParser [Name]
938 implementationUsing = do keyword "using"
946 implementationUsing = do keyword "using"
src/Idris/Parser/Expr.hs−3
@@ -1408,9 +1408,6 @@ Static ::=
1408-}
1408-}
1409static :: IdrisParser Static
1409static :: IdrisParser Static
1410static = Static <$ reserved "%static"
1410static = Static <$ reserved "%static"
1411− <|> do fc <- extent $ reserved "[static]"
1412− parserWarning fc Nothing (Msg "The use of [static] is deprecated, use %static instead.")
1413− return Static
1414 <|> return Dynamic
1411 <|> return Dynamic
1415 <?> "static modifier"
1412 <?> "static modifier"
1416
1413
src/Idris/Parser/Helpers.hs+5−21
@@ -260,7 +260,7 @@ float = token . P.try $ P.float
260reservedIdentifiers :: HS.HashSet String
260reservedIdentifiers :: HS.HashSet String
261reservedIdentifiers = HS.fromList
261reservedIdentifiers = HS.fromList
262 [ "Type"
262 [ "Type"
263− , "abstract", "case", "class", "codata", "constructor", "corecord", "data"
263+ , "case", "class", "codata", "constructor", "corecord", "data"
264 , "do", "dsl", "else", "export", "if", "implementation", "implicit"
264 , "do", "dsl", "else", "export", "if", "implementation", "implicit"
265 , "import", "impossible", "in", "infix", "infixl", "infixr", "instance"
265 , "import", "impossible", "in", "infix", "infixl", "infixr", "instance"
266 , "interface", "let", "mutual", "namespace", "of", "parameters", "partial"
266 , "interface", "let", "mutual", "namespace", "of", "parameters", "partial"
@@ -520,26 +520,10 @@ notOpenBraces = do ist <- get
520
520
521{- | Parses an accessibilty modifier (e.g. public, private) -}
521{- | Parses an accessibilty modifier (e.g. public, private) -}
522accessibility' :: IdrisParser Accessibility
522accessibility' :: IdrisParser Accessibility
523−accessibility'
523+accessibility' = Public <$ reserved "public" <* reserved "export"
524− = do fc <- extent $ reserved "public"
525− gotexp <- optional (reserved "export")
526− case gotexp of
527− Just _ -> return ()
528− Nothing -> do
529− ist <- get
530− put ist { parserWarnings =
531− (fc, Msg "'public' is deprecated. Use 'public export' instead.")
532− : parserWarnings ist }
533− return Public
534− <|> do fc <- extent $ reserved "abstract"
535− ist <- get
536− put ist { parserWarnings =
537− (fc, Msg "The 'abstract' keyword is deprecated. Use 'export' instead.")
538− : parserWarnings ist }
539− return Frozen
540− <|> do reserved "export"; return Frozen
524+ <|> Frozen <$ reserved "export"
541− <|> do reserved "private"; return Private
525+ <|> Private <$ reserved "private"
542− <?> "accessibility modifier"
526+ <?> "accessibility modifier"
543
527
544accessibility :: IdrisParser Accessibility
528accessibility :: IdrisParser Accessibility
545accessibility = do acc <- optional accessibility'
529accessibility = do acc <- optional accessibility'