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