[ ghc-Bugs-508117 ] -fno-monomorphism-restriction != dynamic
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 25 Jan 2002 02:33:55 -0800
Bugs item #508117, was opened at 2002-01-24 12:10
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=108032&aid=508117&group_id=8032
>Category: Compiler
Group: 5.02
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Mike Gunter (magunter)
>Assigned to: Simon Marlow (simonmar)
Summary: -fno-monomorphism-restriction != dynamic
Initial Comment:
Section 4.18 claims -fno-monomorphism-restriction is
dynamic. ":set"ting it in GHCi seems to have no
affect:
Loading:
> i = 1
> y = (1::Int) + i
> x = 1.1 + i
> main = error "main"
with -fno-monomorphism-restriction :set (but not set
on the command line) gives:
Prelude> fmap (filter (==
"-fno-monomorphism-restriction")) System.getArgs >>= print
[]
Prelude> :set -fno-monomorphism-restriction
Prelude> Compiling Main (
/home/gunter/haskell/TestMonomorphism.hs, interpreted )
/home/gunter/haskell/TestMonomorphism.hs:3:
No instance for (Fractional Int)
arising from the literal `1.1' at
/home/gunter/haskell/TestMonomorphism.hs:3
In the first argument of `(+)', namely `1.1'
In the definition of `x': 1.1 + i
Failed, modules loaded: none.
Prelude>
whereas with -fno-monomorphism-restriction set on
the command line gives the expected result:
Prelude> Compiling Main (
/home/gunter/haskell/TestMonomorphism.hs, interpreted )
Ok, modules loaded: Main.
Main> fmap (filter (==
"-fno-monomorphism-restriction")) System.getArgs >>= print
["-fno-monomorphism-restriction"]
Main> x
2.1
Main> y
2
It would be better to make
-fno-monomorphism-restriction dynamic but at least
the documentation should be fixed.
thanks,
mike
----------------------------------------------------------------------
>Comment By: Simon Marlow (simonmar)
Date: 2002-01-25 02:33
Message:
Logged In: YES
user_id=48280
Thanks, I've made the flag dynamic.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=108032&aid=508117&group_id=8032