From b89d46e7df8ae65786abe37b5703392e9042db83 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Thu, 23 Feb 2023 23:23:21 +1300 Subject: StackModifiers now use Void --- DSL/Interpretation.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'DSL/Interpretation.hs') 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 -- cgit v1.2.1