Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
horizon-platform
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Théophile Choutri
horizon-platform
Commits
b75ffcd7
There was an error fetching the commit references. Please try again later.
Commit
b75ffcd7
authored
2 years ago
by
Daniel Firth
Browse files
Options
Downloads
Patches
Plain Diff
ShellRC: print dhall ast
parent
81a28c3b
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shell/ShellRC.hs
+31
-0
31 additions, 0 deletions
shell/ShellRC.hs
with
31 additions
and
0 deletions
shell/ShellRC.hs
+
31
−
0
View file @
b75ffcd7
...
...
@@ -11,6 +11,8 @@
module
ShellRC
where
import
Dhall.Core
import
Dhall.Src
import
Brick
(
BrickEvent
(
VtyEvent
),
EventM
,
Padding
(
..
),
ViewportType
(
Vertical
),
Widget
,
...
...
@@ -33,6 +35,7 @@ import qualified Data.Aeson.KeyMap as A
import
qualified
Data.Aeson.Lens
as
L
import
qualified
Data.ByteString
as
B
import
Data.ByteString.Lazy.UTF8
as
BLU
import
qualified
Dhall.Map
as
DMap
import
qualified
Data.ByteString.Lazy.UTF8
as
BU
import
Data.Kind
(
Type
)
import
qualified
Data.List
...
...
@@ -246,6 +249,34 @@ readDerivation (MkPackagesDir d) (MkName x) = do
q
<-
B
.
readFile
$
toFilePath
j
pure
$
T
.
decodeUtf8Lenient
q
callHackageLit
::
Expr
Src
Import
callHackageLit
=
Field
"H"
(
FieldSelection
Nothing
"callHackage"
Nothing
)
callGitLit
::
Expr
Src
Import
callGitLit
=
Field
"H"
(
FieldSelection
Nothing
"callGit"
Nothing
)
callHackageApp
::
Name
->
Version
->
Expr
Src
Import
callHackageApp
(
MkName
x
)
(
MkVersion
v
)
=
App
(
App
callHackageLit
(
TextLit
$
Chunks
[]
x
))
(
TextLit
$
Chunks
[]
v
)
callGitApp
::
Repo
->
Revision
->
Expr
Src
Import
callGitApp
(
MkRepo
(
MkUrl
x
))
(
MkRevision
v
)
=
App
(
App
callGitLit
(
TextLit
$
Chunks
[]
x
))
(
TextLit
$
Chunks
[]
v
)
f
::
Name
->
HaskellPackage
->
(
Name
,
RecordField
Src
Import
)
f
x
k
=
case
source
k
of
FromHackage
(
MkHackageSource
n
v
)
->
(
x
,
RecordField
Nothing
(
callHackageApp
n
v
)
Nothing
Nothing
)
FromGit
(
MkGitSource
n
v
_
)
->
(
x
,
RecordField
Nothing
(
callGitApp
n
v
)
Nothing
Nothing
)
g
::
IO
(
Expr
Src
Import
)
g
=
do
x
<-
Dhall
.
inputFile
@
HorizonExport
Dhall
.
auto
"horizon.dhall"
pure
$
h
x
h
::
HorizonExport
->
Expr
Src
Import
h
(
MakePackageSet
(
MkPackageSetExportSettings
d
_
(
MkPackageSet
_
(
MkPackageList
(
Map
.
toList
->
ys
)))))
=
RecordLit
$
DMap
.
fromList
$
map
((
\
(
MkName
x
,
y
)
->
(
x
,
y
))
.
uncurry
f
)
ys
go
::
IO
()
go
=
do
x
<-
Dhall
.
inputFile
@
HorizonExport
Dhall
.
auto
"horizon.dhall"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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