Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store Larceny state in monad transformer stack #61

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

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
@@ -182,8 +182,8 @@ fillChildrenWith' m = maybeFillChildrenWith' (Just <$> m)
-- > Bonnie Thunders
maybeFillChildrenWith :: Maybe (Substitutions s) -> Fill s
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

@@ -124,17 +124,17 @@ rawTextFill' t = Fill $ \_m _t _l -> t
mapSubs :: (a -> Substitutions s)
-> [a]
-> 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

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

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.

1 participant