Commit Graph

517 Commits

Author SHA1 Message Date
Edwin Brady
d47d495744 Free standing case blocks return ()
Fixes #116. This is the solution Idris 1 took, and while it is a special
case, the syntax does make it explicit (in a way) that the result of the
case is unused - if you mean something other than (), you must now say
so!
2020-06-07 22:49:19 +01:00
Nick Drozd
85c1e62587 Update test 2020-06-07 14:17:17 -05:00
Nick Drozd
5665cfab21 Copy over more Nat proofs 2020-06-07 12:19:32 -05:00
Nick Drozd
4292d735eb Simplify Nat proofs
These changes are strictly nonfunctional.
2020-06-07 12:19:32 -05:00
Nikita Vilunov
018c17b69a Add :let test 2020-06-07 16:40:45 +03:00
Edwin Brady
6898965a56
Merge pull request #249 from edwinb/refl-names
Reflect 'display names' and record field names
2020-06-07 12:44:03 +01:00
Edwin Brady
d5e4dec119 Reflect 'display names' and record field names
These arise in interface declarations (to give a nicer way of displaying
auto generated names) and for record fields.
2020-06-07 11:51:09 +01:00
Nikita Vilunov
d36e804012 ":let" command for REPL 2020-06-07 12:53:01 +03:00
Mark Barbone
793184a777
Remove thin functions; replace with insertNames 2020-06-07 01:10:06 -04:00
MarcelineVQ
6993c6df6b add parens for some TTImp Shows
helps with readability since these, especially named-IPi, come up a lot
didn't change everything that could need it like PiInfo or BindMode
PiInfo rarely has DefImplicit (so far) and BindMode hasn't come up a lot (so far)
reduced indentation for TTImp Show implementation
2020-06-06 17:16:43 -07:00
Edwin Brady
a0d9ce201e
Merge pull request #247 from edwinb/evaluator-fix
More explicitness in evaluator return type
2020-06-06 22:42:55 +01:00
Edwin Brady
93022af74e More explicitness in evaluator return type
Another one from the "stop trying to be clever" files :). Instead of a
continuation for fallthrough in the evaluator, be explicit about whether
there's a result, no match, or evaluation is stuck.
Fixes #70
2020-06-06 22:20:25 +01:00
Edwin Brady
595e1768e2
Merge pull request #246 from edwinb/unifier-fix
Various fixes
2020-06-06 21:18:25 +01:00
Edwin Brady
252e07833b Fix case trees at multiplicity zero
Can't ignore a constructor a multiplicity zero if the whole function is
multiplicity zero
2020-06-06 20:45:20 +01:00
Edwin Brady
0d4b087e6f Another assumption about scope of metavariables
When instantiating a term, we had an attempt at an optimisation that
assumed variables would be in scope order. But it's not safe to make
that assumption, and it turns out it makes no measurable difference to
performance anyway.
2020-06-06 18:55:59 +01:00
Edwin Brady
4dfbc0fcdc Change representation of names in Nested
Instead of using a raw name, which is error prone, use a Var so we have
a proper reference into the environment. This is important when we're
combining case blocks and where clauses, because we need to rebuild the
environment properly for calls to functions defined in the where block.
2020-06-06 18:45:47 +01:00
Edwin Brady
7733c85fd5 New way of instantiating metavariables
The old way only worked by chance, because the argumemt order happens to
be the same in all cases. I noticed due to some experiments elsewhere
with different ways of elaborating case, which broke that assumption.

The meaning of the list of Vars is actually the opposite of what it was
taken to be... fortunately, the performance works out roughly the same.
Also this way is (arguably) simpler, which is usually a good sign.
2020-06-06 18:43:06 +01:00
Niklas Larsson
8af183d52b
Merge pull request #217 from Sventimir/factorisation
Factors of natural numbers
2020-06-06 13:20:44 +02:00
Niklas Larsson
5c915a578c
Merge pull request #241 from ska80/patch-2
Add more video talks on development of Idris 2
2020-06-06 13:18:20 +02:00
Keller, Bryn
a5449d926e Update docs to reflect changes to ipkg format 2020-06-05 22:14:16 -07:00
Kamiλ Shakirov
2212e81c1f
Add more video talks on development of a Idris 2 2020-06-06 00:41:58 +06:00
Alex Gryzlov
1fe9bb8977 Merge remote-tracking branch 'upstream/master' 2020-06-05 19:40:55 +02:00
Edwin Brady
4aa1c1f44a
Merge pull request #236 from edwinb/case-conversion
Look inside case blocks in conversion check
2020-06-04 18:43:24 +01:00
Edwin Brady
c17d4ff0a5 Look inside case blocks in conversion check
This is quite fiddly as it the blocks might be in different contexts so
we need to keep track of which variables correspond in the scrutinees of
the blocks. Once that's done, check the terms at the leaves convert,
then check the corresponding variables convert.

This may not be perfect yet, because we only look at case scrutinees to
find correspondence. It might also be a bit slower than it could be, but
at least these checks are quite rare.

Fixes #208 and maybe some others?
2020-06-04 18:21:44 +01:00
Alex Gryzlov
ca32ff9000 Merge remote-tracking branch 'upstream/master' 2020-06-04 00:23:35 +02:00
Edwin Brady
1e393b6ffc
Merge pull request #235 from edwinb/reflect-binders
Make lambda elaborator dependent
2020-06-03 20:48:54 +01:00
Edwin Brady
b9ac6e14db Make lambda elaborator dependent
Also remove forall, since I haven't tested it and its type was wrong
anyway. It can go back when we have a use for it...
2020-06-03 20:23:36 +01:00
Edwin Brady
fe9f71d060
Merge pull request #233 from edwinb/reflect-binders
Add reflection under (explicit) binders
2020-06-03 10:13:43 +01:00
Sventimir
7a874b28a4 Merge branch 'master' into factorisation 2020-06-03 11:13:01 +02:00
Edwin Brady
946e1b3a51 Slightly neater reflection008 test 2020-06-03 09:25:09 +01:00
Edwin Brady
3a7aedf0f4 Add reflection under (explicit) binders
This allows writing a staged well typed interpreter, for example (see
reflection008 test)
2020-06-03 09:17:37 +01:00
Alex Gryzlov
30be32cf85 Merge remote-tracking branch 'upstream/master' 2020-06-03 02:46:45 +02:00
Edwin Brady
d03b4f8303
Merge pull request #231 from edwinb/reflect-check-typed
In reflection, check now takes a concrete type
2020-06-03 01:20:58 +01:00
Edwin Brady
c682ded9c4 Reduce amount of normalisation in elab scripts
We don't want to unfold definitions in 'pure' or 'check' or 'bind' since
we want the exact expression that the script author has used.
2020-06-03 00:22:03 +01:00
Edwin Brady
d8d13d912e Add alternative example to reflection002
A bit more typesafe...
2020-06-02 23:56:30 +01:00
Edwin Brady
08b56e9e75 Add quote operation to Elab
Allows quoting a term back to a TTImp. Test reflection007 shows one
possible use for this, building a reflected, type safe, representation
of an expression.
2020-06-02 23:36:20 +01:00
Edwin Brady
2a75731916 In reflection, check now takes a concrete type
So the type of Elab now gives the expected type that's being elaborated
to, meaning that we can run 'check' in the middle of scripts and use the
result.
2020-06-02 22:41:37 +01:00
Edwin Brady
ff4282f886
Merge pull request #229 from edwinb/reflect-lhs
Reflect differently on LHS
2020-06-02 21:49:00 +01:00
Edwin Brady
9fab367f0f Reflect differently on LHS
On the LHS, we want to match against the reflected thing, so FC and
implicits need to turn into match anything patterns, or we won't match
anything at all. This means we can put quoted terms on the LHS, with
pattern variables under ~().
2020-06-02 19:21:46 +01:00
Alex Gryzlov
d4f4a74fbf add Data.Fuel 2020-06-02 17:20:42 +02:00
Giuseppe Lomurno
a9f334ef5c Added auto_implicit_depth pragma
By default, the search depth for auto implcit arguments is limited to
50. This patch adds a new pragma `%auto_implicit_depth` with which the
user can change the depth limit.
2020-06-02 15:46:26 +02:00
Edwin Brady
a2da617f84
Merge pull request #222 from edwinb/reflection-prims
A couple more elab reflection primitives
2020-06-02 13:07:55 +01:00
Edwin Brady
f46a4ed158
Merge pull request #224 from edwinb/reflection-fixes
Reflection fixes
2020-06-02 12:34:43 +01:00
Edwin Brady
c3ee2a3fac Change genSym behaviour
Instead of merely generating a locally unique name, use the existing
code for generating a new unique variable name in the unifier, which is
therefore globally unique.
2020-06-02 12:13:38 +01:00
Edwin Brady
e7f8e2df8c Fix reflection of PiInfo
It needs to account for the implicit parameter
2020-06-02 12:10:57 +01:00
Niklas Larsson
8e788658c4
Merge pull request #223 from dkeehl/fix-libidris2_support_loading
Try to load libidris2_support on older Windows
2020-06-02 09:50:58 +02:00
Thomas Lin
fc8e6b1fef Use GetSystemTimeAsFileTime on older Windows 2020-06-02 10:30:44 +08:00
Mark Barbone
c4cdebb578
Fix tests 2020-06-01 19:13:46 -04:00
Edwin Brady
30737f5ecc
Merge pull request #219 from normalcoder/gambit-ffi-callbacks
Fix "Can't pass argument of type %World to foreign function" issue in gambit ffi
2020-06-01 22:44:21 +01:00
Edwin Brady
a33136aa00 A couple more elab reflection primitives
Get the names of local variables. and add the ability to look up their
types.
When we get a reflected TTImp, either checking the Goal or looking up a
type, it's not impossible that there'll be some repeated binder names,
so also make sure binders are unique relative to the current context.
Ideally we'd also rename things in the environment to guarantee that all
names are unique, but we don't yet.

(This would be much easier if reflected terms were typed such that they
were well scoped, but that would also make reflection harder to use.)
2020-06-01 22:16:27 +01:00