[Haskell-beginners] is this not a better way ? data structure

Roelof Wobben r.wobben at home.nl
Sat Nov 7 21:56:43 UTC 2015


Hello,

In the book there is a example of this data-structure.

data Shape = Circle float float
                      | Rectangle float float

Now I have to change it to add a center point.

But I wonder if this is not a better way to describe it

Data Schape = Circle Radius
                     | Rectangle Width Height

Type Radius = Float
type Width = Float
type Height = Float

Roelof



More information about the Beginners mailing list