Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/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. Re:  Haskell way of defining and implementing OO  interfaces
      (Julian Birch)
   2. Re:  Haskell way of defining and implementing OO  interfaces
      (Kim-Ee Yeoh)
   3.  Relatively simple undirected graph library? (Stuart Hungerford)
   4. Re:  Relatively simple undirected graph library? (Stefan H?ck)
   5. Re:  Beginners Digest, Vol 76, Issue 18 (ebi anomaro)


----------------------------------------------------------------------

Message: 1
Date: Sun, 4 Jan 2015 13:00:47 +0000
From: Julian Birch <[email protected]>
To: [email protected],  The Haskell-Beginners Mailing List - Discussion
        of primarily beginner-level topics related to Haskell
        <[email protected]>
Subject: Re: [Haskell-beginners] Haskell way of defining and
        implementing OO interfaces
Message-ID:
        <cab0tuzbpoahqhg2o9kd24p04azds1v1a7kmrukaam6cx89w...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Consider that

interface PasswordStore {
  void store(Path path, String secret, Map metadata);
}

is identical to

void store (PasswordStore store, Path path, String secret, Map metadata)

or

store :: PasswordStore -> Path -> secret -> MetaData -> IO ()

So, you can treat PasswordStore as a pure data structure (that has things
like connection details) and just define functions that use it.  I wouldn't
worry about grouping the functions together.(*) I'm going to assume you
don't really need an actual interface, but if you did, you could
investigate typeclasses.

Julian.

(*) In general terms, the only reason to group functions together is to
enforce laws that relate the behaviours together e.g. that you can retrieve
something you stored.

On 4 January 2015 at 11:14, Thomas Koch <[email protected]> wrote:

> Hi,
>
> I'm writing a password manager that implements a dbus-api using the dbus[1]
> package. I'd like to separate the code that implements from the dbus api
> from
> the code that stores and retrieves the secrets (passwords). In Java I'd
> use an
> interface, e.g.:
>
> interface PasswordStore {
>   void store(Path path, String secret, Map metadata);
>   (String secret, Map metadata) retrieve(Path path);
>   (String secret, Map metadata) search(Map criteria);
> }
>
> And the dbus-api would export this interface:
>
> dbusClient.export(PasswordStore store)
>
> What would be a Haskell way to do the same? My only idea is to define a
> record:
>
> data PasswordStore {
>     store :: Path -> Secret -> MetaData -> IO ()
>   , retrieve :: Path -> IO (Secret, MetaData)
>   , search :: Criteria -> IO (Secret, MetaData)
> }
>
> Thank you for any suggestions! Thomas Koch
>
> [1] http://hackage.haskell.org/package/dbus-0.10.9
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20150104/63901ded/attachment-0001.html>

------------------------------

Message: 2
Date: Sun, 4 Jan 2015 22:16:59 +0700
From: Kim-Ee Yeoh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Haskell way of defining and
        implementing OO interfaces
Message-ID:
        <CAPY+ZdSdvp_BDkzfYSWef=fqdCH0cuN94z1vdDD0B=4zh2f...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Sun, Jan 4, 2015 at 8:00 PM, Julian Birch <[email protected]> wrote:

Consider that
>
> interface PasswordStore {
>   void store(Path path, String secret, Map metadata);
> }
>
> is identical to
>
> void store (PasswordStore store, Path path, String secret, Map metadata)
>
> or
>
> store :: PasswordStore -> Path -> secret -> MetaData -> IO ()
>
>
In fact, Thomas's original PasswordStore definition uses record syntax to
simultaneously define 'store' as exactly that.

That is, PasswordStore is a data triple and the store function picks out
the first one.


> So, you can treat PasswordStore as a pure data structure (that has things
> like connection details) and just define functions that use it.  I wouldn't
> worry about grouping the functions together.(*) I'm going to assume you
> don't really need an actual interface, but if you did, you could
> investigate typeclasses.
>

If I understand correctly he wants the functions together because there's
this mysterious piece of Java (?):

dbusClient.export(PasswordStore store)

I agree that type classes are probably not a good idea here. Thomas, good
job on using a record of functions !

But this is the sort of discussion better suited on haskell-cafe, a strict
superset of this list, where there are domain experts on dbus to contribute.

Haskell-beginners is not better, merely more responsive on language
rudiments and libraries circa haskell 98 and LYAH.



> Julian.
>
> (*) In general terms, the only reason to group functions together is to
> enforce laws that relate the behaviours together e.g. that you can retrieve
> something you stored.
>
> On 4 January 2015 at 11:14, Thomas Koch <[email protected]> wrote:
>
>> Hi,
>>
>> I'm writing a password manager that implements a dbus-api using the
>> dbus[1]
>> package. I'd like to separate the code that implements from the dbus api
>> from
>> the code that stores and retrieves the secrets (passwords). In Java I'd
>> use an
>> interface, e.g.:
>>
>> interface PasswordStore {
>>   void store(Path path, String secret, Map metadata);
>>   (String secret, Map metadata) retrieve(Path path);
>>   (String secret, Map metadata) search(Map criteria);
>> }
>>
>> And the dbus-api would export this interface:
>>
>> dbusClient.export(PasswordStore store)
>>
>> What would be a Haskell way to do the same? My only idea is to define a
>> record:
>>
>> data PasswordStore {
>>     store :: Path -> Secret -> MetaData -> IO ()
>>   , retrieve :: Path -> IO (Secret, MetaData)
>>   , search :: Criteria -> IO (Secret, MetaData)
>> }
>>
>> Thank you for any suggestions! Thomas Koch
>>
>> [1] http://hackage.haskell.org/package/dbus-0.10.9
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20150104/392b3f4a/attachment-0001.html>

------------------------------

Message: 3
Date: Mon, 5 Jan 2015 07:51:57 +1100
From: Stuart Hungerford <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Relatively simple undirected graph
        library?
Message-ID:
        <CAG+kMrH-KFqHqGp7R8VgSB=3dnrwj_d+ouyxvjrxtqn6say...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hi,

I've recently started learning Haskell and I'm looking for a library
to create and manipulate undirected graphs for a small learning
project.  Ideally I'd like to be able to:

- represent undirected or directed graphs with vertex type a and edge type b

- not need to manually maintain mappings between vertex values and
vertices assumed to be integers

- be able to add and remove vertices and edges by their values with
appropriate checks for missing vertices etc

- find the connected components of a graph

Looking on Hackage I can see some very sophisticated graph libraries
including Data.Graph and Data.Graph.Inductive and others, but they all
seem to need vertices to be integers or not support changing the graph
once constructed.

This may well be my ignorance of both graph theory and Haskell but can
someone point me to a library that meets my needs or should I extend
the learning process and create one myself?

Thanks,

Stu


------------------------------

Message: 4
Date: Mon, 5 Jan 2015 05:26:59 +0100
From: Stefan H?ck <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Relatively simple undirected graph
        library?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Mon, Jan 05, 2015 at 07:51:57AM +1100, Stuart Hungerford wrote:
> Hi,
> 
> I've recently started learning Haskell and I'm looking for a library
> to create and manipulate undirected graphs for a small learning
> project.  Ideally I'd like to be able to:
> 
> - represent undirected or directed graphs with vertex type a and edge type b
> 
> - not need to manually maintain mappings between vertex values and
> vertices assumed to be integers
> 
> - be able to add and remove vertices and edges by their values with
> appropriate checks for missing vertices etc
> 
> - find the connected components of a graph
> 
> Looking on Hackage I can see some very sophisticated graph libraries
> including Data.Graph and Data.Graph.Inductive and others, but they all
> seem to need vertices to be integers or not support changing the graph
> once constructed.
> 
> This may well be my ignorance of both graph theory and Haskell but can
> someone point me to a library that meets my needs or should I extend
> the learning process and create one myself?
> 
> Thanks,
> 
> Stu

Hi Stu

I also was in need of a graph library comparable to what you describe,
which I'd like to use later on to represent molecular graphs in
cheminformatics projects. Since I did not find anything that fit my
needs on Hackage, I started writing my own implementation. The code is
not ready for anything and so far it's only unlabeled graphs. However,
adding labelings later on is - from my experience - no big thing
as most of the graph algorithms need only be implemented for unlabeled
graphs.

If you are interested, I could clean up the code and put it on github,
then we could work on it together. 

Many of the things you need like creating edge- and vertex-induced
subgraphs will require only very little work. The same goes for
extracting connected subgraphs and filtering by edge or vertex type.

Stefan


------------------------------

Message: 5
Date: Mon, 5 Jan 2015 17:44:39 +0900
From: ebi anomaro <[email protected]>
To: "[email protected]" <[email protected]>
Subject: Re: [Haskell-beginners] Beginners Digest, Vol 76, Issue 18
Message-ID: <7522255479251109642@unknownmsgid>
Content-Type: text/plain; charset=UTF-8

iPhone????

2014/10/20 21:00?"[email protected]"
<[email protected]> ??????:

> Send Beginners mailing list submissions to
>    [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>    http://www.haskell.org/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. Re:  Is working with Haskell easier on Linux than on a Mac?
>      (Brandon Allbery)
>   2. Re:  Is working with Haskell easier on Linux than on a Mac?
>      (Brandon Allbery)
>   3. Re:  Is working with Haskell easier on Linux than on a Mac?
>      (Michael Martin)
>   4.  GhcDynamic and DYNAMIC_GHC_PROGRAMS (Jeremy)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 19 Oct 2014 20:36:56 -0400
> From: Brandon Allbery <[email protected]>
> To: The Haskell-Beginners Mailing List - Discussion of primarily
>    beginner-level topics related to Haskell <[email protected]>
> Subject: Re: [Haskell-beginners] Is working with Haskell easier on
>    Linux than on a Mac?
> Message-ID:
>    <CAKFCL4VbGJrYcyNDW7L5SRa+a=ybwbhypxo2ybkrc9grtus...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> On Sun, Oct 19, 2014 at 8:34 PM, Michael Martin <[email protected]>
> wrote:
>
>> Signals.h provides an interface to OS process signals
>
>
> That is <signal.h>, not "Signals.h". And while case may be fungible on OS
> X, the trailing "s" is not.
>
> --
> brandon s allbery kf8nh                               sine nomine associates
> [email protected]                                  [email protected]
> unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> <http://www.haskell.org/pipermail/beginners/attachments/20141019/74598ada/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 19 Oct 2014 20:40:01 -0400
> From: Brandon Allbery <[email protected]>
> To: The Haskell-Beginners Mailing List - Discussion of primarily
>    beginner-level topics related to Haskell <[email protected]>
> Subject: Re: [Haskell-beginners] Is working with Haskell easier on
>    Linux than on a Mac?
> Message-ID:
>    <cakfcl4uvc-ek2oynxt0jnunndsqlrecfrwz7xga_sbbwwbm...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> On Sun, Oct 19, 2014 at 8:36 PM, Brandon Allbery <[email protected]>
> wrote:
>
>> On Sun, Oct 19, 2014 at 8:34 PM, Michael Martin <[email protected]>
>> wrote:
>>
>>> Signals.h provides an interface to OS process signals
>>
>>
>> That is <signal.h>, not "Signals.h". And while case may be fungible on OS
>> X, the trailing "s" is not.
>
> To be quite clear:
>
>    pyanfar:857 Z$ ls -l /usr/include/signal.h
>    -r--r--r--  1 root  wheel  5318 Oct 17 05:41 /usr/include/signal.h
>    pyanfar:858 Z$ pkgutil --file-info /usr/include/signal.h
>    volume: /
>    path: /usr/include/signal.h
>
>    pkgid: com.apple.pkg.DevSDK_OSX109
>    pkg-version: 6.1.0.0.1.1413057044
>    install-time: 1413646296
>    uid: 0
>    gid: 0
>    mode: 444
>
> --
> brandon s allbery kf8nh                               sine nomine associates
> [email protected]                                  [email protected]
> unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> <http://www.haskell.org/pipermail/beginners/attachments/20141019/fb122b30/attachment-0001.html>
>
> ------------------------------
>
> Message: 3
> Date: Sun, 19 Oct 2014 19:54:01 -0500
> From: Michael Martin <[email protected]>
> To: The Haskell-Beginners Mailing List - Discussion of primarily
>    beginner-level topics related to Haskell <[email protected]>
> Subject: Re: [Haskell-beginners] Is working with Haskell easier on
>    Linux than on a Mac?
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="windows-1252"; Format="flowed"
>
>
>> On 10/19/2014 07:36 PM, Brandon Allbery wrote:
>> On Sun, Oct 19, 2014 at 8:34 PM, Michael Martin <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>    Signals.h provides an interface to OS process signals
>>
>>
>> That is <signal.h>, not "Signals.h". And while case may be fungible on
>> OS X, the trailing "s" is not
>>
>> --
>> brandon s allbery kf8nh sine nomine associates
>> [email protected] <mailto:[email protected]>
>> [email protected] <mailto:[email protected]>
>> unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
>
> You are quite right. My apologies for jumping the gun on that one.
>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> <http://www.haskell.org/pipermail/beginners/attachments/20141019/c8377ff4/attachment-0001.html>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 20 Oct 2014 09:32:18 +0000 (UTC)
> From: Jeremy <[email protected]>
> To: [email protected]
> Subject: [Haskell-beginners] GhcDynamic and DYNAMIC_GHC_PROGRAMS
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=us-ascii
>
> mk/config.mk contains GhcDynamic and DYNAMIC_GHC_PROGRAMS variables. What is
> the difference between them? From the names and comments, it looks like
> DYNAMIC_GHC_PROGRAMS controls whether all the GHC binaries will be static or
> dynamically linked, but GhcDynamic only controls the GHC executable?
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
> ------------------------------
>
> End of Beginners Digest, Vol 76, Issue 18
> *****************************************


------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 79, Issue 5
****************************************

Reply via email to