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
3d38d41f
Commit
3d38d41f
authored
Jan 10, 2014
by
Adam Vogt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Monoid Display instance
parent
9e746d84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
Evaluate.hs
src/IHaskell/Eval/Evaluate.hs
+8
-8
Types.hs
src/IHaskell/Types.hs
+7
-0
No files found.
src/IHaskell/Eval/Evaluate.hs
View file @
3d38d41f
...
@@ -351,7 +351,7 @@ evalCommand _ (Import importStr) state = wrapExecution state $ do
...
@@ -351,7 +351,7 @@ evalCommand _ (Import importStr) state = wrapExecution state $ do
return
$
if
"Test.Hspec"
`
isInfixOf
`
importStr
return
$
if
"Test.Hspec"
`
isInfixOf
`
importStr
then
displayError
$
"Warning: Hspec is unusable in IHaskell until the resolution of GHC bug #8639."
++
then
displayError
$
"Warning: Hspec is unusable in IHaskell until the resolution of GHC bug #8639."
++
"
\n
The variable `it` is shadowed and cannot be accessed, even in qualified form."
"
\n
The variable `it` is shadowed and cannot be accessed, even in qualified form."
else
Display
[]
else
mempty
where
where
implicitImportOf
::
ImportDecl
RdrName
->
InteractiveImport
->
Bool
implicitImportOf
::
ImportDecl
RdrName
->
InteractiveImport
->
Bool
implicitImportOf
_
(
IIModule
_
)
=
False
implicitImportOf
_
(
IIModule
_
)
=
False
...
@@ -423,7 +423,7 @@ evalCommand _ (Directive SetDynFlag flags) state = wrapExecution state $ do
...
@@ -423,7 +423,7 @@ evalCommand _ (Directive SetDynFlag flags) state = wrapExecution state $ do
write
$
"DynFlag: "
++
flags
write
$
"DynFlag: "
++
flags
errs
<-
setDynFlags
(
words
flags
)
errs
<-
setDynFlags
(
words
flags
)
return
$
case
errs
of
return
$
case
errs
of
[]
->
[]
[]
->
mempty
_
->
displayError
$
intercalate
"
\n
"
errs
_
->
displayError
$
intercalate
"
\n
"
errs
evalCommand
a
(
Directive
SetExtension
opts
)
state
=
do
evalCommand
a
(
Directive
SetExtension
opts
)
state
=
do
...
@@ -439,7 +439,7 @@ evalCommand a (Directive SetOption opts) state = do
...
@@ -439,7 +439,7 @@ evalCommand a (Directive SetOption opts) state = do
ds
->
error
(
"kernelOpts has duplicate:"
++
show
(
map
getOptionName
ds
))
ds
->
error
(
"kernelOpts has duplicate:"
++
show
(
map
getOptionName
ds
))
|
w
<-
words
opts
]
|
w
<-
words
opts
]
warn
warn
|
null
lost
=
[]
|
null
lost
=
mempty
|
otherwise
=
displayError
(
"Could not recognize options: "
++
intercalate
","
lost
)
|
otherwise
=
displayError
(
"Could not recognize options: "
++
intercalate
","
lost
)
return
EvalOut
{
return
EvalOut
{
evalStatus
=
if
null
lost
then
Success
else
Failure
,
evalStatus
=
if
null
lost
then
Success
else
Failure
,
...
@@ -482,7 +482,7 @@ evalCommand publish (Directive ShellCmd ('!':cmd)) state = wrapExecution state $
...
@@ -482,7 +482,7 @@ evalCommand publish (Directive ShellCmd ('!':cmd)) state = wrapExecution state $
if
exists
if
exists
then
do
then
do
setCurrentDirectory
directory
setCurrentDirectory
directory
return
$
Display
[]
return
$
mempty
else
else
return
$
displayError
$
printf
"No such directory: '%s'"
directory
return
$
displayError
$
printf
"No such directory: '%s'"
directory
cmd
->
do
cmd
->
do
...
@@ -616,7 +616,7 @@ evalCommand _ (Directive GetInfo str) state = safely state $ do
...
@@ -616,7 +616,7 @@ evalCommand _ (Directive GetInfo str) state = safely state $ do
return
EvalOut
{
return
EvalOut
{
evalStatus
=
Success
,
evalStatus
=
Success
,
evalResult
=
Display
[]
,
evalResult
=
mempty
,
evalState
=
state
,
evalState
=
state
,
evalPager
=
output
evalPager
=
output
}
}
...
@@ -786,7 +786,7 @@ evalCommand _ (Declaration decl) state = wrapExecution state $ do
...
@@ -786,7 +786,7 @@ evalCommand _ (Declaration decl) state = wrapExecution state $ do
-- Display the types of all bound names if the option is on.
-- Display the types of all bound names if the option is on.
-- This is similar to GHCi :set +t.
-- This is similar to GHCi :set +t.
if
not
$
useShowTypes
state
if
not
$
useShowTypes
state
then
return
$
Display
[]
then
return
mempty
else
do
else
do
-- Get all the type strings.
-- Get all the type strings.
types
<-
forM
nonDataNames
$
\
name
->
do
types
<-
forM
nonDataNames
$
\
name
->
do
...
@@ -815,7 +815,7 @@ evalCommand _ (ParseError loc err) state = do
...
@@ -815,7 +815,7 @@ evalCommand _ (ParseError loc err) state = do
hoogleResults
::
KernelState
->
[
Hoogle
.
HoogleResult
]
->
EvalOut
hoogleResults
::
KernelState
->
[
Hoogle
.
HoogleResult
]
->
EvalOut
hoogleResults
state
results
=
EvalOut
{
hoogleResults
state
results
=
EvalOut
{
evalStatus
=
Success
,
evalStatus
=
Success
,
evalResult
=
Display
[]
,
evalResult
=
mempty
,
evalState
=
state
,
evalState
=
state
,
evalPager
=
output
evalPager
=
output
}
}
...
@@ -877,7 +877,7 @@ doLoadModule name modName = flip gcatch unload $ do
...
@@ -877,7 +877,7 @@ doLoadModule name modName = flip gcatch unload $ do
setSessionDynFlags
flags
{
hscTarget
=
HscInterpreted
}
setSessionDynFlags
flags
{
hscTarget
=
HscInterpreted
}
case
result
of
case
result
of
Succeeded
->
return
$
Display
[]
Succeeded
->
return
mempty
Failed
->
return
$
displayError
$
"Failed to load module "
++
modName
Failed
->
return
$
displayError
$
"Failed to load module "
++
modName
where
where
unload
::
SomeException
->
Ghc
Display
unload
::
SomeException
->
Ghc
Display
...
...
src/IHaskell/Types.hs
View file @
3d38d41f
...
@@ -72,6 +72,13 @@ data Display = Display [DisplayData]
...
@@ -72,6 +72,13 @@ data Display = Display [DisplayData]
deriving
(
Show
,
Typeable
,
Generic
)
deriving
(
Show
,
Typeable
,
Generic
)
instance
Serialize
Display
instance
Serialize
Display
instance
Monoid
Display
where
mempty
=
Display
[]
ManyDisplay
a
`
mappend
`
ManyDisplay
b
=
ManyDisplay
(
a
++
b
)
ManyDisplay
a
`
mappend
`
b
=
ManyDisplay
(
a
++
[
b
])
a
`
mappend
`
ManyDisplay
b
=
ManyDisplay
(
a
:
b
)
a
`
mappend
`
b
=
ManyDisplay
[
a
,
b
]
-- | All state stored in the kernel between executions.
-- | All state stored in the kernel between executions.
data
KernelState
=
KernelState
data
KernelState
=
KernelState
{
getExecutionCounter
::
Int
,
{
getExecutionCounter
::
Int
,
...
...
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