Commit Graph

91 Commits

Author SHA1 Message Date
Edwin Brady
c260f6c90e Improve dot patterns
Allow matching rather than unification, as long as it doesn't solve any
metavariables on the way. I noticed a potential unification bug on the
way, forgetting to update whether holes are solved when unifying
argument lists.
2019-07-04 23:16:08 +01:00
Edwin Brady
6f5d3f5fef Unelaborate hole applications properly
This was left over from Blodwen (where it was also wrong :)) but the way
we apply metavariables now means we don't need to do anything fancy when
unelaborating them for pretty printing.
2019-07-03 15:31:46 +01:00
Edwin Brady
89c8314a0f Desugar pattern matching lambdas 2019-07-03 15:11:57 +01:00
Edwin Brady
0f56c239c2 Parse pattern matching lambda
This is now enough for Chapter 5 tests to work
2019-07-03 13:04:25 +01:00
Edwin Brady
e526badfe2 Delay case elaboration
This helps a few things because it delays elaboration of the block until
as much as possible is known about its type.

Also added a few libraries.
2019-07-02 16:53:41 +01:00
Edwin Brady
5eec46f6ce TypeDD chapter 4 tests 2019-07-01 21:35:19 +01:00
Edwin Brady
00514887c4 More base libraries
This has shown up a problem with 'case' which is hard to fix - since it
works by generating a function with the appropriate type, it's hard to
ensure that let bindings computational behaviour is propagated while
maintaining appropriate dependencies between arguments and keeping the
let so that it only evaluates once. So, I've disabled the computational
behaviour of 'let' inside case blocks. I hope this isn't a big
inconvenience (there are workarounds if it's ever needed, anyway).
2019-06-30 23:54:50 +01:00
Edwin Brady
577b68dd5a Make a start on Data.Vect 2019-06-30 17:38:40 +01:00
Edwin Brady
f2dff5cae4 Normalise holes in error messages
The solved holes may not outlive the error, so normalise before throwing
so that they can be displayed properly.
2019-06-30 17:23:19 +01:00
Edwin Brady
f37da6c5b7 Start adding tests for TypeDD book
Also detailing any changes needed to the code. Added primitives for
Doubles, and repl/replWith to get Chapter 2 code to work.
2019-06-30 15:50:58 +01:00
Edwin Brady
eddb23d108 Need to save postponed names in ttc too
Flag these when searching names for references
2019-06-30 12:49:11 +01:00
Edwin Brady
ae777b8dcb Add parameters blocks 2019-06-29 23:55:17 +01:00
Edwin Brady
2f4cdf857d Make typecase on -> work 2019-06-29 22:43:06 +01:00
Edwin Brady
17c862fe00 Add parse error tests from Blodwen 2019-06-29 21:37:30 +01:00
Edwin Brady
f9ea1ff329 Updating typecase, add tests 2019-06-29 21:32:19 +01:00
Edwin Brady
7aa8a71f8f Fix loading of hints, and add test
Need to add by full name, due to ordering of loading (the name it's
attached to may not be resolved yet!). This doesn't seem to cause any
performance problems but we can revisit if it does.
2019-06-29 20:51:48 +01:00
Edwin Brady
e463a2864a Add a couple more tests 2019-06-29 20:03:00 +01:00
Edwin Brady
a65d1efa38 Throw error if case type is not inferred
This is probably quite rare to want, but we could consider putting this
under a delayOnFailure
2019-06-29 19:39:11 +01:00
Edwin Brady
99dac56e1e Make sure matches are not too specific
i.e. if an argument has a polymorphic type, we shouldn't allow a
concrete type in its place
2019-06-29 19:28:04 +01:00
Edwin Brady
cda87a9c16 Fix coverage checker issue
Don't use the type of a scrutinee to restrict possible patterns, because
it might have been refined by a Rig0 argument that has a missing case.
Instead, generate all the possible cases and check that the generated
ones are impossible (there's no obvious change in performance)
2019-06-29 16:41:26 +01:00
Edwin Brady
9b44839c57 Add test for eta 2019-06-28 12:43:55 +01:00
Edwin Brady
e9a3167e2f Even more tests
Small change needed to fix one - assume given implicits which are of the
form x@_ arise from types. It's a bit of a hack but I don't think
there's any need for anything more complicated.
2019-06-27 20:19:00 +01:00
Edwin Brady
110a7461fc More tests from Blodwen 2019-06-27 19:33:02 +01:00
Edwin Brady
82ceedb84e Add linearity tests 2019-06-27 19:28:14 +01:00
Edwin Brady
b0cad15c65 Refine dot pattern rules
Only valid if unifying the pattern at the end doesn't solve any
metavariables. Also when elaborating applications of fromInteger etc to
constants on the LHS we need to be in expression mode, then reduce the
result later.
2019-06-27 19:16:33 +01:00
Edwin Brady
211de419bb Fix environments for nested names
This was a slight difference from Blodwen that wasn't accounted for -
there might be lets in the nested environment, so when building the
expanded application type, make sure we go under them
2019-06-27 15:26:18 +01:00
Edwin Brady
d053a18977 Set fresh name counter on loading Main ttc
Make sure this is the counter from the right namespace, or we might get
name clashes at the REPL
2019-06-27 14:47:47 +01:00
Edwin Brady
ce78abaaef Build and save references for metavars too
This wasn't necessary before, since we always inlined, but since we can
now postpone things longer and don't always inline until much later, we
need to know what names everything refers to earlier.
2019-06-27 09:01:59 +01:00
Edwin Brady
2cd81a9eb0 More tests moved over... 2019-06-25 21:50:48 +01:00
Edwin Brady
3eda2494bf Add error message tests 2019-06-25 21:46:28 +01:00
Edwin Brady
7b504e7a9e More Chez tests 2019-06-25 21:27:46 +01:00
Edwin Brady
69199639cf Fix Nat hack
And add chez scheme section to tests, with one initial test
2019-06-25 14:05:54 +01:00
Edwin Brady
bf64f843aa A bit more totality checking polish
Need to check for 'assert_total' in getRefs, and get Inf and Lazy the
right way around!
2019-06-25 12:57:49 +01:00
Edwin Brady
0b4f4ec46d Fix naming issue in totality checker
Also added a new test
2019-06-25 10:26:14 +01:00
Edwin Brady
5caa277cbe Fix some totality issues, add tests
These are related to the change in naming and metavariables, mostly
2019-06-25 00:42:52 +01:00
Edwin Brady
fb7190b337 Add first batch of totality checking tests 2019-06-24 18:14:07 +01:00
Edwin Brady
b1acceb870 Add a simple lazy Inf test 2019-06-24 18:08:32 +01:00
Edwin Brady
32583d608d More interface tests
and a small fix for the generation of method types which was okay for
Blodwen, but not here
2019-06-24 18:04:43 +01:00
Edwin Brady
e9514f3c22 Add first interface tests 2019-06-24 17:36:55 +01:00
Edwin Brady
e6292acdf0 Finish adding interactive tests from Blodwen
This involved implementing the 'TryWithImplicits' hack for allowing
unbound implicits in types with case blocks
2019-06-24 16:23:32 +01:00
Edwin Brady
1e2fcb8ccd Fix small error is as patterns
Also added new interactive test
2019-06-24 15:30:36 +01:00
Edwin Brady
7a47c9ae0c Add a couple of interactive tests 2019-06-24 15:16:49 +01:00
Edwin Brady
af9dc69c61 Add record tests from Blodwen 2019-06-24 12:44:34 +01:00
Edwin Brady
0a15c2cda1 Pay attention to visibility of names
Name lookup and search should ignore names which aren't visible (that
is, private names in another namespace)
2019-06-24 00:57:22 +01:00
Edwin Brady
67a43e0000 Check names are visible/public 2019-06-24 00:12:58 +01:00
Edwin Brady
9c902de5d1 Fix case tree compiler for coverage checking
We can't refine by a name in Rig0 because we can't assume it covers all
possibilities, so only refine by them at the end, at which point we
check that there's only one case left (otherwise we have to match on it,
which is not allowed for an erased thing)
2019-06-23 20:36:06 +01:00
Edwin Brady
6a72508e80 Eliminate cycles in auto search
This is important for, e.g. interfaces with parent constraints, so we
don't keep looping making the constraint bigger
2019-06-17 09:50:05 +01:00
Edwin Brady
f5a5d01274 Turn lets to lambdas in hole environments
This works better when lifting lemmas, and ensures that the type of
everything will be shown and not normalised away
2019-06-16 23:10:32 +01:00
Edwin Brady
1be12c7f72 Block reduction of private/export names 2019-06-15 16:10:01 +01:00
Edwin Brady
772b098de0 The Prelude type checks! 2019-06-13 13:23:21 +01:00