-- | Creates a constant with a given value

constantVar :: Constant -> Variable
constantVar = ConstantVar

isVariableChar :: Char -> Bool
isVariableChar c = isAlphaNum c || c == '_' || c == '-' || c == '.'

-- | Creates a variable with a given name.
variable :: String -> Variable
variable (x:y) = if isLetter x && all isVariableChar y
                 then Var (x:y)
                 else error "variable name must start with a letter and contain only alphanumeric characters, dot, underscore or hyphen"
variable _ = error "variable name is empty"
