https://git.sr.ht/~singpolyma/dhall-xml-ruby
This is pre-release and uses an unreleased (though will be out soon) version of the dhall
gem. It also cannot be installed as described in the README yet but for now just clone the repo and run bundle install
then you can use bundle exec ruby -Ilib/ bin/dhall-to-xml
and so. The README describes how things will be when released as a gem (probably first release shortly after next dhall-ruby
release after the soon-coming dhall-lang
release).
$ echo 'https://github.com/dhall-lang/dhall-lang/raw/master/Prelude/XML/text "<&>"' | dhall-to-xml
<&>
$ echo '<root><child id="1">hello</child></root>' | xml-to-dhall | dhall decode
λ(_ : Type)
→ λ ( _
: { element :
{ attributes :
List { mapKey : Text, mapValue : Text }
, content :
List _
, name :
Text
}
→ _@1
, text :
Text → _@1
}
)
→ _.element
{ attributes =
[] : List { mapKey : Text, mapValue : Text }
, content =
[ _.element
{ attributes =
[ { mapKey = "id", mapValue = "1" } ]
, content =
[ _.text "hello" ]
, name =
"child"
}
]
, name =
"root"
}