[project @ 2000-12-08 09:45:41 by simonpj]
authorsimonpj <unknown>
Fri, 8 Dec 2000 09:45:42 +0000 (09:45 +0000)
committersimonpj <unknown>
Fri, 8 Dec 2000 09:45:42 +0000 (09:45 +0000)
Add -fno-monomorphism-restriction

ghc/compiler/main/CmdLineOpts.lhs
ghc/compiler/typecheck/TcBinds.lhs

index 335e8a9..cf5fdeb 100644 (file)
@@ -51,6 +51,7 @@ module CmdLineOpts (
        opt_NumbersStrict,
        opt_Parallel,
        opt_SMP,
+       opt_NoMonomorphismRestriction,
 
        -- optimisation opts
        opt_DoSemiTagging,
@@ -405,6 +406,7 @@ opt_DoTickyProfiling                = lookUp  SLIT("-fticky-ticky")
 
 -- language opts
 opt_AllStrict                  = lookUp  SLIT("-fall-strict")
+opt_NoMonomorphismRestriction  = lookUp  SLIT("-fno-monomorphism-restriction")
 opt_DictsStrict                        = lookUp  SLIT("-fdicts-strict")
 opt_IrrefutableTuples          = lookUp  SLIT("-firrefutable-tuples")
 opt_MaxContextReductionDepth   = lookup_def_int "-fcontext-stack" mAX_CONTEXT_REDUCTION_DEPTH
index 9c2401e..3613f57 100644 (file)
@@ -12,6 +12,7 @@ module TcBinds ( tcBindsAndThen, tcTopBinds,
 import {-# SOURCE #-} TcMatches ( tcGRHSs, tcMatchesFun )
 import {-# SOURCE #-} TcExpr  ( tcExpr )
 
+import CmdLineOpts     ( opt_NoMonomorphismRestriction )
 import HsSyn           ( HsExpr(..), HsBinds(..), MonoBinds(..), Sig(..), StmtCtxt(..),
                          Match(..), collectMonoBinders, andMonoBinds
                        )
@@ -428,7 +429,8 @@ tcBindWithSigs top_lvl mbind tc_ty_sigs inline_sigs is_rec
     )
   where
     tysig_names     = [name | (TySigInfo name _ _ _ _ _ _ _) <- tc_ty_sigs]
-    is_unrestricted = isUnRestrictedGroup tysig_names mbind
+    is_unrestricted | opt_NoMonomorphismRestriction = True
+                   | otherwise                     = isUnRestrictedGroup tysig_names mbind
 
 justPatBindings bind@(PatMonoBind _ _ _) binds = bind `andMonoBinds` binds
 justPatBindings (AndMonoBinds b1 b2) binds =