[Haskell-beginners] is this not a better way ? data structure
i.caught.air at gmail.com
Sat Nov 7 22:03:11 UTC 2015
I feel the latter example serves only documentation purposes. Maybe
describe what those floats are in the former example and you can ignore the
extra type aliases entirely.
Introducing a new concern for your module/application when it appears only
once might just add extra complexity.
Of course, as the codebase grows and this datatype evolves, you'll probably
want to go that route, but until then, I think it's preemptively unecessery.
On Nov 7, 2015 4:56 PM, "Roelof Wobben" <r.wobben at home.nl> wrote:
> 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
> Beginners mailing list
> Beginners at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners