add dictionary in dhall
continuous-integration/drone/push Build was killed Details

This commit is contained in:
Cadey Ratio 2020-05-17 17:23:39 -04:00
parent b028bb3acd
commit 48b5d25956
13 changed files with 147 additions and 0 deletions

View File

@ -52,3 +52,19 @@ steps:
pull: always
commands:
- cd tools && cargo test
---
kind: pipeline
name: dictionary verification
workspace:
base: /lewa
steps:
- name: build dictionary files
image: "monacoremo/nix:2020-04-05-05f09348-circleci"
pull: always
commands:
- nix-env -if ./nix/dhall.nix
- cd words
- dhall ./dictionary.dhall

24
nix/dhall-json.nix Normal file
View File

@ -0,0 +1,24 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.stdenv.mkDerivation rec {
name = "dhall-json-simple";
src = pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.32.0/dhall-json-1.6.4-x86_64-linux.tar.bz2";
sha256 = "1qd2nfmwgdmffwjmvcs2cjm1jkqkv7mi8hf3lcvsx3gjcc2mv3jw";
};
installPhase = ''
mkdir -p $out/bin
DHALL_TO_JSON=$out/bin/dhall-to-json
DHALL_TO_YAML=$out/bin/dhall-to-yaml
JSON_TO_DHALL=$out/bin/json-to-dhall
install -D -m555 -T dhall-to-json $DHALL_TO_JSON
install -D -m555 -T dhall-to-yaml $DHALL_TO_YAML
install -D -m555 -T json-to-dhall $JSON_TO_DHALL
mkdir -p $out/etc/bash_completion.d/
$DHALL_TO_JSON --bash-completion-script $DHALL_TO_JSON > $out/etc/bash_completion.d/dhall-to-json-completion.bash
$DHALL_TO_YAML --bash-completion-script $DHALL_TO_YAML > $out/etc/bash_completion.d/dhall-to-yaml-completion.bash
$JSON_TO_DHALL --bash-completion-script $JSON_TO_DHALL > $out/etc/bash_completion.d/json-to-dhall-completion.bash
'';
}

18
nix/dhall.nix Normal file
View File

@ -0,0 +1,18 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.stdenv.mkDerivation rec {
name = "dhall-simple";
src = pkgs.fetchurl {
url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.32.0/dhall-1.32.0-x86_64-linux.tar.bz2";
sha256 = "0p7j7msik1sgg287yrkp2si2fvw8lrsxy3lhc2xaxxa8d9y9k5aq";
};
installPhase = ''
mkdir -p $out/bin
DHALL=$out/bin/dhall
install -D -m555 -T dhall $DHALL
mkdir -p $out/etc/bash_completion.d/
$DHALL --bash-completion-script $DHALL > $out/etc/bash_completion.d/dhall-completion.bash
'';
}

View File

@ -5,6 +5,8 @@ let
"https://github.com/nix-community/NUR/archive/master.tar.gz") {
inherit pkgs;
};
dhall = pkgs.callPackage ./nix/dhall.nix { };
dhall-json = pkgs.callPackage ./nix/dhall-json.nix { };
dyson = pkgs.callPackage ./nix/dyson.nix { };
tex = pkgs.callPackage ./nix/texlive.nix { };
in pkgs.mkShell {
@ -23,6 +25,15 @@ in pkgs.mkShell {
# preview
nur.repos.xe.zathura
# dhall
dhall
dhall-json
# deno
nur.repos.xe.deno
nodePackages.typescript
nodePackages.typescript-language-server
# rust
cargo
cargo-watch

13
words/dictionary.dhall Normal file
View File

@ -0,0 +1,13 @@
let ContentWord = ./types/ContentWord.dhall
let ParticleWord = ./types/ParticleWord.dhall
in { rootWords =
[ ./roots/lewa.dhall
, ./roots/madsa.dhall
, ./roots/qate.dhall
, ./roots/spalo.dhall
, ./roots/zasko.dhall
]
, particles = [] : List ParticleWord.Type
}

7
words/roots/lewa.dhall Normal file
View File

@ -0,0 +1,7 @@
let ContentWord = ../types/ContentWord.dhall
in ContentWord::{
, word = "l'ewa"
, gloss = "language"
, definition = "is a language"
}

7
words/roots/madsa.dhall Normal file
View File

@ -0,0 +1,7 @@
let ContentWord = ../types/ContentWord.dhall
in ContentWord::{
, word = "madsa"
, gloss = "eat"
, definition = "eats/is eating/to eat"
}

7
words/roots/qate.dhall Normal file
View File

@ -0,0 +1,7 @@
let ContentWord = ../types/ContentWord.dhall
in ContentWord::{
, word = "qa'te"
, gloss = "fast"
, definition = "is fast/rapid in rate"
}

3
words/roots/spalo.dhall Normal file
View File

@ -0,0 +1,3 @@
let ContentWord = ../types/ContentWord.dhall
in ContentWord::{ word = "spalo", gloss = "apple", definition = "is an apple" }

7
words/roots/zasko.dhall Normal file
View File

@ -0,0 +1,7 @@
let ContentWord = ../types/ContentWord.dhall
in ContentWord::{
, word = "zasko"
, gloss = "plant"
, definition = "is a plant/is vegetation"
}

View File

@ -0,0 +1,5 @@
{ Type =
{ word : Text, gloss : Text, definition : Text, usageExamples : List Text }
, default =
{ word = "", gloss = "", definition = "", usageExamples = [] : List Text }
}

View File

@ -0,0 +1,15 @@
{ Type =
{ word : Text
, gloss : Text
, definition : Text
, family : Text
, usageExamples : List Text
}
, default =
{ word = ""
, gloss = ""
, definition = ""
, family = ""
, usageExamples = [] : List Text
}
}

View File

@ -0,0 +1,14 @@
let ContentWord = ../types/ContentWord.dhall
let render
: ContentWord.Type → Text
= λ(word : ContentWord.Type) →
''
### ${word.word}
*${word.gloss}*
${word.definition}
''
in render