<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 15, 2018 at 7:08 AM, Vanessa McHale <span dir="ltr"><<a href="mailto:vanessa.mchale@iohk.io" target="_blank">vanessa.mchale@iohk.io</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>You can simply use a state monad and then extract the data later
when you don't want the extra state, viz.<br>
</p>
<pre><code class="m_-1383200434585185067haskell m_-1383200434585185067hljs"><p><span class="m_-1383200434585185067hljs-title">sum</span> :: (<span class="m_-1383200434585185067hljs-type">Num</span> a) => [a] -> a
<span class="m_-1383200434585185067hljs-title">sum</span> xs = flip execState <span class="m_-1383200434585185067hljs-number">0</span> $
mapM_ (\x -> <span class="m_-1383200434585185067hljs-keyword">do</span> { s <- get ; put $ x + s }) xs</p></code></pre><span class="">
<br></span></div></blockquote><div><br></div><div>Not quite sure how this relates to my point. I need to have modify access to the state in the deeper, original monad, as well as a temporary state monad on top of it. And I don't want to create a single data constructor for a single state monad that has fields for every conceivable use anywhere in my code.</div><div><br></div><div>D<br></div></div><br></div></div>