> On 22 November 2010 07:48, Magicloud Magiclouds
> <[email protected] <mailto:[email protected]>>
> 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?

(*) and (+) are in separate type classes in Numeric-Prelude.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to