Data.Generics question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Data.Generics question

Johannes Waldmann
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/ -------


_______________________________________________
Haskell mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell