diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2024-08-11 10:32:50 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2024-08-11 10:46:41 +0200 |
commit | e6bab9cb2aabafb27324f7d923739a8f4a96ad97 (patch) | |
tree | 1bb81f869aec62b994529595f887c671a6287ed0 /src/Parser/Core.hs | |
parent | 3a5e815ee41324573751d5369e136ee14c4b211f (diff) |
Remove MonadEval instance for TestParser
Diffstat (limited to 'src/Parser/Core.hs')
-rw-r--r-- | src/Parser/Core.hs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/Parser/Core.hs b/src/Parser/Core.hs index 341d9ca..2a74d3d 100644 --- a/src/Parser/Core.hs +++ b/src/Parser/Core.hs @@ -6,7 +6,6 @@ import Control.Monad.Writer import Data.Text (Text) import qualified Data.Text.Lazy as TL -import Data.Typeable import Data.Void import Text.Megaparsec hiding (State) @@ -28,15 +27,11 @@ data TestParserState = TestParserState , testContext :: SomeExpr } -someEmptyVar :: SomeExprType -> SomeVarValue -someEmptyVar (SomeExprType (Proxy :: Proxy a)) = SomeVarValue $ emptyVarValue @a - textSomeExprType :: SomeExprType -> Text textSomeExprType (SomeExprType p) = textExprType p -instance MonadEval TestParser where - lookupVar name = maybe (fail $ "variable not in scope: '" ++ unpackVarName name ++ "'") (return . someEmptyVar) =<< gets (lookup name . testVars) - rootNetwork = return emptyVarValue +lookupVarType :: VarName -> TestParser SomeExprType +lookupVarType name = maybe (fail $ "variable not in scope: '" ++ unpackVarName name ++ "'") return =<< gets (lookup name . testVars) skipLineComment :: TestParser () skipLineComment = L.skipLineComment $ TL.pack "#" |