[Haskell-cafe] Syntax of 'do'
Bulat Ziganshin
bulat.ziganshin at gmail.com
Fri Aug 29 10:21:17 EDT 2008
Hello Mauricio,
Friday, August 29, 2008, 5:41:41 PM, you wrote:
afaik, this shorthand isn't exact. actually there is more code dealing
with fails and this code use Monad operations
> Hi,
> http://haskell.org/haskellwiki/Keywords says that:
> -------------
> [do is a] syntactic sugar for use with monadic
> expressions. For example:
> do { x ; result <- y ; foo result }
> is shorthand for:
> x >> y >>= \result -> foo result
> -------------
> I did some tests hiding Prelude.>> and Prelude.>>=
and applying >>> and >>= to non-monadic types, and
> saw that 'do' would not apply to them. So, I would
> like to add the following to that text:
> -------------
> as long as proper types apply:
> x :: Prelude.Monad a
> y :: Prelude.Monad b
foo :: b ->> Prelude.Monad c
> -------------
> Is that correct (Haskell and English)?
> Thanks,
> Mauricio
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list