recursion-schemes
jsonnet
| recursion-schemes | jsonnet | |
|---|---|---|
| 21 | 54 | |
| 350 | 7,429 | |
| 0.0% | 0.6% | |
| 2.8 | 8.6 | |
| 5 months ago | 5 months ago | |
| Haskell | Jsonnet | |
| BSD 2-clause "Simplified" License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
recursion-schemes
- Typesafe recursion... in TypeScript??
I've got another article planned where I talk through exactly why and how this function works, but it's worth noting that I didn't come up with it myself -- I simply ported it from the Haskell library that first introduced this technique.
- -❄️- 2023 Day 4 Solutions -❄️-
Reasonably proud of my part 2 solution, although would like to try using a recursion scheme rather than unstructured recursion:
- Interactive animations
Yeah, that project is pretty much at the bottom of my list, unfortunately. My top projects these days are mgmt, klister, recursion-schemes, and hint... And that's already too much!
- Science of Recursion
In a programming context, recursion schemes can be used to write recursive (or corecursive) functions, by automating/abstracting away the common boilerplate part of actually doing the recursion. They take the form of polymorphic higher-order functions, which can be imported from a library like this classic one.
- Is there a way to avoid call overhead?
Maybe I didn't link the best post. It is unfortunately the only one I know that uses Rust. If you are able to read Haskell, the documentation for the recursion-schemes package might be a better resource?
- Ah yes I love arrays with a length of infinity!!!
Writing something as a type of fold over an infinite sequence is nicer than using recursion directly in my opinion. See: https://hackage.haskell.org/package/recursion-schemes
- Tips on mastering recursion and trees and shit?
Consider recursion schemes! It let's you separate the logic of how your recursion is structured on your data, and the logic of what you're doing on each recursion stage. So e.g. you can write the core logic of a recursive linked list summation as just fun x accum -> x + accum, and then you just find the appropriate recursion scheme to pipe the list values into x and handle recursing to build accum (a catamorphism in this case)
- So you come across an undocumented library…
It's a pretty complicated bug, documented in details at https://github.com/recursion-schemes/recursion-schemes/issues/50
- Beautiful ideas in programming: generators and continuations
It’s also trivial and easy in Haskell — you just need an instance of `Foldable` or `Traversable` on your collection, and then you can fold or traverse it in a configurable way. Or for recursive structures, use https://hackage.haskell.org/package/recursion-schemes. Or even just pass a traversal function as an argument for maximum flexibility.
- fromMaybe is Just a fold
https://hackage.haskell.org/package/recursion-schemes is the "normal" library for this type of generalized folding. It even contains Base instances for Maybe and Either.
jsonnet
- YAMLpp is dynamic,self-generating YAML
OK, what we can do now? Use a preprocessing language guaranteed to produce valid syntax, like Jsonnet for json? That wil work, for sure. However, you have now a friction problem: it's new file format that requires implementing its own toolchain (Jsonnet is not json, so editor add-ons, parsers, interpreters, libraries, etc.) and you will need to drive the team through the learning curve of a language with its own syntax and semantic. Will you implement a serious project... or will you have a coffee break at that point, and keep doing things the same old way?
- Levels of Configuration Languages
https://jsonnet.org/ I never heard of this before. This seems like the JSON I wish I really had. Of course at some point you could just use JavaScript.
- Standard ML idiosyncrasies
I've been reading the book Modern Compiler Implementation in ML lately. It's been helpful to brush up on some concepts while developing Tsonnet (my typed-aspiring Jsonnet flavor) and I hope to learn a ton more. However, I'm growing dissatisfied with some details -- not specifically the book, but the choice of the development environment.
- jsonnet VS rcl - a user suggested alternative 2 projects | 15 Mar 2025
- Tsonnet, a humble beginning
For the past 2 years, I've been working extensively with Jsonnet, a configuration language that augments JSON and helps eliminate repetition in our config files. It has its limits (many by design), which keeps the language simple to use. But there's one thing that keeps nagging at me when I'm deep in the code: what's the shape of the input or output of this function? And wouldn't it be great if we could type objects and completely ditch those validators checking value types? Having a compiler handle all that would be sweet. I'm not alone here – I've talked to plenty of folks who'd love this feature too.
- Kubernetes 101: Introduction
Kubernetes does not provide or require a configuration language like Jsonnet, as it provides a declarative API that can be used with different types of declarative specifications.
- A Reasonable Configuration Language
jsonnet[1] and kapitan[2] are the tools I currently use. Their learning curve is not optimal (and I tried to contribute to smoothen it with a jsonnet course[3] and a 'get started wit kapitan' blog post[4]), but once used to it it's hard to do without, and their combination makes them even more useful (esp. if you deploy K8s).
In Ruud's case, Jsonnet might have been worth looking at as Hashicorp tools can be configured with json in addition to HCL. But that would have been less fun I guess ;-)
I hope for Ruud it finds its niche, there's quite some competition in this field!
1: https://jsonnet.org/
- Pkl, a Programming Language for Configuration
Kubernetes config is a decent example. I had ChatGPT generate a representative silly example -- the content doesn't matter so much as the structure:
https://gist.github.com/cstrahan/528b00cd5c3a22e3d8f057bb1a7...
Now consider 100s (if not 1000s) of such files.
I haven't given Pkl an in depth look yet, but I can say that the Industry Standard™ of "simple YAML" + string substitution (with delicate, error prone indentation -- since YAML is indentation sensitive) is easily beat by any of:
- https://jsonnet.org/
- https://nickel-lang.org/
- https://nixos.org/manual/nix/stable/language/index.html
- https://dhall-lang.org/
- (insert many more here, probably including Pkl)
- Introduction to Jsonnet: The YAML/JSON templating language
jsonnet cli: link
- 10 Ways for Kubernetes Declarative Configuration Management
Jsonnet: A data template language implemented in C++, suitable for application and tool developers, can generate configuration data and organize, simplify and manage large configurations without side effects.
What are some alternatives?
distributed-process-platform - DEPRECATED (Cloud Haskell Platform) in favor of distributed-process-extras, distributed-process-async, distributed-process-client-server, distributed-process-registry, distributed-process-supervisor, distributed-process-task and distributed-process-execution
json5 - JSON5 — JSON for Humans
unliftio - The MonadUnliftIO typeclass for unlifting monads to IO
cue - The home of the CUE language! Validate and define text-based and dynamic configuration
machines - Networks of composable stream transducers
cdk8s - Define Kubernetes native apps and abstractions using object-oriented programming