Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
curry-frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
62
Issues
62
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
curry
curry-frontend
Commits
14880aae
Commit
14880aae
authored
Apr 14, 2016
by
Finn Teegen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add syntax extension for existentially quantified types
parent
59d75a24
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
7 deletions
+30
-7
CHANGELOG.md
CHANGELOG.md
+2
-0
src/Checks/SyntaxCheck.hs
src/Checks/SyntaxCheck.hs
+26
-7
src/CompilerOpts.hs
src/CompilerOpts.hs
+2
-0
No files found.
CHANGELOG.md
View file @
14880aae
...
...
@@ -11,6 +11,8 @@ Under development (0.4.1)
*
Split checking and expansion of export specification into two
subsequent steps (by Yannik Potdevin, fixes #1335)
*
Consider parenthesized type expressions in the Curry AST (by Katharina Rahf)
*
Added syntax extension
`ExistentialQuantification`
that allows the use
of existentially quantified types in data and newtype constructors
Version 0.4.0
=============
...
...
src/Checks/SyntaxCheck.hs
View file @
14880aae
...
...
@@ -28,7 +28,7 @@ module Checks.SyntaxCheck (syntaxCheck) where
#
if
__GLASGOW_HASKELL__
<
710
import
Control.Applicative
((
<$>
),
(
<*>
))
#
endif
import
Control.Monad
(
unless
,
when
)
import
Control.Monad
(
(
>=>
),
unless
,
when
)
import
qualified
Control.Monad.State
as
S
(
State
,
runState
,
gets
,
modify
)
import
Data.List
(
insertBy
,
intersect
,
nub
,
partition
)
import
Data.Maybe
(
isJust
,
isNothing
)
...
...
@@ -495,15 +495,30 @@ checkDecls bindDecl ds = do
-- -- ---------------------------------------------------------------------------
checkDeclRhs
::
[
Ident
]
->
Decl
->
SCM
Decl
checkDeclRhs
_
(
DataDecl
p
tc
tvs
cs
)
=
DataDecl
p
tc
tvs
<$>
mapM
checkDeclLabels
cs
checkDeclRhs
bvs
(
TypeSig
p
vs
ty
)
=
checkDeclRhs
_
(
DataDecl
p
tc
tvs
cs
)
=
DataDecl
p
tc
tvs
<$>
mapM
(
checkConstrDecl
>=>
checkDeclLabels
)
cs
checkDeclRhs
_
(
NewtypeDecl
p
tc
tvs
c
)
=
NewtypeDecl
p
tc
tvs
<$>
checkNewconstrDecl
c
checkDeclRhs
bvs
(
TypeSig
p
vs
ty
)
=
(
\
vs'
->
TypeSig
p
vs'
ty
)
<$>
mapM
(
checkLocalVar
bvs
)
vs
checkDeclRhs
_
(
FunctionDecl
p
f
eqs
)
=
checkDeclRhs
_
(
FunctionDecl
p
f
eqs
)
=
FunctionDecl
p
f
<$>
mapM
checkEquation
eqs
checkDeclRhs
_
(
PatternDecl
p
t
rhs
)
=
checkDeclRhs
_
(
PatternDecl
p
t
rhs
)
=
PatternDecl
p
t
<$>
checkRhs
rhs
checkDeclRhs
_
d
=
return
d
checkDeclRhs
_
d
=
return
d
checkConstrDecl
::
ConstrDecl
->
SCM
ConstrDecl
checkConstrDecl
c
@
(
ConstrDecl
_
evs
_
_
)
=
checkExistVars
evs
>>
return
c
checkConstrDecl
c
@
(
ConOpDecl
_
evs
_
_
_
)
=
checkExistVars
evs
>>
return
c
checkConstrDecl
c
@
(
RecordDecl
_
evs
_
_
)
=
checkExistVars
evs
>>
return
c
checkNewconstrDecl
::
NewConstrDecl
->
SCM
NewConstrDecl
checkNewconstrDecl
c
@
(
NewConstrDecl
_
evs
_
_
)
=
checkExistVars
evs
>>
return
c
checkNewConstrDecl
c
@
(
NewRecordDecl
_
evs
_
_
)
=
checkExistVars
evs
>>
return
c
checkExistVars
::
[
Ident
]
->
SCM
()
checkExistVars
[]
=
ok
checkExistVars
(
ev
:
_
)
=
checkExistentialQuantificationExtension
$
idPosition
ev
checkDeclLabels
::
ConstrDecl
->
SCM
ConstrDecl
checkDeclLabels
rd
@
(
RecordDecl
_
_
_
fs
)
=
do
...
...
@@ -1034,6 +1049,10 @@ checkFPTerm _ (InfixFuncPattern _ _ _) = ok -- do not check again
-- Miscellaneous functions
-- ---------------------------------------------------------------------------
checkExistentialQuantificationExtension
::
Position
->
SCM
()
checkExistentialQuantificationExtension
p
=
checkUsedExtension
p
"Existentially quantified types"
ExistentialQuantification
checkFuncPatsExtension
::
Position
->
SCM
()
checkFuncPatsExtension
p
=
checkUsedExtension
p
"Functional Patterns"
FunctionalPatterns
...
...
src/CompilerOpts.hs
View file @
14880aae
...
...
@@ -233,6 +233,8 @@ extensions =
,
"desugar negated literals as negative literal"
)
,
(
NoImplicitPrelude
,
"NoImplicitPrelude"
,
"do not implicitly import the Prelude"
)
,
(
ExistentialQuantification
,
"ExistentialQuantification"
,
"enable existentially quantified types"
)
]
-- -----------------------------------------------------------------------------
...
...
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