summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Paterson <ross@soi.city.ac.uk>2011-10-25 16:47:46 +0100
committerRoss Paterson <ross@soi.city.ac.uk>2011-10-25 16:47:46 +0100
commitcd6a715806f64b5ccb0cbcfb7ea00a19d4fff978 (patch)
tree89fcf0f772c858cc4a162ac4ddaa89dc819150dc
parentac3ddf2b3bcf586f626566d2eb30f03c561d6d7a (diff)
downloadhaskell-cd6a715806f64b5ccb0cbcfb7ea00a19d4fff978.tar.gz
Warn about ArrowLoop instance for Kleisli Arrows
Suggested by Heinrich Apfelmus on the libraries list.
-rw-r--r--libraries/base/Control/Arrow.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/libraries/base/Control/Arrow.hs b/libraries/base/Control/Arrow.hs
index 012a75a6fe..578c45778a 100644
--- a/libraries/base/Control/Arrow.hs
+++ b/libraries/base/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)