
Hi, I want to build a framework to apply different functions to different types of lists and I want to generalize the solution as much as possible but my Haskell knowledge is not really enough to do this (I'm a haskell novice). The problem has two dimensions: 1. Lets say I have two functions: r13, ul : Char -> Char where r13 returns the rot13ed character, and ul converts upper case chars to lower case and vice versa. Later I want a rot13 function that can operate on different types of lists and an uxl function that can also operate on different types of lists. 2. Lets say I have two kinds of lists to handle: String and Data.ByteString.Lazy as L. For Strings I want the updater function to be used for each character and for L I want all items to be converted to Char, the updater function to be updated and the result to be converted back to the original item type. Therefore I define a common class for handling these lists: class ListUpdater a where updateFn :: Char -> Char update :: a -> a so I can define the update function for the different types of lists: instance ListUpdater String where update = map updateFn instance ListUpdater L.ByteString where update = L.pack . (map updateFn) . L.unpack But now how should I glue these 2 dimensions together? How to say that I want a rot13 function that applies to any data type instantiated from ListUpdater and that is using the r13 function to do the update? And also that I want an uxl function that also applies to any data type instantiated from ListUpdater and that is using the ul function to do the update? Thanks, Istvan