[GHC] #3202: Make XNoMonomorphismRestriction the default in GHCi

GHC trac at galois.com
Wed Apr 29 07:31:38 EDT 2009


#3202: Make XNoMonomorphismRestriction the default in GHCi
-----------------------------+----------------------------------------------
Reporter:  YitzGale          |          Owner:                  
    Type:  feature request   |         Status:  new             
Priority:  normal            |      Component:  GHCi            
 Version:  6.10.2            |       Severity:  normal          
Keywords:                    |       Testcase:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-----------------------------+----------------------------------------------
 While it has been a subject of debate whether the
 Monomorphism Restriction is helpful in compiled code,
 it is quite clear that MR is a major annoyance,
 if not a bug, at the GHCi prompt.

 MR at the GHCi prompt makes it inconvenient
 to define functions using {{{let}}} at the prompt. It also
 unexpectedly assigns monomorphic types to
 expressions entered interactively by the user -
 in particular when it types numeric constants
 as {{{Integer}}} when the user needs an {{{Int}}}.

 None of the purported benefits of MR are relevant
 in GHCi. The kinds of problems that MR might help
 avoid are unlikely to arise during an interactive
 session, since the structure of functions entered
 at the prompt is on average far less complex than
 functions in source files. Any problems that do
 arise will become clear as the interactive session
 continues - likely with a clearer error message
 (in my personal experience).

 MR at the GHCi prompt is one of the most
 confusing aspects of GHCi for inexperienced
 users, as evidenced by constant traffic on
 haskell-cafe and #haskell.

 Disabling MR at the GHCi prompt would
 not be a disruptive change. It would not
 change the meaning of any program.
 It would improve the GHCi workflow of
 inexperienced users, and probably most
 experienced users. If there are any
 experienced users who feel that this
 change disrupts their workflow, they can
 easily revert to the current behavior
 by adding a single line to their {{{.ghci}}}
 file.

 For reference, here is a long discussion about MR
 that took place on haskell-cafe a few years ago:

 http://www.haskell.org/pipermail/haskell-prime/2006-January/000038.html

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3202>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list