On Thu, Oct 27, 2011 at 7:04 AM, Evan Laforge <qdun...@gmail.com> wrote: >> No, this lists all the instances of a class. OP asked for the classes >> of which a given type is an instace. >> >> Presumably it is possible, since Haddock does it! In the >> documentation generated for a type it lists classes of which the type >> is an instance. So you might want to look at how Haddock does it. I >> suspect the only way is through the GHC API. > > ghci :info does it too. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe >
Generally looked into GHC's source, seems like the :info (line 850 of compiler/main/InteractiveEval.hs) is internal function. At last, GHC parsed the code, it sure knew the type info. -- 竹密岂妨流水过 山高哪阻野云飞 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe