
Bulat Ziganshin wrote: (very sound software engineering arguments - can someone with The Force please copy Bulat's mail to Haskell/Category/Style ...) I agree completely, and just add one remark here :
data Encoding = Encoding { encode :: String -> String , decode :: String -> String }
utf8 = Encoding encodeUtf8 decodeUtf8
this is in fact a method table (Java speak) or a dictionary (Haskell), and Encoding is the interface (class) - except that we can have local instances by passing around dictionaries explicitly. This is similar to passing a Comparator object to some sorting routine. Best regards, Johannes. PS: go read any honest OO book on the benefits of interface oriented design - they know this stuff - they got there the hard way (that is, via C++ :-)