summaryrefslogtreecommitdiff
path: root/DSL/Interpretation.hs
diff options
context:
space:
mode:
authorMatthew Hall <hallmatthew314@gmail.com>2023-02-23 23:23:21 +1300
committerMatthew Hall <hallmatthew314@gmail.com>2023-02-23 23:23:21 +1300
commitb89d46e7df8ae65786abe37b5703392e9042db83 (patch)
tree2ed4605a80f7f407f98325a862b32629b40f0f78 /DSL/Interpretation.hs
parent1c2e8f59960c18b5e5794fba214a3f0906fb074d (diff)
StackModifiers now use Void
Diffstat (limited to 'DSL/Interpretation.hs')
-rw-r--r--DSL/Interpretation.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/DSL/Interpretation.hs b/DSL/Interpretation.hs
index 82a8ef2..34137a9 100644
--- a/DSL/Interpretation.hs
+++ b/DSL/Interpretation.hs
@@ -1,7 +1,9 @@
module DSL.Interpretation where
import qualified Data.Map.Strict as M
+import Data.Bifunctor (first)
import Data.Foldable (foldlM)
+import Data.Void
import DSL.Types
import DSL.Util
@@ -20,7 +22,7 @@ pushData m@Machine{ stack=xs } x = m{ stack=x:xs }
runModifier :: StackModifier -> Stack -> IO (Either String Stack)
runModifier sm s = case runChecks (smTypes sm) s of
Just err -> return $ Left $ smName sm ++ ": " ++ err
- Nothing -> Right <$> smFunc sm s
+ Nothing -> first absurd <$> smFunc sm s
applyIntrinsic :: Intrinsic -> Machine -> IO Machine
applyIntrinsic i m = do