diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-12-22 18:32:08 +0000 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-12-22 18:32:08 +0000 |
commit | 1252cc77514e8c485396680827bf52c517be7cdd (patch) | |
tree | 5a3382a48e3b12226b88b80f01e9e2f9c9d8e4dd | |
parent | c7cc8467ca1835c8f96ccb5be7c976a26d262433 (diff) | |
download | micro-lang-hs-1252cc77514e8c485396680827bf52c517be7cdd.tar.gz micro-lang-hs-1252cc77514e8c485396680827bf52c517be7cdd.zip |
Simplify
-rw-r--r-- | src/Micro/Ast.hs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/Micro/Ast.hs b/src/Micro/Ast.hs index ec9141e..d84eda6 100644 --- a/src/Micro/Ast.hs +++ b/src/Micro/Ast.hs @@ -10,9 +10,7 @@ data Type = Type String | FuncType [Type] (Maybe Type) deriving (Eq, Ord) instance Show Type where show (Type t) = t show (FuncType params rtyp) = - "(" ++ (intercalate ", " (fmap show params)) ++ ") -> " ++ case rtyp of - Just t -> show t - Nothing -> "()" + "(" ++ intercalate ", " (fmap show params) ++ ") -> " ++ maybe "()" show rtyp showList :: [Type] -> String showList xs = intercalate ", " $ fmap show xs @@ -42,5 +40,4 @@ data Op deriving (Eq, Ord, Show) toFuncType :: [FuncParam] -> Maybe Type -> Type -toFuncType params rtyp = - FuncType (map (\(_, t, _, _) -> t) params) rtyp +toFuncType params = FuncType (map (\(_, t, _, _) -> t) params) |