diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2023-01-03 23:33:54 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2023-01-03 23:33:54 +0100 |
| commit | 3cc35a9414a8ba102a63af64bc5647ea75bc10b2 (patch) | |
| tree | 42033391b50822737b8849994849563a4523d3ba /app/Interpreter.hs | |
| parent | dc13c4d5dfd0da1f0bcf8b5a9ffa760220d628c9 (diff) | |
| download | prlg-3cc35a9414a8ba102a63af64bc5647ea75bc10b2.tar.gz prlg-3cc35a9414a8ba102a63af64bc5647ea75bc10b2.tar.bz2 | |
numbers
Diffstat (limited to 'app/Interpreter.hs')
| -rw-r--r-- | app/Interpreter.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/Interpreter.hs b/app/Interpreter.hs index d82793b..bb47144 100644 --- a/app/Interpreter.hs +++ b/app/Interpreter.hs @@ -94,6 +94,10 @@ proveStep = St.get >>= go | a == b = uok unify VoidRef (Atom _) = uok unify (Atom _) VoidRef = uok + unify (Number a) (Number b) + | a == b = uok + unify VoidRef (Number _) = uok + unify (Number _) VoidRef = uok unify (Struct a) (Struct b) | a == b = uok {- unifying a struct with void must cause us to skip the void -} @@ -130,6 +134,7 @@ proveStep = St.get >>= go FreeRef hr -> case g of atom@(Atom _) -> setHeap hr atom + number@(Number _) -> setHeap hr number s@(Struct _) -> withNewHeapStruct hr @@ -147,7 +152,8 @@ proveStep = St.get >>= go FreeRef gr -> setHeap hr (HeapRef gr) BoundRef addr _ -> setHeap hr (HeapRef addr) _ -> ifail "dangling goal ref (from head ref)" - BoundRef _ atom@(Atom a) -> unify atom g + BoundRef _ atom@(Atom _) -> unify atom g + BoundRef _ number@(Number _) -> unify number g BoundRef addr struct@(Struct Id {arity = arity}) -> c i @@ -165,6 +171,7 @@ proveStep = St.get >>= go FreeRef gr -> case h of atom@(Atom _) -> setHeap gr atom + number@(Number _) -> setHeap gr number s@(Struct _) -> withNewHeapStruct gr |
