#4940: Bad error message using poly pat bind with MonoPatBinds
------------------------------------------------+---------------------------
  Reporter:  batterseapower                     |          Owner:               
   
      Type:  feature request                    |         Status:  new          
   
  Priority:  normal                             |      Milestone:  7.2.1        
   
 Component:  Compiler (Type checker)            |        Version:  7.0.1        
   
Resolution:                                     |       Keywords:               
   
  Testcase:                                     |      Blockedby:               
   
Difficulty:                                     |             Os:  
Unknown/Multiple
  Blocking:                                     |   Architecture:  
Unknown/Multiple
   Failure:  Incorrect warning at compile-time  |  
------------------------------------------------+---------------------------
Changes (by MartijnVanSteenbergen):

 * cc: martijn@… (added)


Comment:

 I was going to report something similar but found this bug here, so will
 add myself to CC. The error message in GHC 7.0.3 is still cryptic; it took
 a while to figure out what the problem and the solution were. I found bug
 2187 which has a longer discussion and has a broken link to the Haskell'
 page on this issue; the new link is http://hackage.haskell.org/trac
 /haskell-prime/wiki/MonomorphicPatternBindings

 My use case for -XNoMonoPatBinds is this:

 Like yallop in bug 2187, I am using TH to derive tuples with polymorphic
 elements. The size of the tuple returned is equal to the number of
 constructors in the datastructure the functionality is derived for. I'm
 not a big fan of TH functions generating and introducing names into the
 top-level scope because it breaks modularity. Top-level pattern bindings
 are a very attractive solution: they allow me to give the user full
 control over the naming. It also allows the user to ignore a specific
 element of the tuple if it's undesired, by using a wildcard.

 Here is an example:
 
https://github.com/MedeaMelana/JsonGrammar/blob/aad158899d9845f7b15a65609a818e557f260dcf/Example.hs

 I understand the reason for MonoPatBinds, but I will miss them. :-) :-( Is
 there another way in which I can let the user handle the naming of
 multiple generated polymorphic values this easily? The only thing I can
 think of is to add an argument for the list of to-be-introduced names to
 the TH function.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4940#comment:4>
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