[web-devel] [Yesod][Persist] Like keyword

Michael Snoyman michael at snoyman.com
Wed Dec 22 06:18:30 CET 2010

True, it *would* be better, but it can't fit in with the way
persistent works (AFAICT). Let's say that we're dealing with a
persistent entity:

    name String Eq Like
    age Int

I now have a PersonNameLike constructor, *regardless of backend*. I
don't really think that throwing an exception will be necessary,
however: most likely, backends like redis can just implement this
functionality in Haskell itself. Performance won't be great, but those
are things you'll need to be aware of.

I suppose another possibility would be to allow some kind of generic
"add to query" and then you could write whatever kind of where clause
you want.


2010/12/22 Max Cantor <mxcantor at gmail.com>:
> Perhaps instead of throwing an exception, you add a typeclass PersistBackendLikeQuery or something where only backends that can handle like queries provide that typeclass.  seems better and much more haskellish than tossing an exception.
> Max
> On Dec 21, 2010, at 6:43 PM, Michael Snoyman wrote:
>> I've also wanted this at times. I'm a little wary of including it,
>> since it is very SQL-specific. On the other hand, it might be
>> reasonable to allow it in, and then non-SQL backends can either ignore
>> it, throw an exception, or try to implement it somehow. Does anyone
>> have any thoughts on this?
>> Michael
>> 2010/12/21 いとうかつとし <cutsea110 at gmail.com>:
>>> Hi
>>> continuously another request...
>>> I'd like to write "Like" keyword for using as Filter.
>>> this isn't supported yet, is this?
>>> _______________________________________________
>>> web-devel mailing list
>>> web-devel at haskell.org
>>> http://www.haskell.org/mailman/listinfo/web-devel
>> _______________________________________________
>> web-devel mailing list
>> web-devel at haskell.org
>> http://www.haskell.org/mailman/listinfo/web-devel

More information about the web-devel mailing list