Comments (13)
@PierreR: Actually, now that Dhall supports empty alternatives then that allows dhall-to-bash
to render empty alternatives as strings
from dhall-haskell.
Could you clarify what you need that the existing dhall-to-bash tool doesn't do? I'm not familiar with these configuration languages
from dhall-haskell.
from dhall-haskell.
The file you linked to is not a Bash script, though. It looks like a kakoune-specific configuration language, similar to vimscript
from dhall-haskell.
I'll close this for now because the scope of this task is not clear. Feel free to reopen if you still have questions
from dhall-haskell.
The title looked pretty clear to me! Even tho the linked example was totally not a bash example.
I'm curious as well to know how much can dhall-to-bash do to reduce my necessity to write bash.
Apart from the trivial [1, 2, 3]
examples, cause I think I can do that without dhall :)
I think that's one of the big problems with all the dhall-to-* tools out there: There is zero example that shows a non-trivial usage, only basic [1, 2, 3]
! People don't have problems generating list of integers in real life (and if they do, gnu-coretools seq 1 3
is pretty good at it).
Sorry for the rant, I'm very interested in the promise behind dhall, but for now I struggle to use it to solve real life problems.
from dhall-haskell.
@docteurklein: The answer is: not too much. dhall-to-bash
can't run Bash commands for you and even if you try to translate "pure" Bash commands to Dhall (like grep
/sed
) you won't have much luck because Dhall is a very restricted language where Text
values are opaque.
dhall
is most commonly used to replace large and repetitive YAML files for ops-related tooling. See:
- http://www.haskellforall.com/2019/01/dhall-year-in-review-2018-2019.html
- http://www.haskellforall.com/2019/02/dhall-survey-results-2019-2019.html
Those should give you some idea of what use cases that Dhall is focusing on.
I only implemented dhall-to-bash
because (A) somebody asked for it and (B) it was really easy to implement, but it is not really one of the core pillars of the Dhall ecosystem. The Dhall integrations with YAML/JSON and Ops tools like Kubernetes are the key integrations of the Dhall ecosystem and when Dhall gets Python/Go bindings then those will help as well.
from dhall-haskell.
thanks :)
from dhall-haskell.
@docteurklein: You're welcome! 🙂
from dhall-haskell.
I'm curious as well to know how much can dhall-to-bash do to reduce my necessity to write bash.
Apart from the trivial[1, 2, 3]
examples, cause I think I can do that without dhall :)
@docteurklein The purpose of the dhall-to-bash
tool has more to do with rounding out the experience for people who have already transitioned most of their configuration files to Dhall. To take a simple example, let's say I have a Dhall configuration file which defines Kubernetes-related configuration, including which Kubernetes namespace is being used. So if in a bash script, you would need to write:
kubectl --namespace=<what goes here?> get pods
you can use the namespace by something like:
eval $(dhall-to-bash --declare kubernetes_namespace <<< '(./Config.dhall).path.to.namespace')
kubectl --namespace=${kubernetes_namespace} get pods
You may note that you could replace dhall-to-bash
above with kubernetes_namespace=$(dhall-to-text <<< '(./Config.dhall).path.to.namespace')
and the example would work almost as nicely. The dhall-to-bash
tool mostly makes your life easier if you're extracting Optionals or Lists from a Dhall config into a Bash variable, which dhall-to-text
doesn't know how to do on it's own.
The dhall-to-bash
tool isn't for replacing the kubectl get pods
bit.
Hope this helps
from dhall-haskell.
@Gabriel439 FWIW I kind of find dhall-to-bash
more useful than dhall-kubernetes
so far probably because I don't quite see how dhall-kubernetes
is useful in the context of helm
.
On the other hand, if you wish to move out configuration out of bash scripts then in theory dhall-to-bash
seems to make quite a lot of sense. The only issue is the lack of support for basic dhall features such as union types.
I fear the problem with Yaml in the context of Ops tools is the fact that most of these configurations are not plain Yaml anymore (Ansible, Terraform, ...) and for all of these Yaml++ DSLs there are currently no dhall bindings at all ;-)
Anyway I have just written this because I still have hope that dhall-to-bash
fits a nice use case.
from dhall-haskell.
Also, I ran into another use case for dhall-to-bash
at work recently. We had a list of values that needed to be shared between a Haskell program and a Bash program. I stored the list of values in a Dhall configuration file so that I could read it into Bash using dhall-to-bash
and read it into Haskell using the dhall
Haskell package.
from dhall-haskell.
Here is the pull request to add enum support to dhall-to-bash
: #873
from dhall-haskell.
Related Issues (20)
- No documentation for accessing nested unions HOT 4
- Failure to Decode Expression with extended Builtin Function HOT 1
- Document the significance of `Nothing :: Maybe CharacterSet`
- Please report symlink contents for `Error: Missing file` HOT 2
- Error generating docs
- combine `let` bindings in `dhall format` HOT 1
- Support request for `aeson` 2.2 in `dhall` HOT 2
- dhall-to-yaml does not properly quote strings HOT 1
- Can not install dhall-lsp-server HOT 2
- Allow hnix 0.17
- Hackage build failed for dhall-toml-1.0.3
- Get back into Stackage Nightly with GHC 9.8 HOT 1
- Missing binaries in release HOT 1
- Hackage release for dhall-lsp-server HOT 1
- Build failure on GHC 9.8.1: 'Illegal invisible type variable binder'
- Report imports HOT 1
- dhall-docs: Prelude.head: empty list
- Suggesting a new construct for dealing with optional fields in Dhall defaults
- dhall-json bound on aeson can be relaxed
- Questions regarding the right strategy for upgrading to ghc-9.8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dhall-haskell.