rwbarton@morphism:/tmp$ ghci-7.10.1 -XMonomorphismRestrictionGHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for helpPrelude> let a = (+)Prelude> :t aa :: Num a => a -> a -> a
with
rwbarton@morphism:/tmp$ ghci-7.10.1 GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for helpPrelude> :set -XMonomorphismRestrictionPrelude> let a = (+)Prelude> :t aa :: Integer -> Integer -> Integer
Confusing!
This also occurred in 7.8.
Trac metadata
Trac field
Value
Version
7.10.1
Type
Bug
TypeOfFailure
OtherFailure
Priority
normal
Resolution
Unresolved
Component
GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
ghci -XNoExtendedDefaultRules does't turn off ExtendedDefaultRules either:
Prelude> :showi languagebase language is: Haskell2010with the following modifiers: -XNoDatatypeContexts -XExtendedDefaultRules -XNoMonomorphismRestriction -XNondecreasingIndentation
Hey, I looked into this and it turns out it's actually not that easy to move it to an earlier point because those options should be in the interactive DynFlags which we set only after we have overwritten the DynFlags using the command line arguments.
Now there is an easy solution which consists of just putting it in the standard DynFlags instead of the interactive ones. In fact we already do this for another flag. This works just fine but obviously some tests fail now since it is now not limited to the interactive flags.
The other option is to set all of the interactive DynFlags earlier, but it looks like we then need to have two different set of flags, modify both of them by the command line arguments and then set them. This does not seem like a very nice solution either.
If you are okay with putting it not in the interactive dynflags, then that's definitely the easiest solution, but as I am not really happy with that myself I'll think about it a bit more and try to come up with a less hacky solution.
Which tests fail if you add -XNoMonomorphismRestriction to the standard DynFlags?
You linked to -fimplicit-import-qualified being added to the standard DynFlags. I see there is a TODO (XXX) there, so it looks like this is considered to be a bug. But I'm having trouble coming with an example that would trigger the bug, can you? I tried the following, expecting it to be erroneously accepted by GHCi (when running ghci Test.hs), but it isn't:
Test.hs:
main = print $ Data.List.foldl' (+) 0 [1,2,3]
This fails with error: Not in scope: ‘Data.List.foldl'’. So now I don't understand the difference between the standard DynFlags and the interactive DynFlags.
make TEST="dynbrk002 break021 break012 print012 break020 ghci057 T9293 ghci024 ghci058"
and here's the output. One reason for the failure is that :show language shows the extensions whereas atm only :showi language shows them. The other failures seem to be related to the ghci debugger printing some type signatures differently which is probably related to -XExtendedDefaultRules and-XNoMonomorphismRestriction now appearing outside of the interactive session flags as well. Apart from the debugger case I feel like it's mostly a semantic distinction.
Your code doesn't fail because the hack only adds -fimplicit-import-qualified to the DynFlags if load mode is DoInteractive or DoEval. I haven't managed to come up with anything that triggers the bug.
Your code doesn't fail because the hack only adds -fimplicit-import-qualified to the DynFlags if load mode is DoInteractive or DoEval.
But when I run ghci, isn't the load mode always DoInteractive? So shouldn't -fimplicit-import-qualified also apply to modules loaded into GHCi, as in my example? I guess it doesn't, but I don't understand why not.