On Sun, Apr 15, 2012 at 11:08, Jörg F. Wittenberger <
[email protected]> 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
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to