Skip to content

Commit 91df879

Browse files
committed
Fixed monad?
1 parent dfe6065 commit 91df879

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/Language/NeuroML/LEMS/Monad.hs

+7-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ module Language.NeuroML.LEMS.Monad where
1414
import Protolude
1515

1616
import Control.Monad.Except (ExceptT, runExceptT)
17-
import Control.Monad.State (StateT, evalStateT)
17+
import Control.Monad.State (StateT, runStateT)
1818
import Control.Monad.Identity (Identity, runIdentity)
1919

20-
type CompilerMonad e s = ExceptT e (StateT s Identity) Void
20+
type CompilerMonad e s a = ExceptT e (StateT s Identity) a
2121

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'

src/Language/NeuroML/LEMS/Semantics/Analysis.hs

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ import Language.NeuroML.LEMS.Semantics.Parser
2828

2929
import Language.NeuroML.LEMS.Monad (CompilerMonad, runCompilerMonad)
3030

31-
type AnalysisMonad = CompilerMonad CompilerError Lems
31+
type AnalysisMonad a = CompilerMonad CompilerError Lems a
3232

3333
processPTDimensions :: P.Lems -> AnalysisMonad Lems
34-
processPTDimensions pt = _
34+
processPTDimensions pt = do
35+
s <- get
36+
put s
3537

3638
processParseTree :: P.Lems -> Either CompilerError Lems
3739
processParseTree lemsPT = runCompilerMonad newModel $ processPTDimensions lemsPT

0 commit comments

Comments
 (0)