Can we please not suggest "not recommended" solutions (that most of us probably wouldn't use) without at least providing a recommended alternative?<br><br>You can parse the config file into a record and then either pass it as an argument wherever it is needed or use Reader (or ReaderT) to make it more implicit.<br><div class="gmail_quote">On Sat, Jun 6, 2015 at 12:16 PM Sumit Sahrawat, Maths & Computing, IIT (BHU) <<a href="mailto:sumit.sahrawat.apm13@iitbhu.ac.in">sumit.sahrawat.apm13@iitbhu.ac.in</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yeah, sorry I missed the last line on my first read.<div><br></div><div>The link I gave you also explains how to achieve the same functionality as global variables without using them.</div><div>The unsafePerformIO hack works, but for small modules it's much more helpful to do it safely.</div></div><div class="gmail_extra"></div><div class="gmail_extra"><br><div class="gmail_quote">On 7 June 2015 at 00:37, mike h <span dir="ltr"><<a href="mailto:mike_k_houghton@yahoo.co.uk" target="_blank">mike_k_houghton@yahoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"><div>Global state is an option - thanks. Didn't think Haskell allowed this.</div><div><br></div><div>Having three modules may be more logical but doesn't it just put the same problem into the new module?</div><div><br></div><div>Thanks</div><div><div>  <br><div><br><br></div><div style="display:block"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,Sans-Serif;font-size:16px"> <div dir="ltr"> <font size="2" face="Arial"> On Saturday, 6 June 2015, 19:43, Mike Houghton <<a href="mailto:mike_k_houghton@yahoo.co.uk" target="_blank">mike_k_houghton@yahoo.co.uk</a>> wrote:<br> </font> </div>  <br><br> <div>Hi,<br><br>I’ve haskell files  parser.hs and email.hs<br>email.hs is a module imported into parser and parser has the main.<br><br>email has various passwords and server names needed to connect and send email. I want to have those details in a config file and read it  in at start - using say config module.  I’m ok with this part but the practicality of doing it eludes me... <br><br>It seems to me that email module can either get the config details itself or be told them by parser. If email wants to get them how would it do this? It does not have a main that gets run so can’t load a config file.(can it ??)<br><br>However parser can load the config in its main and then tell mail what the values are but how would mail save them? <br><br>Of course I could chanage the signatures of the email send/receive functions in mail  to take the connection details but that seems wrong.<br><br>Thanks<br><br>Mike<br><br><br>_______________________________________________<br>Beginners mailing list<br><a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br><br><br></div>  </div> </div>  </div></div></div></div></div><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div></div><div class="gmail_extra">-- <br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Regards</div><div dir="ltr"><div><br></div><div>Sumit Sahrawat</div></div></div></div></div></div></div>
</div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>