[web-devel] (Yesod) PersistEntity Key types

Rick Richardson rick.richardson at gmail.com
Sun Apr 3 15:45:37 CEST 2011

I think I have a simple solution.  I haven't looked at all of the places
that  *PersistKey is used, but it appears that we can simply make persistKey
a PersistValue, and get rid of the toPersistKey and fromPersistKey

I am only half-way through my coffee this morning, but it seems like this
could solve all of our problems.  Am I off in left field here?

On Sat, Apr 2, 2011 at 6:57 PM, Rick Richardson
<rick.richardson at gmail.com>wrote:

> I ran into another snag getting the tests running for MongoDB backend.  The
> PersistEntity class, and, it appears, the TH is hardcoded to set the key
> type as Int64.
> This is a problem since the key type in MongoDB is a 12 byte blob.
> The other problem is that it looks like PersistBackends are pretty much
> hardcoded to that type as well.  I guess the correct approach would be to
> allow the designation in mkPersist and then ensure that the PersistBackends
> can parametrically deal with differing  Key types.  Or, in the case of
> MongoDB, hardcode it to a 12 byte blob, because other key types (ObjectId's)
> rarely make sense.
> Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110403/fdc018e1/attachment.htm>

More information about the web-devel mailing list