Data structure definitions

Johan Nordlander nordland@cs.chalmers.se
Wed, 9 Oct 2002 18:44:28 +0200


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 Expression > Value, Number = other stuff
>
>   newtype VariableCount = VariableCount (Variable, Number)
>
> -- Johan

Ahem, it was brought to my attention that O'Haskell doesn't support 
Haskell's named datatype fields, which I should be the first to know... 
  I got a little carried away, it seems :-)

So I'm rephrasing my example into

   data Variable = Variable String Expression
   data Number = Number Double Dimension

   data Value > Number = other stuff

   data Expression > Value, Number = other stuff

   newtype VariableCount = VariableCount (Variable, Number)

Apologies,
Johan