[Haskell-cafe] Fwd: extending Do notation

Miguel Mitrofanov miguelimo38 at yandex.ru
Tue May 20 17:45:04 UTC 2014


Forgot to reply the list

-------- Пересылаемое сообщение  --------
20.05.2014, 18:26, "Miguel Mitrofanov" <miguelimo38 at yandex.ru>:

20.05.2014, 18:14, "Kim-Ee Yeoh" <ky3 at atamo.com>:

>>  2) you can't use >>= in an if condition
>  Could you give an example of the if condition you want an >>= in?

Actually, something like

do ...
    if <- checkCondition
      then doReportSuccess
      else doReportFailure

as well as

do ...
    case <- generateResult of
      Nothing -> ...
      Just r -> ...

instead of

do ...
    b <- checkCondition
    if b ...

and

do ...
    r <- generateResult
    case r of ...

would be very nice.
-------- Завершение пересылаемого сообщения --------


More information about the Haskell-Cafe mailing list