[Haskell-cafe] records proposals list

Bulat Ziganshin bulatz at HotPOP.com
Mon Nov 21 02:31:10 EST 2005


Hello Wolfgang,

Sunday, November 20, 2005, 6:21:05 PM, you wrote:

>> data Coord = { x,y :: Double }
>> data Point : Coord = { c :: Color }

WJ> A point is not a special coordinate pair.  Instead it has a coordinate paar as 
WJ> one of its properties.  So the above-mentioned problem would be better 
WJ> handled this way:

WJ>         data Coord { x, y :: Double }
WJ>         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:

          if (fiTime (cfFileInfo arcfile) >= fiTime (cfFileInfo diskfile))
          maximum (last_time' : map (fiTime.cfFileInfo) dir)
  let size         =  fiSize      (cfFileInfo cfile')
      bytes = sum$ map (fiSize.cfFileInfo) directory
  let keyFunc  =  fiStoredName . cfFileInfo


-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-Cafe mailing list