Skip to content

Commit 70544fb

Browse files
copilot-theorem: Remove unused function Copilot.Theorem.Misc.SExpr.parseSExpr. Refs #661.
The function `copilot-theorem:Copilot.Theorem.Misc.SExpr.parseSExpr` is not used anywhere in the implementation. The module is internal and not exposed to the user, so that function does not have and cannot have any users. This commit removes the function, as well as another definition in the module only used by `parseSExpr`, and an import only used by those two functions.
1 parent f887b3c commit 70544fb

File tree

1 file changed

+1
-36
lines changed
  • copilot-theorem/src/Copilot/Theorem/Misc

1 file changed

+1
-36
lines changed

copilot-theorem/src/Copilot/Theorem/Misc/SExpr.hs

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
{-# LANGUAGE Safe #-}
33

44
-- | A representation for structured expression trees, with support for pretty
5-
-- printing and for parsing.
5+
-- printing.
66
module Copilot.Theorem.Misc.SExpr where
77

8-
import Text.ParserCombinators.Parsec
98
import Text.PrettyPrint.HughesPJ as PP hiding (char, Str)
109

1110
import Control.Monad
@@ -70,37 +69,3 @@ toDoc shouldIndent printAtom expr = case expr of
7069
doc $$ indent (toDoc shouldIndent printAtom s)
7170
| otherwise =
7271
doc <+> toDoc shouldIndent printAtom s
73-
74-
-- | Parser for strings of characters separated by spaces into a structured
75-
-- tree.
76-
--
77-
-- Parentheses are interpreted as grouping elements, that is, defining a
78-
-- 'List', which may be empty.
79-
parser :: GenParser Char st (SExpr String)
80-
parser =
81-
choice [try unitP, nodeP, leafP]
82-
83-
where
84-
symbol = oneOf "!#$%&|*+-/:<=>?@^_~."
85-
lonelyStr = many1 (alphaNum <|> symbol)
86-
87-
unitP = string "()" >> return unit
88-
89-
leafP = atom <$> lonelyStr
90-
91-
nodeP = do void $ char '('
92-
spaces
93-
st <- sepBy parser spaces
94-
spaces
95-
void $ char ')'
96-
return $ List st
97-
98-
-- | Parser for strings of characters separated by spaces into a structured
99-
-- tree.
100-
--
101-
-- Parentheses are interpreted as grouping elements, that is, defining a
102-
-- 'List', which may be empty.
103-
parseSExpr :: String -> Maybe (SExpr String)
104-
parseSExpr str = case parse parser "" str of
105-
Left s -> error (show s) -- Nothing
106-
Right t -> Just t

0 commit comments

Comments
 (0)