X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=extra%2Fmonads%2Fmonads.factor;h=851e1ff0445cabb5e6eedee898750584ab3b5c4d;hp=485e5431605af1b6ab7c9724c969eed5972cbe1c;hb=HEAD;hpb=7c7bb93c55ce5dc4f6411c83ead3eea1fc726d3a diff --git a/extra/monads/monads.factor b/extra/monads/monads.factor index 485e543160..b42d5c6fed 100644 --- a/extra/monads/monads.factor +++ b/extra/monads/monads.factor @@ -1,8 +1,6 @@ ! Copyright (C) 2008 Slava Pestov -! See http://factorcode.org/license.txt for BSD license. -USING: arrays kernel sequences sequences.deep splitting -accessors fry locals combinators namespaces lists lists.lazy -shuffle ; +! See https://factorcode.org/license.txt for BSD license. +USING: accessors arrays kernel lists lists.lazy sequences ; IN: monads ! Functors @@ -188,7 +186,7 @@ M: writer-monad fail "Fail" throw ; : run-writer ( writer -- value log ) [ value>> ] [ log>> ] bi ; -M: writer >>= '[ [ _ run-writer ] dip '[ @ run-writer ] dip append ] ; +M: writer >>= '[ [ _ run-writer ] dip '[ @ run-writer ] dip prepend ] ; : pass ( writer -- writer' ) run-writer [ first2 ] dip swap call( x -- y ) ; : listen ( writer -- writer' ) run-writer [ 2array ] keep ;