Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,265
Issues
4,265
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
420
Merge Requests
420
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
5252fa37
Commit
5252fa37
authored
Apr 02, 2009
by
simonpj@microsoft.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comments only; record remarks about removing 'type' nonterminal
parent
21ca8c31
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
11 deletions
+37
-11
compiler/parser/Parser.y.pp
compiler/parser/Parser.y.pp
+37
-11
No files found.
compiler/parser/Parser.y.pp
View file @
5252fa37
...
@@ -1004,6 +1004,17 @@ strict_mark :: { Located HsBang }
...
@@ -1004,6 +1004,17 @@ strict_mark :: { Located HsBang }
:
'!'
{
L1
HsStrict
}
:
'!'
{
L1
HsStrict
}
|
'{-# UNPACK'
'#-}'
'!'
{
LL
HsUnbox
}
|
'{-# UNPACK'
'#-}'
'!'
{
LL
HsUnbox
}
----------------------
--
Notes
for
'ctype'
--
We
should
probably
use
'gentype'
rather
than
'type'
in
the
LHS
of
type
declarations
--
That
would
leave
the
only
use
of
'type'
in
'ctype'
;
and
only
one
of
its
occurrences
--
makes
sense
there
too
!
So
it
might
make
sense
to
inline
type
there
:
--
ctype
:
'forall'
tv_bndrs
'.'
ctype
--
|
context
'=>'
ctype
--
|
ipvar
'::'
gentype
--
|
gentype
--
Which
in
turn
would
let
us
rename
gentype
to
type
--
A
ctype
is
a
for
-
all
type
--
A
ctype
is
a
for
-
all
type
ctype
::
{
LHsType
RdrName
}
ctype
::
{
LHsType
RdrName
}
:
'forall'
tv_bndrs
'.'
ctype
{
LL
$
mkExplicitHsForAllTy
$2
(
noLoc
[])
$4
}
:
'forall'
tv_bndrs
'.'
ctype
{
LL
$
mkExplicitHsForAllTy
$2
(
noLoc
[])
$4
}
...
@@ -1011,32 +1022,47 @@ ctype :: { LHsType RdrName }
...
@@ -1011,32 +1022,47 @@ ctype :: { LHsType RdrName }
--
A
type
of
form
(
context
=>
type
)
is
an
*
implicit
*
HsForAllTy
--
A
type
of
form
(
context
=>
type
)
is
an
*
implicit
*
HsForAllTy
|
type
{
$1
}
|
type
{
$1
}
type
::
{
LHsType
RdrName
}
:
ipvar
'::'
gentype
{
LL
(
HsPredTy
(
HsIParam
(
unLoc
$1
)
$3
))
}
|
gentype
{
$1
}
----------------------
--
Notes
for
'ctypedoc'
--
It
would
have
been
nice
to
simplify
the
grammar
by
unifying
`
ctype
`
and
--
ctypedoc
`
into
one
production
,
allowing
comments
on
types
everywhere
(
and
--
rejecting
them
after
parsing
,
where
necessary
)
.
This
is
however
not
possible
--
since
it
leads
to
ambiguity
.
The
reason
is
the
support
for
comments
on
record
--
fields
:
--
data
R
=
R
{
field
::
Int
--
^
comment
on
the
field
}
--
If
we
allow
comments
on
types
here
,
it
's not clear if the comment applies
-- to '
field
' or to '
Int
'. So we must use `ctype` to describe the type.
ctypedoc :: { LHsType RdrName }
ctypedoc :: { LHsType RdrName }
: '
forall
' tv_bndrs '
.
' ctypedoc { LL $ mkExplicitHsForAllTy $2 (noLoc []) $4 }
: '
forall
' tv_bndrs '
.
' ctypedoc { LL $ mkExplicitHsForAllTy $2 (noLoc []) $4 }
| context '
=>
' ctypedoc { LL $ mkImplicitHsForAllTy $1 $3 }
| context '
=>
' ctypedoc { LL $ mkImplicitHsForAllTy $1 $3 }
-- A type of form (context => type) is an *implicit* HsForAllTy
-- A type of form (context => type) is an *implicit* HsForAllTy
| typedoc { $1 }
| typedoc { $1 }
typedoc :: { LHsType RdrName }
: ipvar '
::
' gentype { LL (HsPredTy (HsIParam (unLoc $1) $3)) }
| gentypedoc { $1 }
----------------------
-- Notes for '
context
'
-- We parse a context as a btype so that we don'
t
get
reduce
/
reduce
-- We parse a context as a btype so that we don'
t
get
reduce
/
reduce
--
errors
in
ctype
.
The
basic
problem
is
that
--
errors
in
ctype
.
The
basic
problem
is
that
--
(
Eq
a
,
Ord
a
)
--
(
Eq
a
,
Ord
a
)
--
looks
so
much
like
a
tuple
type
.
We
can
't tell until we find the =>
--
looks
so
much
like
a
tuple
type
.
We
can
't tell until we find the =>
--
--
We
have
the
t1
~
t2
form
here
and
in
gentype
,
to
permit
an
individual
-- We have the t1 ~ t2 form both in '
context
' and in gentype,
--
equational
constraint
without
parenthesis
.
-- to permit an individual equational constraint without parenthesis.
-- Thus for some reason we allow f :: a~b => blah
-- but not f :: ?x::Int => blah
context :: { LHsContext RdrName }
context :: { LHsContext RdrName }
: btype '
~
' btype {% checkContext
: btype '
~
' btype {% checkContext
(LL $ HsPredTy (HsEqualP $1 $3)) }
(LL $ HsPredTy (HsEqualP $1 $3)) }
| btype {% checkContext $1 }
| btype {% checkContext $1 }
type
::
{
LHsType
RdrName
}
:
ipvar
'::'
gentype
{
LL
(
HsPredTy
(
HsIParam
(
unLoc
$1
)
$3
))
}
|
gentype
{
$1
}
typedoc
::
{
LHsType
RdrName
}
:
ipvar
'::'
gentype
{
LL
(
HsPredTy
(
HsIParam
(
unLoc
$1
)
$3
))
}
|
gentypedoc
{
$1
}
gentype :: { LHsType RdrName }
gentype :: { LHsType RdrName }
: btype { $1 }
: btype { $1 }
| btype qtyconop gentype { LL $ HsOpTy $1 $2 $3 }
| btype qtyconop gentype { LL $ HsOpTy $1 $2 $3 }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment