
Hello Wolfgang, Monday, November 21, 2005, 1:30:10 PM, you wrote:
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:
[...]
WJ> You should never use bad design to increase usability, I'd say. to be exact now i have the following definitions: data FileInfo = FileInfo { fiFilteredName :: !PackedFilePath , fiDiskName :: !PackedFilePath , fiStoredName :: !PackedFilePath , fiSize :: !FileSize , fiTime :: !FileTime , fiIsDir :: !Bool } -- |File to compress: either file on disk or compressed file in existing archive data FileToCompress = DiskFile { cfFileInfo :: FileInfo } | CompressedFile { cfFileInfo :: FileInfo , cfArcBlock :: ArchiveBlock -- Archive datablock which contains file data , cfPos :: FileSize -- Starting byte of file data in datablock , cfCRC :: CRC -- File's CRC } i prefer to replace second definition with the -- |File to compress: either file on disk or compressed file in existing archive data CompressedFile : FileInfo = CompressedFile { cfArcBlock :: ArchiveBlock -- Archive datablock which contains file data , cfPos :: FileSize -- Starting byte of file data in datablock , cfCRC :: CRC -- File's CRC } and then use procedures, written to work with FileInfo, to directly work with CompressedFile also. now my program is full of constructs like: uiStartProcessing (map cfFileInfo (arcDirectory arcinfo)) let fileinfo = cfFileInfo compressed_file and double-dereferencing about i wrote in previous letter. such change will allow me to omit all these superfluous code. imho, new design will be more natural and allow me to think about my algorithms instead of implementation complications -- Best regards, Bulat mailto:bulatz@HotPOP.com