Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghcup-hs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Haskell
ghcup-hs
Commits
2e3dceec
Commit
2e3dceec
authored
4 years ago
by
Arjun Kathuria
Browse files
Options
Downloads
Patches
Plain Diff
abstracts out getting ghcup conf file path
parent
07fb04bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!101
[WIP] Feature "nuke"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/GHCup/Utils/Dirs.hs
+7
-3
7 additions, 3 deletions
lib/GHCup/Utils/Dirs.hs
with
7 additions
and
3 deletions
lib/GHCup/Utils/Dirs.hs
+
7
−
3
View file @
2e3dceec
...
...
@@ -26,6 +26,7 @@ module GHCup.Utils.Dirs
,
parseGHCupGHCDir
,
relativeSymlink
,
withGHCupTmpDir
,
getConfigFilePath
)
where
...
...
@@ -201,13 +202,16 @@ getDirs = do
--[ GHCup files ]--
-------------------
getConfigFilePath
::
(
MonadIO
m
)
=>
m
FilePath
getConfigFilePath
=
do
confDir
<-
liftIO
ghcupConfigDir
pure
$
confDir
</>
"config.yaml"
ghcupConfigFile
::
(
MonadIO
m
)
=>
Excepts
'
[
JSONError
]
m
UserSettings
ghcupConfigFile
=
do
confDir
<-
liftIO
ghcupConfigDir
let
file
=
confDir
</>
"config.yaml"
contents
<-
liftIO
$
handleIO'
NoSuchThing
(
\
_
->
pure
Nothing
)
$
Just
<$>
BS
.
readFile
file
filepath
<-
getConfigFilePath
contents
<-
liftIO
$
handleIO'
NoSuchThing
(
\
_
->
pure
Nothing
)
$
Just
<$>
BS
.
readFile
filepath
case
contents
of
Nothing
->
pure
defaultUserSettings
Just
contents'
->
lE'
JSONDecodeError
.
first
show
.
Y
.
decodeEither'
$
contents'
...
...
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