refactor: Drop back to below 100 lines :)

This commit is contained in:
Vincent Ambo 2019-08-08 13:14:52 +01:00
parent 76f9b1638c
commit 2acdbb5009

View file

@ -3,13 +3,10 @@
# #
# All types (should) compose as expected. # All types (should) compose as expected.
# #
# TODO: # TODO(tazjin): enums?
# - enums?
{ toPretty ? ((import <nixpkgs> {}).lib.generators.toPretty {}) }: { toPretty ? ((import <nixpkgs> {}).lib.generators.toPretty {}) }:
# Checks are simply functions of the type `a -> bool` which check
# whether `a` conforms to the specification.
with builtins; let with builtins; let
# Internal utilities: # Internal utilities:
typeError = type: val: typeError = type: val:
@ -32,9 +29,8 @@ with builtins; let
typeSet = foldl' (s: t: s // (if t ? "name" then { "${t.name}" = t; } else t)) {}; typeSet = foldl' (s: t: s // (if t ? "name" then { "${t.name}" = t; } else t)) {};
# Struct checker implementation # Struct checks performed:
# #
# Checks performed:
# 1. All existing fields match their types # 1. All existing fields match their types
# 2. No non-optional fields are missing. # 2. No non-optional fields are missing.
# 3. No unexpected fields are in the struct. # 3. No unexpected fields are in the struct.