Set 5a Ex 2: allow [Char] in addition to String

This commit is contained in:
Joel Kaasinen
2021-09-21 13:06:22 +03:00
parent ca1f32aded
commit f00717b794
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -80,6 +80,10 @@ data FieldType = SimpleType String | WeirdType
interpretFieldType (ConT n) = SimpleType $ nameBase n
interpretFieldType (VarT n) = SimpleType $ nameBase n
interpretFieldType (AppT ListT t) =
case interpretFieldType t of
SimpleType s -> SimpleType $ "[" ++ s ++ "]"
_ -> WeirdType
interpretFieldType (AppT t1 t2) =
case (interpretFieldType t1, interpretFieldType t2) of
(SimpleType s1, SimpleType s2) -> SimpleType $ s1 ++ " " ++ s2