Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Web/Larceny/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Web.Larceny.Internal ( findTemplate
import Control.Exception
import Lens.Micro
import Control.Monad.Trans (liftIO)
import Control.Monad.State (MonadState, StateT, evalStateT, runStateT, get, modify)
import Control.Monad.State (MonadState, StateT, evalStateT, runStateT, get, put, modify)
import qualified Data.HashSet as HS
import qualified Data.Map as M
import Data.Maybe (fromMaybe)
Expand Down Expand Up @@ -111,7 +111,9 @@ toProcessState f =
toUserState :: ProcessContext s -> StateT (ProcessContext s) IO a -> StateT s IO a
toUserState pc f =
do s <- get
liftIO $ evalStateT f (pc { _pcState = s })
(result, pc') <- liftIO $ runStateT f (pc { _pcState = s })
put (_pcState pc')
return result

fillIn :: Blank -> Substitutions s -> Fill s
fillIn tn m = fromMaybe (fallbackFill tn m) (M.lookup tn m)
Expand Down Expand Up @@ -172,8 +174,6 @@ process (currentNode:nextNodes) = do
return [t]
NodeComment c ->
return ["<!--" <> c <> "-->"]
_ ->
return []
restOfNodes <- process nextNodes
return $ processedNode ++ restOfNodes

Expand Down