[Haskell-cafe] user type declarations in Haskell
Vladimir Portnykh
vportnykh at hotmail.com
Thu Jun 22 06:53:35 EDT 2006
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
First, it is not working because Haskell complains about a3. it does not
know how to calculate it.
Is it a way to give him a hint? QADouble is Double...am I doing something
absolutely wrong and silly?
many thanks, vladimir
_________________________________________________________________
Are you using the latest version of MSN Messenger? Download MSN Messenger
7.5 today! http://join.msn.com/messenger/overview
More information about the Haskell-Cafe
mailing list