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
23dedde4
Commit
23dedde4
authored
Aug 11, 2014
by
Björn Peemöller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed dependency to Curry.Base.Messages
parent
e4928e3e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
35 deletions
+32
-35
src/Base/Messages.hs
src/Base/Messages.hs
+10
-9
src/CurryDeps.hs
src/CurryDeps.hs
+3
-4
src/Html/CurryHtml.hs
src/Html/CurryHtml.hs
+8
-9
src/Interfaces.hs
src/Interfaces.hs
+2
-3
src/Modules.hs
src/Modules.hs
+9
-10
No files found.
src/Base/Messages.hs
View file @
23dedde4
...
...
@@ -9,15 +9,16 @@ module Base.Messages
,
MonadIO
(
..
),
CYIO
,
CYT
,
left
,
right
,
runEitherCYIO
)
where
import
Control.Monad
(
unless
,
when
)
import
Control.Monad.IO.Class
import
Control.Monad.Trans.Either
import
Data.List
(
sort
)
import
System.IO
(
hFlush
,
hPutStrLn
,
stderr
,
stdout
)
import
System.Exit
(
exitFailure
)
import
Curry.Base.Message
hiding
(
warn
)
import
CompilerOpts
(
Options
(
..
),
WarnOpts
(
..
),
Verbosity
(
..
))
import
Control.Monad
(
unless
,
when
)
import
Control.Monad.IO.Class
(
MonadIO
(
..
))
import
Control.Monad.Trans.Either
(
EitherT
,
left
,
right
,
runEitherT
)
import
Data.List
(
sort
)
import
System.IO
(
hFlush
,
hPutStrLn
,
stderr
,
stdout
)
import
System.Exit
(
exitFailure
)
import
Curry.Base.Message
(
Message
,
message
,
posMessage
,
ppMessage
,
ppMessages
,
ppWarning
,
ppError
)
import
CompilerOpts
(
Options
(
..
),
WarnOpts
(
..
),
Verbosity
(
..
))
type
CYT
m
a
=
EitherT
[
Message
]
m
a
...
...
src/CurryDeps.hs
View file @
23dedde4
...
...
@@ -24,7 +24,6 @@ import Data.List (isSuffixOf, nub)
import
qualified
Data.Map
as
Map
(
Map
,
empty
,
insert
,
lookup
,
toList
)
import
Curry.Base.Ident
import
Curry.Base.Message
(
runMsg
)
import
Curry.Base.Pretty
import
Curry.Files.Filenames
import
Curry.Files.PathUtils
...
...
@@ -133,9 +132,9 @@ readHeader fn = do
case
mbFile
of
Nothing
->
left
[
errMissingFile
fn
]
Just
src
->
do
case
runMsg
$
parseHeader
fn
src
of
Left
err
->
left
[
err
]
Right
(
hdr
,
_
)
->
return
$
patchModuleId
fn
hdr
case
parseHeader
fn
src
of
Left
err
->
left
[
err
]
Right
hdr
->
return
$
patchModuleId
fn
hdr
-- If we want to compile the program instead of generating Makefile
-- dependencies, the environment has to be sorted topologically. Note
...
...
src/Html/CurryHtml.hs
View file @
23dedde4
...
...
@@ -20,7 +20,6 @@ import Data.Maybe (fromMaybe, isJust)
import
System.FilePath
((
</>
),
dropFileName
,
takeBaseName
)
import
Curry.Base.Ident
(
QualIdent
(
..
),
unqualify
)
import
Curry.Base.Message
import
Curry.Base.Pretty
(
text
)
import
Curry.Files.PathUtils
(
readModule
,
lookupCurryFile
)
import
Curry.Syntax
(
Module
,
lexSource
)
...
...
@@ -33,8 +32,8 @@ import CurryBuilder (buildCurry)
import
Modules
(
loadAndCheckModule
)
import
Transformations
(
qual
)
--
-
translate source file into HTML file with syntaxcoloring
--
-
@param sourcefilename
-- translate source file into HTML file with syntaxcoloring
-- @param sourcefilename
source2html
::
Options
->
FilePath
->
CYIO
()
source2html
opts
f
=
do
let
baseName
=
takeBaseName
f
...
...
@@ -44,18 +43,18 @@ source2html opts f = do
program
<-
filename2program
opts
(
fromMaybe
f
srcFile
)
liftIO
$
writeFile
outFile
(
program2html
baseName
program
)
--
-
@param importpaths
--
-
@param filename
--
-
@return program
-- @param importpaths
-- @param filename
-- @return program
filename2program
::
Options
->
String
->
CYIO
[
Code
]
filename2program
opts
f
=
do
mbModule
<-
liftIO
$
readModule
f
case
mbModule
of
Nothing
->
left
[
message
$
text
$
"Missing file: "
++
f
]
Just
src
->
do
case
runMsg
(
lexSource
f
src
)
of
Left
e
->
left
[
e
]
Right
(
toks
,
_
)
->
do
case
lexSource
f
src
of
Left
err
->
left
[
e
rr
]
Right
toks
->
do
typed
<-
fullParse
opts
f
src
return
(
genProgram
typed
toks
)
...
...
src/Interfaces.hs
View file @
23dedde4
...
...
@@ -29,7 +29,6 @@ import qualified Control.Monad.State as S (StateT, execStateT, gets, modify)
import
qualified
Data.Map
as
M
(
insert
,
member
)
import
Curry.Base.Ident
import
Curry.Base.Message
(
runMsg
)
import
Curry.Base.Position
import
Curry.Base.Pretty
import
Curry.Files.PathUtils
...
...
@@ -107,9 +106,9 @@ compileInterface ctxt (p, m) fn = do
mbSrc
<-
liftIO
$
readModule
fn
case
mbSrc
of
Nothing
->
report
$
errInterfaceNotFound
p
m
Just
src
->
case
runMsg
$
parseInterface
fn
src
of
Just
src
->
case
parseInterface
fn
src
of
Left
err
->
report
err
Right
(
intf
@
(
Interface
n
is
_
),
_
)
->
Right
intf
@
(
Interface
n
is
_
)
->
if
(
m
/=
n
)
then
report
$
errWrongInterface
(
first
fn
)
m
n
else
do
...
...
src/Modules.hs
View file @
23dedde4
...
...
@@ -32,7 +32,6 @@ import System.IO
import
System.Process
(
system
)
import
Curry.Base.Ident
import
Curry.Base.Message
(
runMsg
)
import
Curry.Base.Position
import
Curry.Base.Pretty
import
Curry.ExtendedFlat.InterfaceEquivalence
(
eqInterface
)
...
...
@@ -108,14 +107,14 @@ parseModule opts fn = do
case
mbSrc
of
Nothing
->
left
[
message
$
text
$
"Missing file: "
++
fn
]
Just
src
->
do
case
runMsg
(
CS
.
unlit
fn
src
)
of
Left
err
->
left
[
err
]
Right
(
ul
,
_
)
->
do
case
CS
.
unlit
fn
src
of
Left
err
->
left
[
err
]
Right
ul
->
do
prepd
<-
preprocess
(
optPrepOpts
opts
)
fn
ul
-- parse module
case
runMsg
(
CS
.
parseModule
fn
prepd
)
of
Left
err
->
left
[
err
]
Right
(
parsed
,
_
)
->
right
parsed
case
CS
.
parseModule
fn
prepd
of
Left
err
->
left
[
err
]
Right
parsed
->
right
parsed
preprocess
::
PrepOpts
->
FilePath
->
String
->
CYIO
String
preprocess
opts
fn
src
...
...
@@ -301,9 +300,9 @@ matchInterface :: FilePath -> CS.Interface -> IO Bool
matchInterface
ifn
i
=
do
hdl
<-
openFile
ifn
ReadMode
src
<-
hGetContents
hdl
case
runMsg
(
CS
.
parseInterface
ifn
src
)
of
Left
_
->
hClose
hdl
>>
return
False
Right
(
i'
,
_
)
->
return
(
i
`
intfEquiv
`
fixInterface
i'
)
case
CS
.
parseInterface
ifn
src
of
Left
_
->
hClose
hdl
>>
return
False
Right
i'
->
return
(
i
`
intfEquiv
`
fixInterface
i'
)
writeFlat
::
Options
->
FilePath
->
CompilerEnv
->
ModuleSummary
->
IL
.
Module
->
IO
()
...
...
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