Send Beginners mailing list submissions to
        beginners@haskell.org

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
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Expressing the idea of a group in Haskell (Christian)


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

Message: 1
Date: Wed, 16 Mar 2011 08:49:27 +0000 (UTC)
From: Christian <ch.go...@googlemail.com>
Subject: [Haskell-beginners] Expressing the idea of a group in Haskell
To: beginners@haskell.org
Message-ID: <loom.20110316t094225-...@post.gmane.org>
Content-Type: text/plain; charset=us-ascii

Hello Haskell-Experts!
I was trying to express the notion of a (mathematical) group
in Haskell, using type classes, as an exercise.
If I am not mistaken, a group can be for example the Reals together with
the multiplication operation and "1" as the neutral element.
Or, the Reals with addition and "0".
my first idea was to write something like

 class Group a where
   ...

_but_, I thought, I need to parameterise, so to speak, not only using the
type "a", but also the group operation. 
How could I do that in Haskell? Is that even possible?

Thanks in advance!
Christian




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

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 33, Issue 18
*****************************************

Reply via email to