[Haskell-cafe] Deriving class instances using DrIFT

Daniel McAllansmith dm.maillists at gmail.com
Mon Oct 30 13:46:05 EST 2006


On Monday 30 October 2006 22:18, Einar Karttunen wrote:
> On 29.10 19:56, John Meacham wrote:
> > Since DrIFT can only understand haskell source code, it can't derive
> > instances for anything you don't have the original source to. 

Ahhh, ok.

> > such as 
> > things in the pre-compiled libraries that come with ghc. you will likely
> > have to write out those instances by hand.

Hmmm, seems strange that it can successfully derive for the Data.Maybe type 
but not the Data.Word32 type.  I didn't think it would have access to any 
original source from my ghc install, there only seems to be hi files.

> >
> > Another possibility is that you could replicate just the data
> > declarations by hand, and use DrIFT -r to just spit out the derivations
> > and put those in a file on their own.
>
> How about using Template Haskell for getting the definition and then
> giving that to DrIFT?


Thanks for the suggestions.
Daniel


More information about the Haskell-Cafe mailing list