
6 Jun
2007
6 Jun
'07
5:39 a.m.
Monad class contains declaration *fail* :: String -> m a and provides default implementation for 'fail' as: fail s = error s On the other hand Prelude defines: * error* :: String -> a which stops execution and displays an error message. Questions: 1) What value and type 'error' actually returns in: error "some message" ? 2) How declaration String -> m a matches with String -> a ? 3) In Maybe monad: fail = Nothing When and how 'fail' is used in Maybe monad? Thanks! -- Dmitri O. Kondratiev dokondr@gmail.com http://www.geocities.com/dkondr