Hi Bulat, Yes, that's what I had to do when using assembler in the 19080s, but it was nice to get rid of that when using C/C++ or any other imperative/OO language that I'm aware of.
You see, for someone with an imperative/OO background, the Haskell record restriction on field names looks incredibly dumb. But when using type classes to encapsulate the fields makes each function polymorphic on any record that implements these field wrappers, thus enhancing abstraction. Type inference helps a lot here, otherwise one would have to type each constraint in the signature of the function, which is a pain (forgive me if I'm using incorrect terms here, I come from the OO world...) Personally I like that, but that's a question of taste I guess. Peter -----Original Message----- From: Bulat Ziganshin [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 19, 2007 8:39 AM To: peterv Cc: 'Claus Reinke'; haskell-cafe@haskell.org Subject: Re[2]: [Haskell-cafe] Useful IDE features - "implement instance" Hello peterv, Monday, June 18, 2007, 6:44:06 PM, you wrote: > Just another wild idea which I might find useful, but is more like > refactoring, is to convert the fields of a record to get/set type-classes, > and refactor all usages of those fields. i never done such refactoring. just use different names for fields. a rule of thumb is including of record name in field names: data PackedFilePath = PackedFilePath { fpPackedDirectory :: !MyPackedString , fpPackedBasename :: !MyPackedString , fpLCExtension :: !String , fpHash :: {-# UNPACK #-} !Int32 , fpParent :: !PackedFilePath } | RootDir data FileInfo = FileInfo { fiFilteredName :: !PackedFilePath , fiDiskName :: !PackedFilePath , fiStoredName :: !PackedFilePath , fiSize :: {-# UNPACK #-} !FileSize , fiTime :: {-# UNPACK #-} !FileTime , fiIsDir :: {-# UNPACK #-} !Bool } -- Best regards, Bulat mailto:[EMAIL PROTECTED] _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe