[nhc-bugs] Error importing Control.Monad (liftM2) with newtype

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Mon Apr 11 10:27:27 EDT 2005


Ian Lynagh <igloo at earth.li> writes:

> This happens with both nhc98 1.16 and 1.18:
> 
> $ cat Q.hs
> module Q () where
> import Control.Monad (liftM2)
> newtype A a = A a
> 
> $ nhc98 -c Q.hs
> nhc98comp: isRealData InfoClass 1 Prelude.Monad IEnone \/ b . (1 b)
> [38,39,40,41] [] [(5,([],[])),(25,([],[])),(26,([],[]))]

Good bug report.  Tricky thing to find, but I tracked it down after
a while using Hat.  Patch attached.

Regards,
    Malcolm
-------------- next part --------------
Index: src/compiler98/RenameLib.hs
===================================================================
RCS file: /home/cvs/root/nhc98/src/compiler98/RenameLib.hs,v
retrieving revision 1.31
diff -u -r1.31 RenameLib.hs
--- src/compiler98/RenameLib.hs	22 Dec 2004 12:58:35 -0000	1.31
+++ src/compiler98/RenameLib.hs	11 Apr 2005 14:24:49 -0000
@@ -216,7 +216,7 @@
 	      (coni:_) ->
 		 case (ntI . dropJust . lookupAT st ) coni of
   	           (NewType _ [] _ [NTcons c _ _,res]) -> (synType,(u,c):newType)
-  	           (NewType _ [] _ [NTvar v _,res]) -> (synType,(u,v):newType)
+  	           (NewType _ [] _ [NTvar v _,res]) -> (synType,      newType)
   	           (NewType _ [] _ [NTapp v1 v2,res]) -> (synType,newType)
 			-- ^ MW hack: omits potential circularity check!
   	           (NewType _ [] _ (_:_:_)) ->


More information about the Nhc-bugs mailing list