Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
c23435f0
Commit
c23435f0
authored
Jan 04, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Special-casing some error messages line wrapping, closes #76
parent
552cb20a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
4 deletions
+47
-4
profile.tar
profile/profile.tar
+0
-0
custom.css
profile/static/custom/custom.css
+19
-0
Evaluate.hs
src/IHaskell/Eval/Evaluate.hs
+28
-4
No files found.
profile/profile.tar
View file @
c23435f0
No preview for this file type
profile/static/custom/custom.css
View file @
c23435f0
/*
Custom IHaskell CSS.
*/
/* Styles used for basic displays */
.get-type
{
color
:
green
;
font-weight
:
bold
;
font-family
:
monospace
;
}
.err-msg
{
color
:
red
;
font-style
:
italic
;
font-family
:
monospace
;
white-space
:
pre
;
}
/* Code that will get highlighted before it is highlighted */
.highlight-code
{
white-space
:
pre
;
font-family
:
monospace
;
}
/* Hlint styles */
.suggestion-warning
{
font-weight
:
bold
;
color
:
rgb
(
200
,
130
,
0
);
...
...
src/IHaskell/Eval/Evaluate.hs
View file @
c23435f0
...
...
@@ -12,7 +12,7 @@ import ClassyPrelude hiding (liftIO, hGetContents, try)
import
Control.Concurrent
(
forkIO
,
threadDelay
)
import
Prelude
(
putChar
,
head
,
tail
,
last
,
init
,
(
!!
))
import
Data.List.Utils
import
Data.List
(
findIndex
)
import
Data.List
(
findIndex
,
and
)
import
Data.String.Utils
import
Text.Printf
import
Data.Char
as
Char
...
...
@@ -719,20 +719,44 @@ capturedStatement output stmt = do
return
(
printedOutput
,
result
)
formatError
::
ErrMsg
->
String
formatError
=
printf
"<span
style='color: red; font-style: italic;
'>%s</span>"
.
formatError
=
printf
"<span
class='err-msg
'>%s</span>"
.
replace
"
\n
"
"<br/>"
.
fixLineWrapping
.
replace
useDashV
""
.
rstrip
.
typeCleaner
where
useDashV
=
"
\n
Use -v to see a list of the files searched for."
useDashV
=
"
\n
Use -v to see a list of the files searched for."
fixLineWrapping
err
|
isThreePartTypeError
err
=
let
(
before
,
exp
:
after
)
=
break
(
"Expected type"
`
isInfixOf
`)
$
lines
err
(
expected
,
act
:
actual
)
=
break
(
"Actual type"
`
isInfixOf
`)
after
in
unlines
$
map
unstripped
[
before
,
exp
:
expected
,
act
:
actual
]
|
isTwoPartTypeError
err
=
let
(
one
,
two
)
=
break
(
"with actual type"
`
isInfixOf
`)
$
lines
err
in
unlines
$
map
unstripped
[
one
,
two
]
|
otherwise
=
err
where
unstripped
(
line
:
lines
)
=
unwords
$
line
:
map
lstrip
lines
isThreePartTypeError
err
=
all
(`
isInfixOf
`
err
)
[
"Couldn't match type"
,
"with"
,
"Expected type:"
,
"Actual type:"
]
isTwoPartTypeError
err
=
all
(`
isInfixOf
`
err
)
[
"Couldn't match expected type"
,
"with actual type"
]
formatParseError
::
StringLoc
->
String
->
ErrMsg
formatParseError
(
Loc
line
col
)
=
printf
"Parse error (line %d, column %d): %s"
line
col
formatGetType
::
String
->
String
formatGetType
=
printf
"<span
style='font-weight: bold; color: green;
'>%s</span>"
formatGetType
=
printf
"<span
class='get-type
'>%s</span>"
displayError
::
ErrMsg
->
[
DisplayData
]
displayError
msg
=
[
plain
.
typeCleaner
$
msg
,
html
$
formatError
msg
]
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