chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] [ANN] Monad Egg


From: Daniel Leslie
Subject: Re: [Chicken-users] [ANN] Monad Egg
Date: Sun, 15 Apr 2012 13:01:23 -0700

On Sun, Apr 15, 2012 at 11:08, Jörg F. Wittenberger <address@hidden> wrote:
With a single "a" as internal state is seems not to matter
much.  Except for the visual elegance of NOT swapping
the "f" and "a" letters within the hopelessly useful
identity monad definition.

However if the implementation was able to pass multiple
values as internal state, I'd prefer to always know the
first argument to be the "f" parameter followed by
N parameters of internal state than the other way around.

Freehanding fictionally rewriting the logger here:

(define-monad <logger>
 (lambda (p v)     (fprintf p "Starting with: ~S\n" v)
   (values p v)))
 (lambda (f p v)
  (let ((r (f v)))
    (fprintf p "Calling (~S ~S) returned ~S\n" f v r)
    (values p r))))

Does this help?

Seems reasonable to me. And the order of parameters for the bind definition doesn't necessarily enforce the order of parameters for the >>= definition. We could have our cake and eat it too, as it were.

I won't have time today to look at this further, but I'll toss around some alterations tomorrow and see what comes of it.

-Dan
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]