#3700: Being instance of Monoid is not checked
----------------------------------------+-----------------------------------
    Reporter:  boris                    |       Owner:                
        Type:  bug                      |      Status:  new           
    Priority:  normal                   |   Milestone:                
   Component:  Compiler (Type checker)  |     Version:  6.10.3        
  Resolution:                           |    Keywords:  Monoid, Writer
          Os:  Windows                  |    Testcase:                
Architecture:  x86                      |     Failure:  Other         
----------------------------------------+-----------------------------------
Comment (by rwbarton):

 I don't think this is a bug.  GHCi should accept the first declaration
 because later (say in another module) someone might define an instance
 `Monoid ((a -> b) -> [a] -> [b])` and then want to call the function `f`.
 The second declaration is rejected due to the monomorphism restriction:
 since `f` is not defined via a function binding, GHCi must choose a
 monomorphic type for `f` immediately and it has no way to satisfy the
 `Monoid` instance.  If you turn off the monomorphism restriction by
 entering `:set -XNoMonomorphismRestriction`, you will find that both
 definitions are accepted.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3700#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to