[web-devel] Data and Typeable

Michael Snoyman michael at snoyman.com
Sat Apr 9 22:23:19 CEST 2011


On Sat, Apr 9, 2011 at 11:16 PM, Clint Moore <clint at ivy.io> wrote:

>
>
> On Sat, Apr 9, 2011 at 12:13 PM, Michael Snoyman <michael at snoyman.com>wrote:
>
>>
>> I definitely don't want to deal with cabal flags for this, it would mean
>> that some packages wouldn't install on your system depending on how you
>> build Persistent. For your case, it might be acceptable to just use
>> standalone deriving declarations, ie:
>>
>> deriving instance Data SpeciesId
>> deriving instance Data Animal
>> ...
>>
>
>   I read the user's guide on how this works, but I think there might be
> something going on with the quasiquoter that is preventing it from working.
>  Or, more probable, I'm doing it wrong.
>
> {-# LANGUAGE StandaloneDeriving #-}
> Species
>  name String Eq
>  deriving Data Typeable
>
> Animal
>  species SpeciesId Eq
>  name String Eq
>  deriving Data Typeable
>  deriving instance Data SpeciesId
>
> Any combination that I've tried of 'deriving instance' throws an illegal
> type constructor error.  Do you happen to have an example of this?
>
>
This is most likely due to GHC stage restrictions. Try removing any mention
of Data and Typeable from the entity declaration, and then just using
"deriving instance..." code after the call to mkPersist.

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110409/cc5d8863/attachment-0001.htm>


More information about the web-devel mailing list