Quantcast

[GHC] #13600: surprising error message with bang pattern

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[GHC] #13600: surprising error message with bang pattern

GHC - devs mailing list
#13600: surprising error message with bang pattern
-------------------------------------+-------------------------------------
           Reporter:  andrewufrank   |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           Keywords:                 |  Operating System:  Linux
       Architecture:  x86_64         |   Type of failure:  Poor/confusing
  (amd64)                            |  error message
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 the following code

 {{{
 f3 :: [Int] -> IO Int
 f3 x = return (sum x)

 f4 :: [Int] -> IO Int
 f4 !x = return (sum x)
 }}}

 gives `The type signature for ‘f4’ lacks an accompanying binding` for the
 second function (the two functions are exactly the same except for the
 added bang). I do not understand bang patterns well, but would expect a
 more instructive error message. without the type definition, the second
 function f4 compiles with the bang).

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13600: surprising error message with bang pattern

GHC - devs mailing list
#13600: surprising error message with bang pattern
-------------------------------------+-------------------------------------
        Reporter:  andrewufrank      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Poor/confusing    |  (amd64)
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by mpickering):

 You need to turn on the `BangPatterns` extension, otherwise you are
 defining an infix operator `!`. The error message is then accurate as you
 have given a type signature for `f4` but then defined `!`.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13600#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13600: surprising error message with bang pattern

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13600: surprising error message with bang pattern
-------------------------------------+-------------------------------------
        Reporter:  andrewufrank      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Poor/confusing    |  (amd64)
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Ha ha, Matthew is right!

 Maybe it would help if, when GHC sees an infix definition for `(!)`, and
 the `!` immediately precedes the second argument, we suggested the
 possibility of bang patterns?  To suppress the warning, we'd suggest
 adding a space, thus
 {{{
 f4 ! x = ...
 }}}
 I think that'd be useful, if someone wants to try.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13600#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13600: surprising error message with bang pattern

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13600: surprising error message with bang pattern
-------------------------------------+-------------------------------------
        Reporter:  andrewufrank      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Poor/confusing    |  (amd64)
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by andrewufrank):

 Thank you very much for the clarification. As i said, i have not much
 experience with bang patterns and did not see in the manual the hint that
 I would have to turn on an extension. Perhaps somebody could revise the
 relevant parts of the ghc docs.
 andrew

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13600#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Loading...