[Haskell-cafe] GHC API: type class instance check

J. Stutterheim j.stutterheim at me.com
Fri Nov 11 09:55:13 UTC 2016


Yes, that's true, but suppose we have

	module M where

	import OtherModPossiblyWithInstance

Then as far as I understand, the compiler will have processed OtherModPossiblyWithInstance already and the existence of class instances in OtherModPossiblyWithInstance should be know.

> On 11 Nov 2016, at 10:07, MigMit <migmit at gmail.com> wrote:
> 
> I'm no expert in GHC plugins, but isn't it true that class instances can be added in other modules? So that this information is simply not available when compiling one?
> 
>> On 11 Nov 2016, at 08:57, J. Stutterheim <j.stutterheim at me.com> wrote:
>> 
>> Hi all,
>> 
>> I'm writing a core-to-core GHC plugin and have two questions:
>> 
>> - Given some t :: Type, how can I check whether there exists an instance of some type class C for t?
>> - How can I check whether some type class C exists, and if so, how can I get a value c (presumably :: Class) of this class?
>> 
>> Thanks!
>> 
>> - Jurriƫn_______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3117 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20161111/412c1e44/attachment.bin>


More information about the Haskell-Cafe mailing list