Re: [Haskell-cafe] Practical Haskell question.

2007-07-22 Thread Josef Svenningsson
Michael, I think what you're trying to do is perfectly doable in Haskell and I think the right tool for it is arrows, as Tomasz Zielonka mentioned before. I suggest you take a look at the following paper which uses arrows to enforce security levels in the code: http://www.cis.upenn.edu/~stevez/pa

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Arie Peterson
I wrote: > If you want to stick to monads, there is another possibility: carry around > the necessary checks *at the type level*. Below is a sketch of how you > could do this. Importantly, the given code still requires you to specify the checks "by hand", when running the action; it only checks t

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Arie Peterson
As others have explained, you can't analyse your do-constructs, because functions are opaque -- at the value level. The canonical option would indeed seem to be to use arrows (or applicative functors), instead of monads. -- If you want to stick to monads, there is another possibility: carry

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Jon Cast
On Monday 25 June 2007, Michael T. Richter wrote: > On Mon, 2007-25-06 at 01:05 -0500, Jon Cast wrote: > > What exactly are you trying to do? > > I'm trying to model a transactional system which could fail > mid-transaction without an easy rollback on conditions which could be > checked in advance.

Re[2]: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Bulat Ziganshin
Hello Michael, Monday, June 25, 2007, 2:10:28 PM, you wrote: > Does this make more sense now? And can it be done somehow in Haskell? runCheckedCode = checkBeforeRun [actionA x y, actionB z t, actionC] actionA x y b | b = -- check conditions | otherwise = -- perform action

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Michael T. Richter
On Mon, 2007-25-06 at 12:19 +0300, Benja Fallenstein wrote: > 2007/6/25, Michael T. Richter <[EMAIL PROTECTED]>: > > OK, just to prevent this getting side-tracked: I'm absolutely > uninterested in the results of performActionA before > determining if performActionB is perm

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Claus Reinke
Now I've got a situation I can't figure out how to resolve. I want to have a set of actions which are executed sequentially, but which, before I even start to execute the first one, have been inspected for legality and/or plausibility. Consider this kind of sequence: do x <- performActionA y

RE: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Henning Thielemann
On Mon, 25 Jun 2007, Michael T. Richter wrote: > OK, just to prevent this getting side-tracked: I'm absolutely > uninterested in the results of performActionA before determining if > performActionB is permitted/possible/whatever. Think more in terms of > security permissions or resource availabi

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Dan Mead
Micheal, I think you mean do x <- if .. then .. else .. y <- if ... then.. else... etc etc On 6/25/07, Michael T. Richter <[EMAIL PROTECTED]> wrote: Now I've got a situation I can't figure out how to resolve. I want to have a set of actions which are executed sequentially,

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Tomasz Zielonka
On Mon, Jun 25, 2007 at 10:58:16AM +0200, Henning Thielemann wrote: > > On Mon, 25 Jun 2007, Tomasz Zielonka wrote: > > > On Mon, Jun 25, 2007 at 10:29:14AM +0200, Henning Thielemann wrote: > > > Imagine all performActions contain their checks somehow. Let > > > performActionB take an argument. >

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Benja Fallenstein
2007/6/25, Michael T. Richter <[EMAIL PROTECTED]>: OK, just to prevent this getting side-tracked: I'm absolutely uninterested in the results of performActionA before determining if performActionB is permitted/possible/whatever. Think more in terms of security permissions or resource availabili

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Pepe Iborra
nt: Monday, June 25, 2007 10:43 AM To: Henning Thielemann Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Practical Haskell question. On Mon, Jun 25, 2007 at 10:29:14AM +0200, Henning Thielemann wrote: Imagine all performActions contain their checks somehow. Let performActionB take a

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Wouter Swierstra
Hi Michael, On 25 Jun 2007, at 06:39, Michael T. Richter wrote: do x <- performActionA y <- performActionB z <- performActionC return $ calculateStuff x y z I don't know about you're exact example, but here's what I'd do. Control.Monad has functions like when, unless, and guard that

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Henning Thielemann
On Mon, 25 Jun 2007, Tomasz Zielonka wrote: > On Mon, Jun 25, 2007 at 10:29:14AM +0200, Henning Thielemann wrote: > > Imagine all performActions contain their checks somehow. Let > > performActionB take an argument. > > > > > do > > >x <- performActionA > > >y <- performActionB x > > >

RE: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Michael T. Richter
> Sent: Monday, June 25, 2007 10:43 AM > To: Henning Thielemann > Cc: haskell-cafe@haskell.org > Subject: Re: [Haskell-cafe] Practical Haskell question. > > On Mon, Jun 25, 2007 at 10:29:14AM +0200, Henning Thielemann wrote: > > Imagine all performActions contain their checks s

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Benja Fallenstein
Hi Peter, 2007/6/25, peterv <[EMAIL PROTECTED]>: I'm baffled. So using the Arrow abstraction (which I don't know yet) would solve this problem? How can (perfectActionB x) be checked with without ever executing performActionA which evaluates to x? This can only be done when x is a constant expres

RE: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread peterv
om: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tomasz Zielonka Sent: Monday, June 25, 2007 10:43 AM To: Henning Thielemann Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Practical Haskell question. On Mon, Jun 25, 2007 at 10:29:14AM +0200, Henning Thielemann wrote: >

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Tomasz Zielonka
On Mon, Jun 25, 2007 at 10:29:14AM +0200, Henning Thielemann wrote: > Imagine all performActions contain their checks somehow. Let > performActionB take an argument. > > > do > >x <- performActionA > >y <- performActionB x > >z <- performActionC > >return $ calculateStuff x y z >

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Henning Thielemann
On Mon, 25 Jun 2007, Daniil Elovkov wrote: > 2007/6/25, Michael T. Richter <[EMAIL PROTECTED]>: > > > > Now I've got a situation I can't figure out how to resolve. I want to > > have a set of actions which are executed sequentially, but which, before I > > even start to execute the first one,

Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Daniil Elovkov
2007/6/25, Michael T. Richter <[EMAIL PROTECTED]>: Now I've got a situation I can't figure out how to resolve. I want to have a set of actions which are executed sequentially, but which, before I even start to execute the first one, have been inspected for legality and/or plausibility. Con

[Haskell-cafe] Practical Haskell question.

2007-06-24 Thread Michael T. Richter
Now I've got a situation I can't figure out how to resolve. I want to have a set of actions which are executed sequentially, but which, before I even start to execute the first one, have been inspected for legality and/or plausibility. Consider this kind of sequence: do x <- performActionA y