Fix state-transformer:modify-and-return

The method was returning a single value, rather than the necessary tuple
required for binding to work.
This commit is contained in:
Correl Roush 2014-07-09 01:33:45 -04:00
parent d399492679
commit 76ffe600ef

View file

@ -1,5 +1,4 @@
(defmodule state-transformer (defmodule state-transformer
(behaviour monad)
(export all)) (export all))
(include-lib "include/monads.lfe") (include-lib "include/monads.lfe")
@ -38,7 +37,8 @@
(defun modify-and-return (defun modify-and-return
((f (tuple 'state-transformer inner-monad)) ((f (tuple 'state-transformer inner-monad))
(lambda (s) (lambda (s)
(call inner-monad 'return (funcall f s))))) (let ((newstate (call inner-monad 'return (funcall f s))))
(tuple newstate newstate)))))
(defun eval (defun eval
((m s (tuple 'state-transformer inner-monad)) ((m s (tuple 'state-transformer inner-monad))