% It's traverse! % Clément Delafargue % DDDDD 2020-05-15
| #!/usr/bin/env stack | |
| -- stack --resolver lts-14.20 --install-ghc ghci --package containers --package mtl --package optics | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE DerivingStrategies #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE NamedFieldPuns #-} | |
| {-# LANGUAGE OverloadedLabels #-} |
| /* | |
| Data format: the triangles are represented by a matrix. Each odd line is shifted down by 1/2. | |
| 0 represents nothing, 7 represents a full triangle. | |
| [[7,7,7], [7,0,0]] translates to: | |
| |\ |\ | |
| | \ | \ |
There's always a point where we are tempted to replace config files (json, toml, yaml), with just code. It's handy, we get structure and abstraction, we can have little helper functions, proper comments (I'm looking at you, JSON). It's especially useful when the config is verbose, or very common. The flip side of going the config as code way, is that we lose a lot: updating config is updating the application itself (not very 12 factor compliant, and not user-friendly as well when using compiled languages). Worse, some arbitrary side effects can sneak into your configuration step. Another issue is that it becomes really hard to read or analyze config files without launching the application itself (bye linters, bye dependency checkers, bye organization-wide metrics). If you want to do that properly, it means building a way to output generated configuration, building a sandbox to run the application, and a few other unsavory contraptions.
All this issues stem from two things:
we have removed the boundary
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE DeriveAnyClass #-} | |
| {-# LANGUAGE DeriveGeneric #-} | |
| {-# LANGUAGE DerivingStrategies #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE RecordWildCards #-} | |
| {-# LANGUAGE TemplateHaskell #-} |
I hereby claim:
- I am divarvel on github.
- I am clementd (https://keybase.io/clementd) on keybase.
- I have a public key whose fingerprint is 78D3 430C 4600 7020 9F7A B0A2 6BFE 863C 2684 AD09
To claim this, I am signing this object:
| self: super: | |
| { | |
| kakoune = super.kakoune.overrideAttrs ( | |
| drv: rec { | |
| name = "kakoune-perso"; | |
| version = "divarvel"; | |
| src = super.fetchFromGitHub { | |
| repo = "kakoune"; | |
| owner = "divarvel"; | |
| rev = "show-trailing-whitespace"; |
| define-command -docstring ":edit with a fuzzy search" fuzzy-edit %{ | |
| evaluate-commands %sh{ | |
| FILE=$(rg --files | rofi -dmenu -i -p 'file'); | |
| [[ -n "$FILE" ]] && printf "edit %s\\n" $FILE | |
| } | |
| } | |
| define-command -docstring ":buffer with a fuzzy search " fuzzy-buffer %{ | |
| evaluate-commands %sh{ | |
| BUFFER=$(printf "%s\\n" "${kak_buflist}" | rofi -dmenu -i -sep ' ' -p 'buffer'); |
| ¬ cabal-rtsopts cat cabal-rtsopts.cabal | |
| name: cabal-rtsopts | |
| version: 0.1.0.0 | |
| -- synopsis: | |
| -- description: | |
| homepage: https://github.com/divarvel/cabal-rtsopts#readme | |
| license: BSD3 | |
| license-file: LICENSE | |
| author: Clément Delafargue | |
| maintainer: [email protected] |
| https://www.clever-cloud.com/doc/rust/rust/ |