Re: Data structure definitions

2002-10-09 Thread Johan Nordlander
Mark T.B. Carroll wrote: I have a program that basically has, data Expression = Value Value | EVariable Variable | other stuff ... data Value = VNumber Number | other stuff ... data Variable = Variable { variable_name :: String, variable_time :: Expression }

Re: Data structure definitions

2002-10-09 Thread Johan Nordlander
Johan Nordlander wrote: For comparison, the example could be formulated in O'Haskell as follows: data Variable = Variable { variable_name :: String, variable_time :: Expression } data Number = Number { value :: Double, dimension :: Dimension } data Value Number = other stuff

Data structure definitions

2002-10-08 Thread Mark T.B. Carroll
I have a program that basically has, data Expression = Value Value | EVariable Variable | other stuff ... data Value = VNumber Number | other stuff ... data Variable = Variable { variable_name :: String, variable_time :: Expression } data Number = Number { value ::

Re: Data structure definitions

2002-10-08 Thread Hal Daume III
I think this is more or less the standard way of doing it. I don't think type classes are the right thing to do. Usually constructors are prefixed with the first character of their type in situations like this (or so I've seen), so you get: data Expression = EValue Value | EVariable Variable |