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@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@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Geen virus gevonden in dit bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 2015.0.6173 / Virusdatabase: 4457/10963 - datum van uitgifte: 11/07/15