Bugs item #1119221, was opened at 2005-02-09 11:07
Message generated for change (Comment added) made by simonpj
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1119221&group_id=8032
Category: Compiler (Type checker)
Group: 6.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Rebindable syntax doesn't work as advertised
Initial Comment:
--
-- According to section 7.3.5. Rebindable syntax in the
user's manual
-- this should work (unless I totally misunderstood it).
-- It doesn't.
--
-- Compile with -fno-implicit-prelude
--
-- Lennart
--
import Prelude hiding(Monad(..))
class B a where
b :: a
instance B Bool where
b = False
class M m where
return :: a -> m a
(>>=) :: (B a) => m a -> (a -> m b) -> m b
(>>) :: (B a) => m a -> m b -> m b
fail :: String -> m a
p >> q = p >>= \ _ -> q
fail s = error s
instance M Maybe where
return x = Just x
(>>=) = error "bind"
test :: Maybe Bool
test = do
x <- return True
return (x && x)
unJust (Just x) = x
main = print (unJust test)
----------------------------------------------------------------------
>Comment By: Simon Peyton Jones (simonpj)
Date: 2005-04-04 12:10
Message:
Logged In: YES
user_id=50165
Fixed for do-notation
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2005-02-10 18:55
Message:
Logged In: NO
My motivation is identical to Amr's. I was trying out his
quantum computation stuff, and then you need an additional
constraint on the bind operation in the monad. So I tried
using my own monad definition, but it failed.
It's not really a big deal, but if it's reasonably easy to
fix...
----------------------------------------------------------------------
Comment By: Simon Peyton Jones (simonpj)
Date: 2005-02-10 16:50
Message:
Logged In: YES
user_id=50165
This is a bug, and I plan to fix it.
To date I only knew of a couple of people who cared (Amr
Sabry, Arthur van Leeuwen, perhpas Ashley Yakely). This
makes one more. Can you say a bit more about why it'd be
useful to you. To help motivate me...
This won't be in 6.4, but I will do it, esp if more people yell.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2005-02-10 16:45
Message:
Logged In: NO
You're not alone:
http://www.haskell.org/pipermail/haskell/2005-January/015113.html
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2005-02-10 16:41
Message:
Logged In: NO
I would much prefer if the implementation had changed to
match the documentation. :)
-- Lennart
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2005-02-10 16:24
Message:
Logged In: NO
The documentation was wrong - it now says that >>= etc have
to be polymorphic.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1119221&group_id=8032
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs