elm/compiler/SourceSyntax/Helpers.hs

19 lines
363 B
Haskell
Raw Normal View History

module SourceSyntax.Helpers where
2013-07-16 19:37:48 +00:00
import qualified Data.Char as Char
brkt :: String -> String
brkt s = "{ " ++ s ++ " }"
isTuple :: String -> Bool
isTuple name =
2013-07-16 19:37:48 +00:00
take 6 name == "_Tuple" && all Char.isDigit (drop 6 name)
isOp :: String -> Bool
2013-07-16 19:37:48 +00:00
isOp = all isSymbol
isSymbol :: Char -> Bool
2013-07-16 19:37:48 +00:00
isSymbol c =
Char.isSymbol c || elem c "+-/*=.$<>:&|^?%#@~!"