|
[ ghc-Bugs-1119221 ] Rebindable syntax doesn't work as advertised: msg#00027lang.haskell.glasgow.bugs
Bugs item #1119221, was opened at 2005-02-09 03:07 Message generated for change (Tracker Item Submitted) made by Item Submitter 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: Open Resolution: None 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) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1119221&group_id=8032
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [ ghc-Bugs-1078231 ] GHCi stdin buffering strange, SourceForge.net |
|---|---|
| Next by Date: | Compiler complains about duplicate instance declarations, Volker Wysk |
| Previous by Thread: | [ ghc-Bugs-1078231 ] GHCi stdin buffering strange, SourceForge.net |
| Next by Thread: | [ ghc-Bugs-1119221 ] Rebindable syntax doesn't work as advertised, SourceForge.net |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |