[Haskell-beginners] Help needed in understanding MonadWriter syntax.

Kim-Ee Yeoh ky3 at atamo.com
Mon Sep 16 10:05:14 CEST 2013


On Mon, Sep 16, 2013 at 12:00 PM, Vinay Emani <vinayemani at gmail.com> wrote:

> I've never seen '|' in the middle of a class definition, could some one
> explain this? It's used in the guard syntax as well as to separate data
> constructors in a type definition.


You're quite right. The vertical bar is used in /defining/

(1) a /typeclass/ that has functional dependencies
(2) a /function/ using pattern guards
(3) a /datatype/ that is a sum of two or more datatypes.

These are all different, as you've guessed. The reason the syntax
conflation works is that all these constructs are different.

The canonical intro to fundeps is the container/element example. See
Section 3 on collection types in

http://web.cecs.pdx.edu/~mpj/pubs/fundeps.html

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130916/49e4b777/attachment.htm>


More information about the Beginners mailing list