]> git.rmz.io Git - my-scheme.git/commitdiff
Define a parser for various symbols in Scheme
authorSamir Benmendil <me@rmz.io>
Sat, 13 Jan 2018 22:41:38 +0000 (22:41 +0000)
committerSamir Benmendil <me@rmz.io>
Sat, 13 Jan 2018 22:41:38 +0000 (22:41 +0000)
`symbol :: Parser Char` is probably not needed (?)

I don't understand where the `Parser` type comes from, I cannot see it
in the doc of `Text.ParserCombinators.Parsec`. It may be that
`ParserCombinators` is a compatibility layer and that `Parser` is
defined somewhere else.

`oneOf` is provided by Parsec.

app/Main.hs

index 2740935ca44f24d9121b6d9464c61c4b633b8121..015db3ad73adae9dec4ac67b281ac3e57c1d5fc0 100644 (file)
@@ -2,6 +2,9 @@ module Main where
 import Text.ParserCombinators.Parsec
 import System.Environment
 
 import Text.ParserCombinators.Parsec
 import System.Environment
 
+symbol :: Parser Char
+symbol = oneOf "!#$%&|*+-/:<=>?@^_~"
+
 main :: IO ()
 main = do
     args <- getLine
 main :: IO ()
 main = do
     args <- getLine