on master help sign in
Add types and `deprime` function to SourceSyntax.Helpers
commite22c7d455e85a6e782572ad9b2863803d6a3a420 authorEvan Czaplicki <info@elm-lang.org> dateMon 29 Jul 2013, 11:54 (13 years ago) parenteb96d7a
1 file changed+8−1
compiler/SourceSyntax/Helpers.hs+8−1
compiler/SourceSyntax/Helpers.hs+8−1
@@ -3,12 +3,19 @@ module SourceSyntax.Helpers where
33
44import qualified Data.Char as Char
55
6+brkt :: String -> String
67brkt s = "{ " ++ s ++ " }"
78
9+isTuple :: String -> Bool
810isTuple name =
911 take 6 name == "_Tuple" && all Char.isDigit (drop 6 name)
1012
13+isOp :: String -> Bool
1114isOp = all isSymbol
1215
16+isSymbol :: Char -> Bool
1317isSymbol c =
14− Char.isSymbol c || elem c "+-/*=.$<>:&|^?%#@~!"
18+ Char.isSymbol c || elem c "+-/*=.$<>:&|^?%#@~!"
19+
20+deprime :: String -> String
21+deprime = map (\c -> if c == '\'' then '$' else c)