Hi all,
I'm looking for a way to add my own wired-in package/module/type class for use in a core-to-core plugin.
My first challenge is to identify the type class that I want to find. I have the following code:
myPkgUnitId :: UnitId
myPkgUnitId = fsToUnitId (fsLit "mypackage")
mkMyModule :: FastString -> Module
mkMyModule m = mkModule myPkgUnitId (mkModuleNameFS m)
myModule :: Module
myModule = mkMyModule (fsLit "My.Module")
myClassName :: Name
myClassName = clsQual myModule (fsLit "MyClass") myClassKey
myClassKey :: Unique -- How do I get this?
Here the missing piece is the myClassKey. Looking at how this is done for, e.g., the Monad class:
monadClassKey :: Unique
monadClassKey = mkPreludeClassUnique 8
we see that it has a hard-coded unique identifier. Is there a way to do the same for my own type class? Or to somehow find the Unique key dynamically?
The second challenge is more or less the same in that I want to identify a member of MyClass:
myFunMName :: Name
myFunMName = varQual myModule (fsLit "myFun") myFunMClassOpKey
myFunMClassOpKey :: Unique -- How do I get this?
Again, the identifier is hard-coded for, e.g., ">>=".
Any insights will be much appreciated.
Best regards,
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.