<div dir="ltr"><br><br><div class="gmail_quote">On Sat, May 16, 2015 at 10:05 PM Alex <<a href="mailto:alex323@gmail.com">alex323@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, 16 May 2015 18:30:31 +0000<br>
Michael Snoyman <<a href="mailto:michael@snoyman.com" target="_blank">michael@snoyman.com</a>> wrote:<br>
<br>
> Typically it would look something like this:<br>
><br>
> myApp :: AppConfig -> Application<br>
><br>
> main = do<br>
> appConfig <- getAppConfig<br>
> run 3000 $ myApp appConfig<br>
><br>
> Within myApp, you can now access the AppConfig value and use<br>
> runReaderT to unwrap your MyApp transformer.<br>
><br>
<br>
Is a consequence of this design that I have to use runReaderT every<br>
time I want to use a function of the type (Foo -> MyApp Bar) from within<br>
myApp? Is it better/easier to simply rewrite the all functions myApp<br>
calls so that they accept an AppConfig parameter instead of returning a<br>
MyApp Bar?<br>
<br>
--<br>
Alex<br></blockquote><div><br></div><div>That's one approach. You can also do something like:<br><br></div>myApp appConfig req respond = flip runReaderT appConfig $ do<br></div><div class="gmail_quote"> someFunc<br> ...<br><br></div><div class="gmail_quote">someFunc :: MyApp ()<br></div></div>