[commit: base] master: Warn about ArrowLoop instance for Kleisli Arrows (914703a)
Ross Paterson
ross at soi.city.ac.uk
Tue Oct 25 17:52:40 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/914703ab7bfa273b81649807d06189cbc01838ab
>---------------------------------------------------------------
commit 914703ab7bfa273b81649807d06189cbc01838ab
Author: Ross Paterson <ross at soi.city.ac.uk>
Date: Tue Oct 25 16:47:46 2011 +0100
Warn about ArrowLoop instance for Kleisli Arrows
Suggested by Heinrich Apfelmus on the libraries list.
>---------------------------------------------------------------
Control/Arrow.hs | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Control/Arrow.hs b/Control/Arrow.hs
index 012a75a..578c457 100644
--- a/Control/Arrow.hs
+++ b/Control/Arrow.hs
@@ -274,6 +274,9 @@ class Arrow a => ArrowLoop a where
instance ArrowLoop (->) where
loop f b = let (c,d) = f (b,d) in c
+-- | Beware that for many monads (those for which the '>>=' operation
+-- is strict) this instance will /not/ satisfy the right-tightening law
+-- required by the 'ArrowLoop' class.
instance MonadFix m => ArrowLoop (Kleisli m) where
loop (Kleisli f) = Kleisli (liftM fst . mfix . f')
where f' x y = f (x, snd y)
More information about the Cvs-libraries
mailing list