File tree 2 files changed +11
-8
lines changed
src/Language/NeuroML/LEMS
2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,13 @@ module Language.NeuroML.LEMS.Monad where
14
14
import Protolude
15
15
16
16
import Control.Monad.Except (ExceptT , runExceptT )
17
- import Control.Monad.State (StateT , evalStateT )
17
+ import Control.Monad.State (StateT , runStateT )
18
18
import Control.Monad.Identity (Identity , runIdentity )
19
19
20
- type CompilerMonad e s = ExceptT e (StateT s Identity ) Void
20
+ type CompilerMonad e s a = ExceptT e (StateT s Identity ) a
21
21
22
- runCompilerMonad :: s -> CompilerMonad e s -> Either e s
23
- runCompilerMonad s = runIdentity . flip evalStateT s . runExceptT
24
-
25
-
22
+ runCompilerMonad :: s -> CompilerMonad e s a -> Either e s
23
+ runCompilerMonad s m = let (ea, s') = (runIdentity . flip runStateT s . runExceptT) m
24
+ in case ea of
25
+ Left e -> Left e
26
+ Right _ -> Right s'
Original file line number Diff line number Diff line change @@ -28,10 +28,12 @@ import Language.NeuroML.LEMS.Semantics.Parser
28
28
29
29
import Language.NeuroML.LEMS.Monad (CompilerMonad , runCompilerMonad )
30
30
31
- type AnalysisMonad = CompilerMonad CompilerError Lems
31
+ type AnalysisMonad a = CompilerMonad CompilerError Lems a
32
32
33
33
processPTDimensions :: P. Lems -> AnalysisMonad Lems
34
- processPTDimensions pt = _
34
+ processPTDimensions pt = do
35
+ s <- get
36
+ put s
35
37
36
38
processParseTree :: P. Lems -> Either CompilerError Lems
37
39
processParseTree lemsPT = runCompilerMonad newModel $ processPTDimensions lemsPT
You can’t perform that action at this time.
0 commit comments