summaryrefslogtreecommitdiff
path: root/source/Meaning.hs
diff options
context:
space:
mode:
authorSimon-Kor <52245124+Simon-Kor@users.noreply.github.com>2024-08-26 20:14:18 +0200
committerSimon-Kor <52245124+Simon-Kor@users.noreply.github.com>2024-08-26 20:14:18 +0200
commit76ea8e11d943b123d28dfbe2f354838f80fb8dba (patch)
treeb9f8439ca3bc9d689182d4db0eb4c8f674a8c919 /source/Meaning.hs
parenta253d06a0755c41dd321fc2e235c3332de63a8c7 (diff)
Implemented the checking for local functions.
Diffstat (limited to 'source/Meaning.hs')
-rw-r--r--source/Meaning.hs12
1 files changed, 5 insertions, 7 deletions
diff --git a/source/Meaning.hs b/source/Meaning.hs
index 30e13f8..ab98c9a 100644
--- a/source/Meaning.hs
+++ b/source/Meaning.hs
@@ -607,17 +607,15 @@ glossProof = \case
else error "mismatched variables in function definition."
Raw.DefineFunctionMathy funVar domVar ranVar funVar2 argVar definitions proof -> do
- if funVar /= funVar2
- then error "missmatched function names"
- else Sem.DefineFunctionMathy funVar domVar ranVar argVar <*> glossLocalFunctionExprEach definitions <*> glossProof proof
+ if funVar == funVar2
+ then Sem.DefineFunctionMathy funVar domVar ranVar argVar <$> (glossLocalFunctionExprDef `each` definitions) <*> glossProof proof
+ else error "missmatched function names"
Raw.Calc calc proof ->
Sem.Calc <$> glossCalc calc <*> glossProof proof
-glossLocalFunctionExprEach :: NonEmpty [(Raw.Expr, Raw.Formula)]-> Gloss [(Sem.Term, Sem.Formula)]
-glossLocalFunctionExprEach def = pure ( glossLocalFunctionExpr `each` def )
-glossLocalFunctionExpr :: (Raw.Expr, Raw.Formula) -> Gloss (Sem.Term, Sem.Formula)
-glossLocalFunctionExpr (definingExpression, localDomain) = do
+glossLocalFunctionExprDef :: (Raw.Expr, Raw.Formula) -> Gloss (Sem.Term, Sem.Formula)
+glossLocalFunctionExprDef (definingExpression, localDomain) = do
e <- glossExpr definingExpression
d <- glossFormula localDomain
pure (e,d)