* Monad code changes
@ 2015-01-14 20:59 Ludovic Courtès
2015-01-17 22:56 ` Ludovic Courtès
0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2015-01-14 20:59 UTC (permalink / raw
To: Guix-devel
Commit e87f059 moved monadic procedures “where they belong”–essentially
grouping them by abstraction layer rather than by programming style,
which meant everything in (guix monads).
This has then allowed the conversion of the code to download the package
source (the ‘method’ field of ‘origin’) to use monadic style, in commit
f220a83.
So the API is slowly but surely converging to a unified style. The last
step will be to convert build systems to monads + gexps, hopefully in
the next ‘core-updates’ because that will require rebuilds.
Ludo’.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Monad code changes
2015-01-14 20:59 Monad code changes Ludovic Courtès
@ 2015-01-17 22:56 ` Ludovic Courtès
0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2015-01-17 22:56 UTC (permalink / raw
To: Guix-devel
Commit 81a9773 introduces a generic state monad in (guix monads), and
the next commit makes ‘%store-monad’ an alias for ‘%state-monad’.
The nice thing is that ‘%state-monad’ remains low-overhead thanks to the
macro tricks¹ and the use of multiple-value returns to thread the state
across monadic procedure calls:
--8<---------------cut here---------------start------------->8---
scheme@(guix monads)> ,optimize (mlet* %state-monad ((x (set-current-state 0))
(y (set-current-state 1))
(p (set-current-state 2))
(z (return (+ y p))))
(return z))
$14 = (lambda (state) (values 1 2))
--8<---------------cut here---------------end--------------->8---
Feedback welcome!
Ludo’.
¹ http://lists.gnu.org/archive/html/guix-devel/2013-10/msg00034.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-17 22:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-14 20:59 Monad code changes Ludovic Courtès
2015-01-17 22:56 ` Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.