[GHC] #8863: ghc 7.6.3: type parser accepts => as -> (sometimes)

GHC ghc-devs at haskell.org
Sat Mar 8 20:33:39 UTC 2014


#8863: ghc 7.6.3: type parser accepts => as -> (sometimes)
------------------------------------------------+--------------------------
        Reporter:  patrikj                      |            Owner:
            Type:  bug                          |           Status:  closed
        Priority:  normal                       |        Milestone:  7.8.1
       Component:  Compiler                     |          Version:  7.6.3
      Resolution:  fixed                        |         Keywords:
Operating System:  Unknown/Multiple             |     Architecture:
 Type of failure:  GHC accepts invalid program  |  Unknown/Multiple
       Test Case:                               |       Difficulty:
        Blocking:                               |  Unknown
                                                |       Blocked By:
                                                |  Related Tickets:
------------------------------------------------+--------------------------
Changes (by hvr):

 * status:  new => closed
 * os:  Linux => Unknown/Multiple
 * architecture:  x86_64 (amd64) => Unknown/Multiple
 * milestone:   => 7.8.1
 * resolution:   => fixed


Old description:

> The following examples are all parsed and type checked even though they
> don't seem to be conforming to the Haskell standard syntax:
>
> a :: Int => Int
> a = (1+)
>
> b :: a -> a => a
> b = const
>
> c :: Num a => [a => a => a]
> c = [(+)]
>
> Slight variations fail (as the should) - for example
>
> b' :: a -> b => a
> b' = const
>
> /Patrik
>
> ----
>
> Linux cse-814009 3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC
> 2014 x86_64 x86_64 x86_64 GNU/Linux

New description:

 The following examples are all parsed and type checked even though they
 don't seem to be conforming to the Haskell standard syntax:

 {{{#!haskell
 a :: Int => Int
 a = (1+)

 b :: a -> a => a
 b = const

 c :: Num a => [a => a => a]
 c = [(+)]
 }}}

 Slight variations fail (as the should) - for example

 {{{#!haskell
 b' :: a -> b => a
 b' = const
 }}}

 /Patrik

 ----

 {{{
 Linux cse-814009 3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC
 2014 x86_64 x86_64 x86_64 GNU/Linux
 }}}

--

Comment:

 GHC 7.8.1-RC2 correctly detects all 3 cases as invalid grammar:

 {{{
 t8863.hs:1:6:
     Expected a constraint, but ‘Int’ has kind ‘*’
     In the type signature for ‘a’: a :: Int => Int

 t8863.hs:4:11:
     Expected a constraint, but ‘a’ has kind ‘*’
     In the type signature for ‘b’: b :: a -> a => a

 t8863.hs:7:16:
     Expected a constraint, but ‘a’ has kind ‘*’
     In the type signature for ‘c’: c :: Num a => [a => a => a]

 }}}

 I'm therefore closing this as fixed

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


More information about the ghc-tickets mailing list