Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Config data (Mike Houghton)
2. Re: Config data (Sumit Sahrawat, Maths & Computing, IIT (BHU))
3. Re: Config data (Sumit Sahrawat, Maths & Computing, IIT (BHU))
4. Re: Config data (mike h)
5. Re: Config data (Sumit Sahrawat, Maths & Computing, IIT (BHU))
----------------------------------------------------------------------
Message: 1
Date: Sat, 6 Jun 2015 19:43:45 +0100
From: Mike Houghton <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Config data
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Hi,
I?ve haskell files parser.hs and email.hs
email.hs is a module imported into parser and parser has the main.
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...
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 ??)
However parser can load the config in its main and then tell mail what the
values are but how would mail save them?
Of course I could chanage the signatures of the email send/receive functions in
mail to take the connection details but that seems wrong.
Thanks
Mike
------------------------------
Message: 2
Date: Sun, 7 Jun 2015 00:15:27 +0530
From: "Sumit Sahrawat, Maths & Computing, IIT (BHU)"
<[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Config data
Message-ID:
<CAJbEW8PFMqYxFVsp-ka1i6=iOxzAMHd1VXJs=cjzimoknpe...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
It would me more logical if you had three modules, Parser, EMail, Main,
where Main imports the other two, and they are independent.
On 7 June 2015 at 00:13, Mike Houghton <[email protected]> wrote:
> Hi,
>
> I?ve haskell files parser.hs and email.hs
> email.hs is a module imported into parser and parser has the main.
>
> 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...
>
> 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
> ??)
>
> However parser can load the config in its main and then tell mail what the
> values are but how would mail save them?
>
> Of course I could chanage the signatures of the email send/receive
> functions in mail to take the connection details but that seems wrong.
>
> Thanks
>
> Mike
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
--
Regards
Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150607/28b73688/attachment-0001.html>
------------------------------
Message: 3
Date: Sun, 7 Jun 2015 00:19:52 +0530
From: "Sumit Sahrawat, Maths & Computing, IIT (BHU)"
<[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Config data
Message-ID:
<cajbew8p74ls+gimgbdkcxokda8rzvwifq28+exriyg4mgtm...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
You can save the values inside the EMail module at startup using a global
variable, but that is not recommended. (
https://wiki.haskell.org/Top_level_mutable_state)
On 7 June 2015 at 00:15, Sumit Sahrawat, Maths & Computing, IIT (BHU) <
[email protected]> wrote:
> It would me more logical if you had three modules, Parser, EMail, Main,
> where Main imports the other two, and they are independent.
>
> On 7 June 2015 at 00:13, Mike Houghton <[email protected]>
> wrote:
>
>> Hi,
>>
>> I?ve haskell files parser.hs and email.hs
>> email.hs is a module imported into parser and parser has the main.
>>
>> 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...
>>
>> 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
>> ??)
>>
>> However parser can load the config in its main and then tell mail what
>> the values are but how would mail save them?
>>
>> Of course I could chanage the signatures of the email send/receive
>> functions in mail to take the connection details but that seems wrong.
>>
>> Thanks
>>
>> Mike
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>
>
>
> --
> Regards
>
> Sumit Sahrawat
>
--
Regards
Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150607/9ea85823/attachment-0001.html>
------------------------------
Message: 4
Date: Sat, 6 Jun 2015 19:07:17 +0000 (UTC)
From: mike h <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Config data
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="utf-8"
Global state is an option - thanks. Didn't think Haskell allowed this.
Having three modules may be more logical but doesn't it just put the same
problem into the new module?
Thanks
On Saturday, 6 June 2015, 19:43, Mike Houghton
<[email protected]> wrote:
Hi,
I?ve haskell files? parser.hs and email.hs
email.hs is a module imported into parser and parser has the main.
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...
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 ??)
However parser can load the config in its main and then tell mail what the
values are but how would mail save them?
Of course I could chanage the signatures of the email send/receive functions in
mail? to take the connection details but that seems wrong.
Thanks
Mike
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150606/d5ca9fcb/attachment-0001.html>
------------------------------
Message: 5
Date: Sun, 7 Jun 2015 00:46:32 +0530
From: "Sumit Sahrawat, Maths & Computing, IIT (BHU)"
<[email protected]>
To: mike h <[email protected]>, The Haskell-Beginners
Mailing List - Discussion of primarily beginner-level topics related
to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Config data
Message-ID:
<cajbew8okhsc2wfd+c4f1gm32dvpgyz1ypocz2peeod5qv2t...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Yeah, sorry I missed the last line on my first read.
The link I gave you also explains how to achieve the same functionality as
global variables without using them.
The unsafePerformIO hack works, but for small modules it's much more
helpful to do it safely.
On 7 June 2015 at 00:37, mike h <[email protected]> wrote:
> Global state is an option - thanks. Didn't think Haskell allowed this.
>
> Having three modules may be more logical but doesn't it just put the same
> problem into the new module?
>
> Thanks
>
>
>
> On Saturday, 6 June 2015, 19:43, Mike Houghton <
> [email protected]> wrote:
>
>
> Hi,
>
> I?ve haskell files parser.hs and email.hs
> email.hs is a module imported into parser and parser has the main.
>
> 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...
>
> 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
> ??)
>
> However parser can load the config in its main and then tell mail what the
> values are but how would mail save them?
>
> Of course I could chanage the signatures of the email send/receive
> functions in mail to take the connection details but that seems wrong.
>
> Thanks
>
> Mike
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
--
Regards
Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150607/f1c43108/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 84, Issue 8
****************************************