From 7b398a32ad0e56d07bbf1feb653e3eda123dc9b2 Mon Sep 17 00:00:00 2001 From: erkok Date: Tue, 1 Oct 2002 15:59:03 +0000 Subject: [PATCH] [project @ 2002-10-01 15:59:03 by erkok] MonadRec => MonadFix changes --- ghc/docs/users_guide/glasgow_exts.sgml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/ghc/docs/users_guide/glasgow_exts.sgml b/ghc/docs/users_guide/glasgow_exts.sgml index 6001ed9..d4a39be 100644 --- a/ghc/docs/users_guide/glasgow_exts.sgml +++ b/ghc/docs/users_guide/glasgow_exts.sgml @@ -2658,21 +2658,21 @@ As you can guess justOnes will evaluate to Just [1,1 -The MonadRec library introduces the MonadRec class. It's definition is: +The MonadFix library introduces the MonadFix class. It's definition is: -class Monad m => MonadRec m where +class Monad m => MonadFix m where mfix :: (a -> m a) -> m a The function mfix dictates how the required recursion operation should be performed. If recursive bindings are required for a monad, -then that monad must be declared an instance of the MonadRec class. +then that monad must be declared an instance of the MonadFix class. For details, see the above mentioned reference. -The MonadRec library automatically declares List, Maybe, IO, and -state monads (both lazy and strict) as instances of the MonadRec class. +The MonadFix library automatically declares List, Maybe, IO, and +state monads (both lazy and strict) as instances of the MonadFix class. There are three important points in using the recursive-do notation: @@ -2683,13 +2683,13 @@ than do). -If you want to declare an instance of the MonadRec class for one of -your own monads, or you need to refer to the class name MonadRec in any other way (for instance in -writing a type constraint), then your program should import Control.Monad.MonadRec. +If you want to declare an instance of the MonadFix class for one of +your own monads, or you need to refer to the class name MonadFix in any other way (for instance in +writing a type constraint), then your program should import Control.Monad.MonadFix. Otherwise, you don't need to import any special libraries to use the mdo-notation. That is, as long as you only use the predefined instances mentioned above, the mdo-notation will be automatically available. (Note: This differs from the Hugs implementation, where -MonadRec should always be imported.) +MonadFix should always be imported.) @@ -2698,6 +2698,13 @@ As with other extensions, ghc should be given the flag -fglasgow-exts + +Historical note: The originial implementation of the mdo-notation, and most +of the existing documents, use the names +MonadRec for the class, and +Control.Monad.MonadRec for the library. These names +are no longer supported. + The web page: http://www.cse.ogi.edu/PacSoft/projects/rmb -- 1.7.10.4