[Haskell-beginners] is this not a better way ? data structure
Alex Belanger
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.
- nitrix
On Nov 7, 2015 4:56 PM, "Roelof Wobben" <r.wobben at home.nl> wrote:
> 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
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151107/5482def9/attachment-0001.html>
More information about the Beginners
mailing list