Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
haskell
pandoc-dhall-decoder
Commits
d269bf47
Commit
d269bf47
authored
3 years ago
by
locallycompact
Browse files
Options
Download
Email Patches
Plain Diff
Fix styling
parent
6a0c303b
Pipeline
#518
passed with stages
in 16 minutes and 58 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
src/Text/Pandoc/Dhall.hs
src/Text/Pandoc/Dhall.hs
+15
-15
No files found.
src/Text/Pandoc/Dhall.hs
View file @
d269bf47
module
Text.Pandoc.Dhall
where
import
Data.Either.Validation
import
Data.Text
as
T
import
qualified
Dhall
as
D
import
Text.Pandoc
import
Data.Text
as
T
-- | Decode a Pandoc value.
pandocDecoder
::
(
ReaderOptions
->
Text
->
PandocPure
Pandoc
)
->
ReaderOptions
->
D
.
InputNormalizer
->
D
.
Decoder
Pandoc
pandocDecoder
f
ropts
opts
=
D
.
Decoder
{
D
.
extract
=
extractDoc
,
D
.
expected
=
expectedDoc
}
where
docDecoder
::
D
.
Decoder
Text
docDecoder
=
D
.
autoWith
opts
D
.
Decoder
{
D
.
extract
=
extractDoc
,
D
.
expected
=
expectedDoc
}
where
docDecoder
::
D
.
Decoder
Text
docDecoder
=
D
.
autoWith
opts
extractDoc
expression
=
case
D
.
extract
docDecoder
expression
of
Success
x
->
case
runPure
(
f
ropts
x
)
of
Left
exception
->
D
.
extractError
(
T
.
pack
$
show
exception
)
Right
path
->
Success
path
Failure
e
->
Failure
e
extractDoc
expression
=
case
D
.
extract
docDecoder
expression
of
Success
x
->
case
runPure
(
f
ropts
x
)
of
Left
exception
->
D
.
extractError
(
T
.
pack
$
show
exception
)
Right
path
->
Success
path
Failure
e
->
Failure
e
expectedDoc
=
D
.
expected
docDecoder
expectedDoc
=
D
.
expected
docDecoder
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help