[Haskell-cafe] Wondering if this could be done.

Christopher Done chrisdone at googlemail.com
Mon Nov 22 02:46:25 EST 2010


Check out the awesome prelude, used to define ESDLs:
http://tom.lokhorst.eu/2010/02/awesomeprelude-presentation-video

On 22 November 2010 07:48, Magicloud Magiclouds <
magicloud.magiclouds at gmail.com> wrote:

> Hi,
>  For example, I have a data A defined. Then I want to add (+) and (-)
> operators to it, as a sugar (compared to addA/minusA). But * or other
> stuff defined in class Num is meanless to A. So I just do:
> (+) :: A -> A -> A
> (+) a b =
>  A (elem1 a + elem1 b) (elem2 a + elem2 b) -- I got errors here, for
> the (+) is ambiguous.
>
>  So, just wondering, does this way work in Haskell?
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101122/18aebb15/attachment.html


More information about the Haskell-Cafe mailing list