Add a comment explaining AReturn

This commit is contained in:
Michael Walker 2017-09-26 00:25:41 +01:00
parent eaa50d11b2
commit 2e5f79a2c4

View File

@ -41,6 +41,8 @@ instance Functor (M n r) where
fmap f m = M $ \ c -> runM m (c . f)
instance Applicative (M n r) where
-- without the @AReturn@, a thread could lock up testing by
-- entering an infinite loop (eg: @forever (return ())@)
pure x = M $ \c -> AReturn $ c x
f <*> v = M $ \c -> runM f (\g -> runM v (c . g))