mirror of
https://github.com/macocianradu/RosettaHaskellCompiler.git
synced 2026-03-18 13:00:08 +00:00
small changes
This commit is contained in:
@@ -40,6 +40,4 @@ printDisplayName :: String -> EnumValue -> Doc a
|
||||
printDisplayName enumName (MakeEnumValue name _ (Just display)) =
|
||||
"show" <+> pretty enumName <> pretty name <+> "= \"" <> pretty display <> "\""
|
||||
printDisplayName enumName (MakeEnumValue name _ Nothing) =
|
||||
"show" <+> pretty enumName <> pretty name <+> "= \"" <> pretty name <> "\""
|
||||
|
||||
|
||||
"show" <+> pretty enumName <> pretty name <+> "= \"" <> pretty name <> "\""
|
||||
@@ -266,7 +266,7 @@ checkFunctionCall [] fun args = Left $ UndefinedFunction $ "Undefined function:
|
||||
checkFunctionCall ((Func n a r):symbolMap) name args
|
||||
| not $ null $ lefts args = Left $ ErrorInsideFunction (name ++ ": " ++ show (lefts args))
|
||||
| name == n = if all isRight coerce then Right $ ExplicitFunction name (zip (rights args) (rights coerce)) (MakeCoercion [MakeIdCoercion (fst r)] (MakeCardinalityIdCoercion (snd r)))
|
||||
else checkFunctionCall symbolMap name args--Left $ UndefinedFunction $ "Undefined function: " ++ name ++ " [" ++ show (rights args) ++ "]"
|
||||
else checkFunctionCall symbolMap name args
|
||||
| otherwise = checkFunctionCall symbolMap name args
|
||||
where
|
||||
argCoerce = map returnCoercion (rights args)
|
||||
|
||||
@@ -42,23 +42,23 @@ spec = do
|
||||
exps :: [Expression]
|
||||
exps = [
|
||||
-- 1
|
||||
InfixExp "+" (Int "1") (Parens (InfixExp "-" (Int "2") (Int "3"))),
|
||||
InfixExp "+" (Int "1") (Parens (InfixExp "- " (Int "2") (Int "3"))),
|
||||
-- 2
|
||||
InfixExp "="
|
||||
(InfixExp "-"
|
||||
(InfixExp "-"
|
||||
(InfixExp "- "
|
||||
(InfixExp "- "
|
||||
(InfixExp "*" (Variable "a") (Variable "b"))
|
||||
(InfixExp "*" (Variable "c") (Variable "d")))
|
||||
(InfixExp "*" (Variable "e") (Variable "f")))
|
||||
(InfixExp "-"
|
||||
(InfixExp "-"
|
||||
(InfixExp "- "
|
||||
(InfixExp "- "
|
||||
(InfixExp "*" (Variable "g") (Variable "h"))
|
||||
(InfixExp "*" (Variable "i") (Variable "j")))
|
||||
(InfixExp "*" (Variable "k") (Variable "l"))),
|
||||
-- 3
|
||||
InfixExp "-" (InfixExp "+" (Variable "a") (Variable "b")) (InfixExp "*" (Variable "c") (InfixExp "^" (Variable "d") (Variable "e"))),
|
||||
-- 4
|
||||
InfixExp "-" (InfixExp "-" (InfixExp "-" (InfixExp "-" (InfixExp "-" (Int "1") (Int "2")) (Int "3")) (Int "4")) (Int "5")) (Int "6"),
|
||||
InfixExp "-" (InfixExp "- " (InfixExp "- " (InfixExp "- " (InfixExp "- " (Int "1") (Int "2")) (Int "3")) (Int "4")) (Int "5")) (Int "6"),
|
||||
-- 5
|
||||
List [Int "1", Int "2", Int "3"],
|
||||
-- 6
|
||||
@@ -74,7 +74,7 @@ exps = [
|
||||
(InfixExp "-" (InfixExp "+" (Variable "a") (Variable "b")) (InfixExp "*" (Variable "c") (InfixExp "^" (Variable "d") (PathExpression (Variable "e") (Variable "x")))))
|
||||
(PrefixExp "not" (PostfixExp "exists" (Variable "a"))),
|
||||
-- 11
|
||||
IfSimple (List [Int "1", Function "Function" [Int "3"]]) (InfixExp "-" (InfixExp "-" (Int "1") (Int "2")) (InfixExp "*" (Int "3") (InfixExp "^" (PathExpression (Variable "a") (Variable "b")) (Variable "c")))),
|
||||
IfSimple (List [Int "1", Function "Function" [Int "3"]]) (InfixExp "- " (InfixExp "- " (Int "1") (Int "2")) (InfixExp "*" (Int "3") (InfixExp "^" (PathExpression (Variable "a") (Variable "b")) (Variable "c")))),
|
||||
-- 12
|
||||
InfixExp "or" (Variable "a") (Variable "b")
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user