[GHC] #11024: Fix strange parsing of BooleanFormula
GHC
ghc-devs at haskell.org
Tue Oct 27 21:17:38 UTC 2015
#11024: Fix strange parsing of BooleanFormula
-------------------------------------+-------------------------------------
Reporter: mpickering | Owner:
Type: task | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 7.10.2
(Parser) |
Resolution: | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by mpickering:
Old description:
> Consider the following program.
>
> {{{
> module Foo where
>
> class Meh a where
> foo :: a -> String
> foo1 :: a -> String
> foo2 :: a -> String
>
> {-# MINIMAL foo, foo1, foo2 #-}
> }}}
>
> The minimal pragma is parsed quite weirdly.
>
> {{{
> (MinimalSig "{-# MINIMAL"
> (And
> [
> (Var
> ({ test.hs:8:15-17 }
> (Unqual {OccName: foo}))),
> (And
> [
> (Var
> ({ test.hs:8:20-23 }
> (Unqual {OccName: foo1}))),
> (Var
> ({ test.hs:8:26-29 }
> (Unqual {OccName: foo2})))])])))] {Bag(Located (HsBind
> RdrName)):
> }}}
>
> To be clear, it is parsed as `And [foo, [And [foo1, foo2]]` rather than
> `And [foo, foo1, foo2]`.
>
> Either the datatype should be change to be more like a binary tree or the
> parser should be changed to handle this properly. I think the second
> option would be easiest.
New description:
Consider the following program.
{{{
module Foo where
class Meh a where
foo :: a -> String
foo1 :: a -> String
foo2 :: a -> String
{-# MINIMAL foo, foo1, foo2 #-}
}}}
The minimal pragma is parsed quite weirdly.
{{{
(MinimalSig "{-# MINIMAL"
(And
[
(Var
({ test.hs:8:15-17 }
(Unqual {OccName: foo}))),
(And
[
(Var
({ test.hs:8:20-23 }
(Unqual {OccName: foo1}))),
(Var
({ test.hs:8:26-29 }
(Unqual {OccName: foo2})))])])))] {Bag(Located (HsBind
RdrName)):
}}}
To be clear, it is parsed as `And [foo, And [foo1, foo2]]` rather than
`And [foo, foo1, foo2]`.
Either the datatype should be change to be more like a binary tree or the
parser should be changed to handle this properly. I think the second
option would be easiest.
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11024#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list