Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghc-external-splices-plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alp Mestanogullari
ghc-external-splices-plugin
Commits
622a4fca
Commit
622a4fca
authored
5 years ago
by
Alp Mestanogullari
Browse files
Options
Downloads
Patches
Plain Diff
create splices dir if missing
parent
d89a2220
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cabal.project
+2
-2
2 additions, 2 deletions
cabal.project
src/Splices/Plugin.hs
+7
-4
7 additions, 4 deletions
src/Splices/Plugin.hs
with
9 additions
and
6 deletions
cabal.project
+
2
−
2
View file @
622a4fca
...
...
@@ -5,5 +5,5 @@ package ghc-external-slices-plugin
ghc-options: -Wall -Werror
package test-pkg
-- ghc-options: -fplugin=Splices.Plugin -fplugin-opt=Splices.Plugin:save -fplugin-opt=Splices.Plugin:./
-- ghc-options: -fplugin=Splices.Plugin -fplugin-opt=Splices.Plugin:load -fplugin-opt=Splices.Plugin:./
-- ghc-options: -fplugin=Splices.Plugin -fplugin-opt=Splices.Plugin:save -fplugin-opt=Splices.Plugin:./
foobar
-- ghc-options: -fplugin=Splices.Plugin -fplugin-opt=Splices.Plugin:load -fplugin-opt=Splices.Plugin:./
foobar
This diff is collapsed.
Click to expand it.
src/Splices/Plugin.hs
+
7
−
4
View file @
622a4fca
...
...
@@ -9,16 +9,15 @@ import TcSplice
import
Splices.Data
-- TODO:
-- - optimise this by figuring out a way to only
-- read/write the .hs-splice files once
-- (set up an IORef before updating the hook
import
System.Directory
plugin
::
Plugin
plugin
=
defaultPlugin
{
dynflagsPlugin
=
\
opts
->
Just
(
registerHook
opts
)
}
registerHook
::
[
String
]
->
(
DynFlags
->
IO
DynFlags
)
registerHook
opts
=
\
dflags
->
do
createDirectoryIfMissing
True
(
modeDir
mode
)
return
$
dflags
{
hooks
=
(
hooks
dflags
)
{
runMetaHook
=
Just
$
splicesHook
mode
defaultRunMeta
}
...
...
@@ -107,6 +106,10 @@ readSpliceFor loc splicedata req =
data
Mode
=
Load
FilePath
|
Save
FilePath
deriving
(
Eq
,
Show
)
modeDir
::
Mode
->
FilePath
modeDir
(
Load
d
)
=
d
modeDir
(
Save
d
)
=
d
parseOpts
::
[
CommandLineOption
]
->
Mode
parseOpts
[
"save"
,
dir
]
=
Save
dir
parseOpts
[
"load"
,
dir
]
=
Load
dir
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment