Tomasz Zielonka wrote: > On Tue, Dec 27, 2005 at 04:39:34PM +0000, Chris Kuklewicz wrote: > >>Happy Holidays, >> >>I was wondering if it this small snippet of code could be altered to >>require fewer OPTIONS -fallow-... switches. >> >>It creates a show-what-i-mean function called "swim" that takes a >>variable number of arguments, and treats strings as-is, calling show on >>the other arguments. > > > Perhaps you can use the same trick that allows "show" to treat > String = [Char] differently than all other lists? I mean the > showList method. > > Best regards > Tomasz >
That is where the class has a default function to perform showList, and the instance Show Char where showList = specialized version. The MyShow class is similar, but does not work without all the extensions. I have class Show a => MyShow a where myShow = show. Then I have a specialized version for instance MyShow String where myShow = id. If I wrap everything in a data contructor I get more flexibility, but I don't yet see how (even with GADT) to simplify things. -- Chris _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe