Dhall
Dhall is a programming language specialized for configuration files.
function
let double = \(n : Natural) -> n * 2 in double 4
/config/box
{ userName = ""
, userEmail = ""
, userStacks = ["bos", "irisbox"]
, plugins = True
, mrRepoUrl = "git://github.com/CIRB/vcsh_mr_template.git"
}
{-# LANGUAGE DeriveGeneric #-}
data BoxConfig
= BoxConfig
{ _userName :: Text
, _userEmail :: Text
, _repos :: Vector Text (1)
, _eclipse :: Bool
} deriving (Generic, Show)
makeLenses ''BoxConfig
instance FromDhall BoxConfig
1 | Dhall uses vector instead of list |
main :: IO ()
main = do
box_config <- Dhall.input auto "./config/box"
configure (box_config^.userName) (box_config^.userEmail)
#! /usr/bin/env bash
readarray arr <<< $(dhall <<< '(./config/box ).repos' 2> /dev/null | jq -r 'join (" ")')
for s in ${arr}; do
echo "$s"
done