Skip to content

Conversation

@emhoracek
Copy link
Member

No description provided.

@emhoracek emhoracek force-pushed the changing-api-to-be-more-conventional branch from 1c49014 to e308389 Compare May 23, 2018 14:41
maybeFillChildrenWith Nothing = textFill ""
maybeFillChildrenWith (Just s) = Fill $ \_s (pth, Template tpl) l ->
tpl pth s l
maybeFillChildrenWith (Just s) = Fill $ \_attrs tpl -> do
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove do

-> Fill s
mapSubs f xs = Fill $ \_attrs (pth, tpl) lib ->
T.concat <$> mapM (\n -> runTemplate tpl pth (f n) lib) xs
mapSubs f xs = Fill $ \_attrs tpl -> do
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove do

liftIO $ evalStateT f (pc { _pcState = s })
Template $ \m ->
do modify (lSubs .~ m)
-- lPath .= pth
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be set?

Fill $ \attr tpl ->
do st <- get
let pth = _lPath st
liftIO $ putStrLn ("Larceny: Missing fill for blank " <> show tn <> " in template " <> show pth)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start using the logger.

process :: [Node] -> ProcessT s
process :: [Node] -> LarcenyM s [Text]
process [] = return []
process (NodeElement (BindElement atr kids):nextNodes) = do
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove do

LarcenyM s [Text]
processBlank tagName atr kids = do
(ProcessContext pth m l _ mko _ _) <- get
m <- _lSubs <$> get
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't call this m

m <- _lSubs <$> get
filled <- fillAttrs atr
sequence [ toProcessState $ unFill (fillIn (Blank tagName) m)
sequence [ unFill (fillIn (Blank tagName) m)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sequence?

[Node] ->
LarcenyM s [Text]
processBind atr kids nextNodes = do
m <- _lSubs <$> get
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another m

@@ -0,0 +1,92 @@
{-# LANGUAGE OverloadedStrings #-}

module Web.Larceny.Legacy ( textFill
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is going to be useful, need to go through and make the types the same.

let incrementSub =
subs [("increment-and-print",
Fill $ \_ _ ->
do -- eek refactor later
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove or make it a real TODO

@emhoracek emhoracek changed the title Experiment Store Larceny state in monad transformer stack Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants