
I'm not sure whether you are saying (a) or (b): a) This is a compiler bug; even with -fno-monomorphism-restriction the module should compile. Are you sure? b) this is a feature request: you want a flag -fmonomorphism-restriction to restore the monomorphism restriction even if it's been turned off by an earlier flag? rsvp Simon | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users- | bounces@haskell.org] On Behalf Of Christian Maeder | Sent: 24 November 2004 13:44 | To: GHC Users Mailing List | Subject: -fno-monomorphism-restriction | | Hi, | | I've a file ATC/Sml_cats.hs that does not compile (see below) with the | flag -fno-monomorphism-restriction (ghc 6.2.2), whereas it compiles fine | without that option. Since I want to use -fno-monomorphism-restriction | for other files (from programatica) I've a problem, because there is no | option -fmonomorphism-restriction that I could place inside of | ATC/Sml_cats.hs. | | If someone wants to reproduce the error, do the following: | 1) check out HetCATS repository with: | cvs -d pserver:cvsread@cvs-agbkb.informatik.uni-bremen.de:/repository co | HetCATS | 2) comment out variable HC_PACKAGE in the Makefile (to avoid dependency | from uni) | 3) add the flag -fno-monomorphism-restriction to the variable HC_FLAGS | 4) call (GNU) make | | Cheers Christian | | Compiling ATC.Sml_cats ( ./ATC/Sml_cats.hs, ./ATC/Sml_cats.o ) | | ./ATC/Sml_cats.hs:23: | Ambiguous type variable `a' in the top-level constraint: | `ATermConvertibleSML a' | arising from use of `ad'' at ./ATC/Sml_cats.hs:2068 | | ./ATC/Sml_cats.hs:23: | Ambiguous type variable `a1' in the top-level constraint: | `ATermConvertibleSML a1' | arising from use of `aa'' at ./ATC/Sml_cats.hs:1501 | | ./ATC/Sml_cats.hs:23: | Ambiguous type variable `a2' in the top-level constraint: | `ATermConvertibleSML a2' | arising from use of `aa'' at ./ATC/Sml_cats.hs:1479 | | ./ATC/Sml_cats.hs:23: | Ambiguous type variable `a3' in the top-level constraint: | `ATermConvertibleSML a3' | arising from use of `las' at ./ATC/Sml_cats.hs:421 | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Simon Peyton-Jones wrote:
I'm not sure whether you are saying (a) or (b):
a) This is a compiler bug; even with -fno-monomorphism-restriction the module should compile. Are you sure?
b) this is a feature request: you want a flag -fmonomorphism-restriction to restore the monomorphism restriction even if it's been turned off by an earlier flag?
I'm saying a), but in case it's not a bug (for some unforeseen reason) I would ask for b) (or another work around). Christian

I wrote
| If someone wants to reproduce the error, do the following: | 1) check out HetCATS repository with: | cvs -d pserver:cvsread@cvs-agbkb.informatik.uni-bremen.de:/repository co | HetCATS | 2) comment out variable HC_PACKAGE in the Makefile (to avoid dependency | from uni) | 3) add the flag -fno-monomorphism-restriction to the variable HC_FLAGS | 4) call (GNU) make
I forgot to mention before step for 4): 3b) set the environment variable GHC_IMPORTS to the "imports" directory of your ghc installation, because DrIFT needs to find them. Christian

I've found a much shorter example (without imports) that does not compile. The error displayed is: Ambiguous type variable `a' in the top-level constraint: `ATermConvertibleSML a' arising from use of `las' at /home/maeder/haskell/examples/NoMonoRestr.hs:29 (comenting out the initial "OPTIONS" line, will make it go through) Cheers Christian

Christian Maeder wrote:
I've found a much shorter example (without imports) that does not compile.
and shorter: {-# OPTIONS -fno-monomorphism-restriction #-} module NoMonoRestr where data ATermTable = ATermTable data Annotation = Annotation data Annoted a = Annoted a [Annotation] toPair :: ATermConvertibleSML a => ATermTable -> (a,[Annotation]) toPair = undefined class ATermConvertibleSML t where from_sml_ShATerm :: ATermTable -> t instance (ATermConvertibleSML a) => ATermConvertibleSML (Annoted a) where from_sml_ShATerm att = let (bi,las) = toPair att in Annoted bi las
participants (2)
-
Christian Maeder
-
Simon Peyton-Jones