RE: A couple of bugs



About this list Date view Thread view Subject view Author view

Wojciech Moczydlowski, Jr (khaliff@astercity.net)
Wed, 9 Aug 2000 13:26:44 +0200 (CEST)


On Tue, 8 Aug 2000, Malcolm Wallace wrote: > Wojciech Moczydlowski writes: > > > module MonadState where > > class (Monad m) => MonadState s m where > > get :: m s > > put :: s -> m () > > gives the error > > > In file ./MonadState.hs: > > -} but expected a {-EOF-} > > On my machine, I get > > > In file ./MonadState.hs: > > 3:33 Found m but expected a {-EOF-} > > which is slightly more informative. Multi-parameter type classes are > not Haskell'98, and are not supported by nhc98. I'd be interested > to know why your nhc98 did not produce the same error message as > mine though. Can you give some more details of the compiler version, [khaliff@localhost khaliff]$ nhc98 --version /usr/local/bin/nhc98: v1.0 pre-release 18 (date 000410) [ configured for ix86-Linux by khaliff@localhost on 25 Jul 2000 ] > what type of machine you are using, and the compiler that you used Intel, Celeron 333. > to build nhc98 with? ghc4.08. > Indeed, {-# -} is technically a legal comment, and nhc98 is wrong > to reject it. (However, {-# is the syntax for introducing a pragma > (see appendix E of the Haskell Report), and when used in this way > should be terminated with #-} which is why nhc98 rejected it.) The report says: Lexically, pragmas appear as comments, except that the enclosing syntax is {-# #-}. So, when a #-} is not found, it should be IMHO treated as a valid comment. Both ghc and hugs accept it. > > The third one - parser generated by happy fails with "Internal > > happy error". I'd rather not include the whole parser with this > > letter - the file size is 120KB. > > As far as I can tell, Happy is a ghc-specific tool. I have never > been able to get any Happy-generated parser to work with nhc98. Simon Marlow wrote me that this is not true - happy generates compiler-independent parsers. And my parser works with hugs without any trouble. > > module Main where > > import A > > f :: Either Int Int > > f = do > > Left 5 > > Right 5 > > > module A where > > instance Monad (Either a) where > > return v = Right v > > p >>= f = case p of > > Left a -> Left a > > Right a -> f a > > > Fail: The class Prelude.Monad has no instance for the type Prelude.Either. > > Possible sources for the problem are:7:9 > > This is a fairly obscure bug in the way nhc98 treats interface-files. > To avoid clutter, it tries to eliminate lots of redundant information > about the prelude which would otherwise appear in .hi files. > Unfortunately, in this case it has wrongly eliminated the only > definition in module A! You can work around this bug by forcing the > compiler to keep all prelude information in the .hi file: just give > the -prelude flag, e.g. > nhc98 -c -prelude A.hs Ok, but will this bug be fixed? > Malcolm Wojciech Moczydlowski, Jr


About this list Date view Thread view Subject view Author view