Commit graph

21 commits

Author SHA1 Message Date
Vincent Ambo
6468845255 chore: Change file layout to match repository instead of gist 2019-08-28 14:55:53 +01:00
Vincent Ambo
34a5917981 test: Add test for pattern matching on sum types 2019-08-28 14:37:00 +01:00
Vincent Ambo
cb45536124 test: Add a test to check that all types match the 'type'-type 2019-08-28 14:37:00 +01:00
Vincent Ambo
b622bcef7d feat: Introduce composable type errors and type parameter checking
This refactoring moves the type definitions into a recursively
evaluated attribute set, which makes it possibe to refer to types in
the definitions of other types.

This functionality is used to type-check some of the type parameters
passed in to other types. This is not yet done for all higher-order
types because the evaluation semantics of Nix make it less useful for
some cases.

Further the definition of a type itself is now a stricter
representation that works for all types except typed functions, which
allows for composable error messages.
2019-08-28 14:36:58 +01:00
Vincent Ambo
f6635fec98 feat: Add rough initial version of sum types
Sum types are represented as attribute sets with a single key in them.
2019-08-28 14:36:55 +01:00
Vincent Ambo
ef4ded7b98 docs: Add defun to README 2019-08-28 14:36:50 +01:00
Vincent Ambo
5949663fcd feat: Implement support for typing functions
The defun helper takes a type signature and a function and makes a
typed version. Because we can.
2019-08-28 14:36:47 +01:00
Vincent Ambo
1da22249bd test: Add some simple tests for type-checks
Does not currently test check failures, which makes it sort of not as
useful as you'd think.
2019-08-28 14:36:43 +01:00
Vincent Ambo
08116dbf51 chore: Add Google's copyright header 2019-08-28 14:36:39 +01:00
Vincent Ambo
bc130254bc docs: Update struct screenshot in README 2019-08-28 14:36:36 +01:00
Vincent Ambo
ca0cf11ca9 feat: Improved error message for missing struct fields 2019-08-28 14:36:33 +01:00
Vincent Ambo
4ebc069a3f docs: Add enum screenshot to README 2019-08-28 14:36:29 +01:00
Vincent Ambo
661e09daac feat: Add enum support 2019-08-28 14:36:25 +01:00
Vincent Ambo
2e576e10ab refactor: Gain back a few more lines 2019-08-28 14:36:20 +01:00
Vincent Ambo
2acdbb5009 refactor: Drop back to below 100 lines :) 2019-08-28 14:36:14 +01:00
Vincent Ambo
76f9b1638c feat: Add function type
It's not currently possible to check arguments for curried functions,
but there might be something on the horizon for attribute set
functions.
2019-08-28 14:36:11 +01:00
Vincent Ambo
103e0b4d25 feat: Add derivation type 2019-08-28 14:36:08 +01:00
Vincent Ambo
cb0d07fa30 docs: Fix image links (relative is not supported in gists) 2019-08-28 14:36:00 +01:00
Vincent Ambo
199254ba7a chore: Move screenshots into the gist 2019-08-28 14:35:56 +01:00
Vincent Ambo
040b719570 feat: Support better error messages for list/attrs element checks 2019-08-28 14:35:53 +01:00
Vincent Ambo
fe33a82a07 feat: Initial check-in of type system sketch 2019-08-28 14:35:41 +01:00