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
f804ec1a
Commit
f804ec1a
authored
Jan 23, 2015
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempting to fix #301
parent
1693d800
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
18 deletions
+39
-18
Util.hs
src/IHaskell/Eval/Util.hs
+39
-18
No files found.
src/IHaskell/Eval/Util.hs
View file @
f804ec1a
...
...
@@ -19,28 +19,32 @@ module IHaskell.Eval.Util (
doc
,
)
where
import
ClassyPrelude
import
ClassyPrelude
-- GHC imports.
import
DynFlags
import
FastString
import
GHC
import
GhcMonad
import
HsImpExp
import
HscTypes
import
InteractiveEval
import
Module
import
Outputable
import
Packages
import
RdrName
import
NameSet
import
Name
import
PprTyThing
import
DynFlags
import
FastString
import
GHC
import
GhcMonad
import
HsImpExp
import
HscTypes
import
InteractiveEval
import
Module
import
Outputable
import
Packages
import
RdrName
import
NameSet
import
Name
import
PprTyThing
import
InstEnv
(
ClsInst
(
..
))
import
Unify
(
tcMatchTys
)
import
VarSet
(
mkVarSet
)
import
qualified
Pretty
import
Control.Monad
(
void
)
import
Data.Function
(
on
)
import
Data.String.Utils
(
replace
)
import
Control.Monad
(
void
)
import
Data.Function
(
on
)
import
Data.String.Utils
(
replace
)
import
Data.List
(
nubBy
)
-- | A extension flag that can be set or unset.
data
ExtFlag
...
...
@@ -197,9 +201,26 @@ evalImport imports = do
evalDeclarations
::
GhcMonad
m
=>
String
->
m
[
String
]
evalDeclarations
decl
=
do
names
<-
runDecls
decl
cleanUpDuplicateInstances
flags
<-
getSessionDynFlags
return
$
map
(
replace
":Interactive."
""
.
showPpr
flags
)
names
cleanUpDuplicateInstances
::
GhcMonad
m
=>
m
()
cleanUpDuplicateInstances
=
modifySession
$
\
hscEnv
->
let
-- Get all class instancesj
ic
=
hsc_IC
hscEnv
(
clsInsts
,
famInsts
)
=
ic_instances
ic
-- Remove duplicates
clsInsts'
=
nubBy
instEq
clsInsts
in
hscEnv
{
hsc_IC
=
ic
{
ic_instances
=
(
clsInsts'
,
famInsts
)
}
}
where
instEq
::
ClsInst
->
ClsInst
->
Bool
instEq
ClsInst
{
is_tvs
=
tpl_tvs
,
is_tys
=
tpl_tys
}
ClsInst
{
is_tys
=
tpl_tys'
}
=
let
tpl_tv_set
=
mkVarSet
tpl_tvs
in
isJust
$
tcMatchTys
tpl_tv_set
tpl_tys
tpl_tys'
-- | Get the type of an expression and convert it to a string.
getType
::
GhcMonad
m
=>
String
->
m
String
getType
expr
=
do
...
...
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