2006/6/22, Vladimir Portnykh <[EMAIL PROTECTED]>:
I am trying to define the following types

data MyStringType a = String deriving (Eq, Ord, Show)
data QADouble a = Double deriving (Eq, Ord, Show)
data HType a = QADouble a| DDTraceType a deriving (Eq, Ord, Show)

So HType can represent strings or doubles.
later I want to do something like the following:
let a1 =QADouble 1
let a2 =QADouble 2
let a3 = a1 + a2

a1 and a2 have type HType (not QADouble, nor Double).
GHC doesn't know how to use (+) on HType because (+) is meaningful
only for Num instances :
try to type ':t (+)' in ghci : it will give you the type of (+).
try to type also ':t a1'.

hope it helps,
vo minh thu
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to