Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
curry
curry-frontend
Commits
54df07fd
Commit
54df07fd
authored
May 20, 2014
by
Björn Peemöller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extended qualification to export specification
parent
ad65ed56
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
11 deletions
+25
-11
src/Modules.hs
src/Modules.hs
+1
-4
src/Transformations.hs
src/Transformations.hs
+5
-5
src/Transformations/Qual.hs
src/Transformations/Qual.hs
+19
-2
No files found.
src/Modules.hs
View file @
54df07fd
...
...
@@ -252,13 +252,10 @@ transModule opts env mdl = (env5, ilCaseComp, dumps)
writeOutput
::
Options
->
FilePath
->
(
CompilerEnv
,
CS
.
Module
)
->
IO
()
writeOutput
opts
fn
(
env
,
modul
)
=
do
writeParsed
opts
fn
modul
let
(
env1
,
qlfd
)
=
qual
opts
env
modul
let
(
qlfd
,
env1
)
=
qual
opts
env
modul
doDump
(
optDebugOpts
opts
)
(
DumpQualified
,
env1
,
show
$
CS
.
ppModule
qlfd
)
writeAbstractCurry
opts
fn
env1
qlfd
when
withFlat
$
do
-- checkModule checks types, and then transModule introduces new
-- functions (by lambda lifting in 'desugar'). Consequence: The
-- types of the newly introduced functions are not inferred (hsi)
let
(
env2
,
il
,
dumps
)
=
transModule
opts
env1
qlfd
-- dump intermediate results
mapM_
(
doDump
(
optDebugOpts
opts
))
dumps
...
...
src/Transformations.hs
View file @
54df07fd
...
...
@@ -55,12 +55,12 @@ lift :: Module -> CompilerEnv -> (Module, CompilerEnv)
lift
mdl
env
=
(
mdl'
,
env
{
valueEnv
=
tyEnv'
})
where
(
mdl'
,
tyEnv'
)
=
L
.
lift
(
valueEnv
env
)
mdl
-- |Fully qualify used constructors and functions
qual
::
Options
->
CompilerEnv
->
Module
->
(
CompilerEnv
,
Module
)
qual
opts
env
(
Module
ps
m
es
is
ds
)
=
(
qualifyEnv
opts
env
,
Module
ps
m
es
is
ds'
)
where
ds
'
=
Q
.
qual
(
moduleIdent
env
)
(
tyConsEnv
env
)
(
valueEnv
env
)
ds
-- |Fully qualify used constructors and functions
.
qual
::
Options
->
CompilerEnv
->
Module
->
(
Module
,
CompilerEnv
)
qual
opts
env
mdl
=
(
mdl'
,
qualifyEnv
opts
env
)
where
mdl
'
=
Q
.
qual
(
moduleIdent
env
)
(
tyConsEnv
env
)
(
valueEnv
env
)
mdl
-- |Simplify the source code
-- |Simplify the source code
.
simplify
::
Bool
->
Module
->
CompilerEnv
->
(
Module
,
CompilerEnv
)
simplify
flat
mdl
env
=
(
mdl'
,
env
{
valueEnv
=
tyEnv'
})
where
(
mdl'
,
tyEnv'
)
=
S
.
simplify
flat
(
valueEnv
env
)
mdl
src/Transformations/Qual.hs
View file @
54df07fd
...
...
@@ -44,8 +44,25 @@ data QualEnv = QualEnv
type
Qual
a
=
a
->
R
.
Reader
QualEnv
a
qual
::
ModuleIdent
->
TCEnv
->
ValueEnv
->
[
Decl
]
->
[
Decl
]
qual
m
tcEnv
tyEnv
ds
=
R
.
runReader
(
mapM
qDecl
ds
)
(
QualEnv
m
tcEnv
tyEnv
)
qual
::
ModuleIdent
->
TCEnv
->
ValueEnv
->
Module
->
Module
qual
m
tcEnv
tyEnv
mdl
=
R
.
runReader
(
qModule
mdl
)
(
QualEnv
m
tcEnv
tyEnv
)
qModule
::
Qual
Module
qModule
(
Module
ps
m
es
is
ds
)
=
do
es'
<-
qExportSpec
es
ds'
<-
mapM
qDecl
ds
return
(
Module
ps
m
es'
is
ds'
)
qExportSpec
::
Qual
(
Maybe
ExportSpec
)
qExportSpec
Nothing
=
return
Nothing
qExportSpec
(
Just
(
Exporting
p
es
))
=
(
Just
.
Exporting
p
)
`
liftM
`
mapM
qExport
es
qExport
::
Qual
Export
qExport
(
Export
x
)
=
Export
`
liftM
`
qIdent
x
qExport
(
ExportTypeWith
t
cs
)
=
flip
ExportTypeWith
cs
`
liftM
`
qConstr
t
qExport
(
ExportTypeAll
t
)
=
ExportTypeAll
`
liftM
`
qConstr
t
qExport
m
@
(
ExportModule
_
)
=
return
m
qDecl
::
Qual
Decl
qDecl
i
@
(
InfixDecl
_
_
_
_
)
=
return
i
...
...
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