[Haskell-cafe] records proposals list

Wolfgang Jeltsch wolfgang at jeltsch.net
Mon Nov 21 05:30:10 EST 2005


Am Montag, 21. November 2005 08:31 schrieb Bulat Ziganshin:
> Hello Wolfgang,
>
> Sunday, November 20, 2005, 6:21:05 PM, you wrote:
> >> data Coord = { x,y :: Double }
> >> data Point : Coord = { c :: Color }
>
> > A point is not a special coordinate pair.  Instead it has a coordinate
> > paar as one of its properties.  So the above-mentioned problem would be
> > better handled this way:
> >
> >         data Coord { x, y :: Double }
> >         data Point = Point {coord :: Coord, c :: Color }
>
> because this allows a large number of procedures written to work with
> Coord, to automatically work with Point. iy just a matter of
> usability. currently, my program is full of double-dereferncing, like
> this:
>
> [...]

You should never use bad design to increase usability, I'd say.

> [...]

Best wishes,
Wolfgang


More information about the Haskell-Cafe mailing list