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
f42f8645
Commit
f42f8645
authored
May 27, 2015
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More debug info
parent
fad19c4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
Evaluate.hs
src/IHaskell/Eval/Evaluate.hs
+23
-3
No files found.
src/IHaskell/Eval/Evaluate.hs
View file @
f42f8645
{-# LANGUAGE NoImplicitPrelude, DoAndIfThenElse, NoOverloadedStrings, TypeSynonymInstances, GADTs, CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
{- | Description : Wrapper around GHC API, exposing a single `evaluate` interface that runs
a statement, declaration, import, or directive.
...
...
@@ -22,6 +23,7 @@ import qualified Data.ByteString as BS
import
qualified
Data.ByteString.Lazy
as
LBS
import
qualified
Data.ByteString.Char8
as
CBS
import
Data.Typeable.Internal
import
Control.Concurrent
(
forkIO
,
threadDelay
)
import
Prelude
(
putChar
,
head
,
tail
,
last
,
init
,
(
!!
))
import
Data.List.Utils
...
...
@@ -337,11 +339,29 @@ evaluate kernelState code output = do
storeItCommand
execCount
=
Statement
$
printf
"let it%d = it"
execCount
extractValue
::
Typeable
a
=>
String
->
Interpreter
a
extractValue
::
forall
a
.
Typeable
a
=>
String
->
Interpreter
a
extractValue
expr
=
do
compiled
<-
dynCompileExpr
expr
case
fromDynamic
compiled
of
Nothing
->
error
"Expecting value!"
Nothing
->
let
expectedTypeRep
=
typeOf
(
undefined
::
a
)
actualTypeRep
=
dynTypeRep
compiled
TypeRep
fing1
tycon1
subs1
=
expectedTypeRep
TypeRep
fing2
tycon2
subs2
=
actualTypeRep
in
error
$
concat
[
"Expecting value of type "
,
show
expectedTypeRep
,
" but got value of type "
,
show
actualTypeRep
,
"
\n
. Fingerprint expected "
,
show
fing1
,
" but gotten "
,
show
fing2
,
" with expected tycon "
,
show
(
tyConPackage
tycon1
,
tyConModule
tycon1
,
tyConName
tycon1
,
tyConHash
tycon1
)
,
" but gotten "
,
show
(
tyConPackage
tycon2
,
tyConModule
tycon2
,
tyConName
tycon2
,
tyConHash
tycon2
)
]
Just
result
->
return
result
safely
::
KernelState
->
Interpreter
EvalOut
->
Interpreter
EvalOut
...
...
@@ -1268,4 +1288,4 @@ displayError :: ErrMsg -> Display
displayError
msg
=
Display
[
plain
.
typeCleaner
$
msg
,
html
$
formatError
msg
]
mono
::
String
->
String
mono
=
printf
"<span class='mono'>%s</span>"
\ No newline at end of file
mono
=
printf
"<span class='mono'>%s</span>"
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