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

divyanshu ranjan idivyanshu.ranjan at gmail.com
Mon Sep 16 07:08:52 CEST 2013


This is functional dependency. For this case It means for given monad
m, there is unique possible value of Monoid w.

http://en.wikipedia.org/wiki/Type_class#Functional_dependencies
http://research.microsoft.com/pubs/67435/jfp06.pdf

Thanks
Divyanshu Ranjan

On Mon, Sep 16, 2013 at 10:30 AM, Vinay Emani <vinayemani at gmail.com> wrote:
> Hi,
>
> I'm trying to understand the MonadWriter class definition syntax. Now, I'm
> using GHC 7.6 and the class is defined as
>
> class (Monoid w, Monad m) => MonadWriter w m | m -> w where
>     ....
>
> 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.
>
> Regards
> Vinay
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



More information about the Beginners mailing list