[Haskell] Data.Generics question

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Mon Nov 28 10:33:05 EST 2005


Dear all, in Data.Generics.Text
http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/base/Data/Generics/Text.hs?rev=1.10
I find this nice example

gshow = ( \t ->
                "("
             ++ showConstr (toConstr t)
             ++ concat (gmapQ ((++) " " . gshow) t)
             ++ ")"
        ) `extQ` (show :: String -> String)

but I couldn't figure out how to use this
to declare a useful show instance. I would need something like

       `extQ` (show :: Show a => a -> String )

i. e. use Show instance if available, or

       `extQ` ( lshow :: [ a ] -> String )

i. e. use another function if argument type is a list type


BTW: I guess the above is related to
http://homepages.cwi.nl/~ralf/syb3/
Do the current (6.4) ghc compiler/libraries
correspond to what's in that paper?
-- 
-- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 --
---- http://www.imn.htwk-leipzig.de/~waldmann/ -------




More information about the Haskell mailing list