Git Product home page Git Product logo

Comments (13)

Gabriella439 avatar Gabriella439 commented on June 8, 2024 1

@PierreR: Actually, now that Dhall supports empty alternatives then that allows dhall-to-bash to render empty alternatives as strings

from dhall-haskell.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

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.

AnthonyJacob avatar AnthonyJacob commented on June 8, 2024

config example

from dhall-haskell.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

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.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

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.

docteurklein avatar docteurklein commented on June 8, 2024

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.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

@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:

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.

docteurklein avatar docteurklein commented on June 8, 2024

thanks :)

from dhall-haskell.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

@docteurklein: You're welcome! 🙂

from dhall-haskell.

ari-becker avatar ari-becker commented on June 8, 2024

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.

PierreR avatar PierreR commented on June 8, 2024

@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.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

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.

Gabriella439 avatar Gabriella439 commented on June 8, 2024

Here is the pull request to add enum support to dhall-to-bash: #873

from dhall-haskell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.