#836: rebindable if-then-else syntax
----------------------------------+-----------------------------------------
Reporter: nibro | Owner: SamAnklesaria
Type: feature request | Status: new
Priority: normal | Milestone: _|_
Component: Compiler (Parser) | Version: 6.13
Keywords: | Testcase: N/A
Blockedby: | Difficulty: Unknown
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
----------------------------------+-----------------------------------------
Comment(by batterseapower):
If you use rebindable syntax then GHC will use whatever (>>=) and return
operators are in scope at the site of the "do" notation. Those operators
do not necessarily have to be part of a typeclass -- you are free to give
them monomorphic types if you so wish.
{{{
{-# LANGUAGE NoImplicitPrelude #-}
import Prelude (fromInteger, print, error)
foo = let _ >>= _ = ">>="
_ >> _ = ">>"
return _ = "return"
fail = error
in (do { x <- return 1; return 3 }, do { return 3 }, do { return 1;
return 3 } )
main = print foo
}}}
Results in
{{{
(">>=","return",">>")
}}}
See the users guide at
http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/syntax-extns.html
#rebindable-syntax.
Simon is just arguing that the same principle should apply here.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/836#comment:17>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs