[Haskell-cafe] Expression problem in the database?
Manuel Gómez
targen at gmail.com
Tue Jul 23 15:09:44 CEST 2013
On Tue, Jul 23, 2013 at 7:41 AM, Torsten Grust
<torsten.grust at uni-tuebingen.de> wrote:
> Hi Manuel,
>
> On 22 Jul 2013, at 21:00, Manuel Gómez wrote (with possible deletions):
>> Hi café,
>>
>> I don’t know whether this is a good forum to ask about this —perhaps
>> Stack Overflow is better suited—, but since Haskell and related
>> languages are so finely fit for good solutions to the expression
>> problem, I figure this list may have a few helpful pointers regarding
>> this problem. [...]
>
> are you merely seeking for a relational encoding of Boolean expressions
> or do you plan to also operate on these expression (e.g., evaluate,
> simplify, normalize) inside the database?
Not inside the database, no. I need to encode conditions for
triggering actions in response to events when certain predicates are
satisfied over properties of the event and other related objects in
the database — but the rules would be manipulated and evaluated
outside the database in the code that processes such events
(specifically, in my situation, in response to requests to a REST
service implemented with Yesod).
The key issue is that terms in the expressions would refer to existing
database objects, so even though the evaluation would happen outside
the database, it’d be convenient to have referential integrity: if an
expression states something like «the request is an order for red
balloons or for a hot-wheels car, and the user who placed the order is
from France», I’d much prefer to get a foreign key constraint
violation error if the red balloons are removed from the database (or
perhaps just let the database cascade the deletion into the rule, or
whatever) than get an error at the time an order is placed and the
code outside the database attempts to evaluate a rule that refers to
some now nonexistent «red balloon» object.
Again, I realize this is all rather vague and only tangentially
related to the topic for this list — but I do imagine some here must
have run into this sort of issue.
More information about the Haskell-Cafe
mailing list