Commit Graph

980 Commits

Author SHA1 Message Date
Edwin Brady
a70c0a6ef6 More tutorial updates 2020-02-25 21:37:48 +00:00
Edwin Brady
2967e9011f Add implementation ... using syntax
It's in the tutorial, and allows named implementations to use specific
parent named implementations.
2020-02-25 21:29:39 +00:00
Edwin Brady
827c51e343 More documentation updates
Some way through the interfaces docs, but "using" for named parent
interfaces is not implemented yet.
2020-02-25 21:01:15 +00:00
Edwin Brady
28b7c62521 Finish update of typesfuns 2020-02-25 19:44:49 +00:00
Edwin Brady
4d146d2416 Some progress on updating the tutorial 2020-02-25 18:34:32 +00:00
Edwin Brady
61578a84b6 default is a keyword now 2020-02-25 14:09:33 +00:00
Edwin Brady
2a2a20849d Add default implicit arguments
These are part of the core QTT now, so any substitutions or dependencies
will be dealt with as they should.
2020-02-25 14:09:08 +00:00
Edwin Brady
da675b38a0 Add some machinery to generate C
This is towards making a distribution that allows building from C,
rather than having to build from the Idris source, to make it easier to
install.
2020-02-25 14:09:08 +00:00
Edwin Brady
755d9bfd20 Copy some docs over from Idris 1
These are still to be updated (as noted in the files), but it needs
doing before any kind of preliminary release. Plan is to refresh the
tutorial and make sure samples work again, then write a more
comprehensive document explaining changes since Idris 1.
2020-02-25 14:09:08 +00:00
Edwin Brady
ff6fd4668b
Merge pull request #195 from ohad/default-totality
Add support for `%default [total | covering | partial]` directive
2020-02-25 14:08:35 +00:00
Matthew Wilson
c050539f34
readme typo
essentiall
2020-02-24 08:35:59 -05:00
Ohad Kammar
620d33e343 Also add Edwin's lexer library 2020-02-24 08:46:56 +00:00
Ohad Kammar
b4fa793b0c Add Edwin's Parser library from the Idris2 port 2020-02-24 08:43:27 +00:00
Edwin Brady
c862199dc2 Add updating version of makeLemma
<LocalLeader>l in the vim mode
2020-02-23 23:30:18 +00:00
Edwin Brady
2da8da8aa9 Add missing test file 2020-02-23 22:20:11 +00:00
Edwin Brady
57a14ff401 Coverage checker looks at 'impossible' clauses
These can give valuable information, but since they're not well typed,
we have to rebuild as close an approximation as we can before passing it
to the case tree compiler. We can do this in a type-directed way, but
ignoring whether any of the arguments are convertible, and not trying to
solve any of the implicits. If this fails, it doesn't use the impossible
case, otherwise it uses it to find the missing cases in the resulting
case tree.
2020-02-23 21:40:23 +00:00
Ohad Kammar
0ba11f1781 Undo changes, as not compatible with idris1 (oops):
* Implicit arguments on interface assumptions
* Removed unnecessary explication of an implicit arg
2020-02-23 19:26:00 +00:00
Ohad Kammar
a33095e559 Bring src/Text/Parser and its dependencies closer to idris2
This includes:

* Removing `%access` directives and inlining their visibility modifiers
* Fixing irrelevance annotations
* Including some standard libraries

The result is still not idris2 ready:

1. Incompatibility with the new Laziness mechanism, as it's missing
   some previous laziness/codata bindings

2. Some standard library functions moved around, and are now found in
   `Data.Nat`, that doesn't exist in Idris1
2020-02-23 18:58:44 +00:00
Ohad Kammar
d16fb0a393 minor: simplify mutual recursion block
Move `BindMode` datatype outside the `mutual` block as mutual
recursion isn't necessary to define it.
2020-02-23 18:44:28 +00:00
Edwin Brady
cd972143a5 Also check unique locals inside pairs
The error message doesn't propagate nicely here yet, but it should still
report failure to resolve the search
2020-02-23 17:44:18 +00:00
Edwin Brady
11da440124 Ambiguity checking on locals in auto search
Fixes #160
2020-02-23 17:30:48 +00:00
Edwin Brady
f1db21346e Fix README formatting 2020-02-23 17:00:53 +00:00
Edwin Brady
f2f07944c6 Update README
References to problem in #179, which is fairly frequently asked.
2020-02-23 16:59:16 +00:00
Edwin Brady
6d05627186 Change case multiplicity rule
IF we're in Rig0, need to check the case at Rig0, because we might want
to split on erased values and it's safe in Rig0
2020-02-23 16:55:19 +00:00
Ohad Kammar
9b8d476b4a Merge branch 'master' of github.com:edwinb/Idris2 into default-totality 2020-02-23 16:49:52 +00:00
Ohad Kammar
70aa4754b6 Add *stub* support for %default totality annotations
Since the totality checker isn't plugged in yet, these do nothing
functionally, but they do add appropriate totality annotations all the
way up to the internal `TT` representation.

Design choices:

1. default totality annotations are session-local, so should be reset
   between files.

2. the default default is `PartialOK`.

3. we won't annotate a definition with `PartialOK` unless the user
   inserts one themselves, relying on the previous point (2).
2020-02-23 16:46:21 +00:00
Ohad Kammar
9da96dd586 Simplify the definition of processFnOpt
There's no need to split into cases for the totality annotations, as
they now use the same representation in the AST as in `TT`.
2020-02-23 16:44:23 +00:00
Edwin Brady
654ab0cbd0 Look inside definitions during conversion
If two definitions are identical, with the same arguments, they should
convert, even if they have different names. Fixes #194
2020-02-23 15:58:14 +00:00
Ohad Kammar
b7ba1a9301 Decouple totality annotations from IFnOpt using the existing TotalReq value
This requires moving `TotalReq` into `src/Core/TT.idr`.
2020-02-23 15:18:10 +00:00
Edwin Brady
65fe430a91 Remove -S flag from call to env
This isn't recognised on all systems, and I don't think it's needed (?)
Fixes #175
2020-02-23 12:24:29 +00:00
Edwin Brady
66d67c84cc Add directory reading functions
and support for Chez and Racket
2020-02-23 12:17:36 +00:00
Edwin Brady
e126dcd28f Add --find-ipkg flag
This looks for an .ipkg file in a parent directory before loading the
given file, and loads it relative to the .ipkg's source directory, with
the options specified in the .ipkg.

The intention is to save all the editor modes having to do the same
thing, and especially makes it possible for the new vim mode to work
with ipkgs.
2020-02-22 23:25:02 +00:00
Edwin Brady
8158c617f6 Disambiguate data constuctor families
If the name is given (rather than, say, computed) update it so that it's
the data type name being defined - so ambiguities are resolved
immediately. Fixes #192
2020-02-22 19:32:22 +00:00
Edwin Brady
5c86552e56 Parse primitive types as identifiers
This way we can use them as parts of namespaces - they don't need to be
reserved keywords, just reserved names. Fixes #111
2020-02-22 18:36:46 +00:00
Edwin Brady
03bdc3145c Type of generated top level methods
Pass through the types of the interface parameters to the top level
method types, because there might be information in there that we can't
otherwise infer. Fixes #188
2020-02-22 17:38:13 +00:00
Edwin Brady
22a779bc88 Proof search on solved holes shows result
From the result of unification
2020-02-22 15:30:45 +00:00
Edwin Brady
3bb5002dba Record whether a definition originated from a hole 2020-02-22 15:04:35 +00:00
Edwin Brady
f2a1934508 Save holes to ttc even if solved by unification
Fixes #108
Fixes #126
If solved, they don't get rendered the same way as holes with ':t' but
you see their full type. This should probably be changed.
2020-02-22 14:18:00 +00:00
Edwin Brady
6c0747c900 Reorganise implicit binding
This should be done at the surface language level only, not during
elaboration. This fixes #107
2020-02-22 12:52:40 +00:00
Edwin Brady
17694ab445 Updating versions of REPL editing commands
This gives us a cheap way to write editor interaction modes via idris2
--client (especially, this is how the vim mode works).
2020-02-19 13:22:59 +01:00
Edwin Brady
041e770ba4 Add --client
This is mostly as an easy way for editors to query Idris without having
to implement the whole IDE protocol!
2020-02-18 19:03:33 +01:00
Edwin Brady
fb49038c9f Don't automatically apply implicits in let
This means we can say 'let x = foo' and have foo not be applied to its
implicit arguments, meaning that 'x' can be instantiated at whatever
implicits it needs through the scope.
2020-02-16 16:33:17 +00:00
Edwin Brady
84faedba50 Tweak expression search heuristic
Search locals left to right, so that they are used as arguments in the
same order by default in recursive calls.
2020-02-15 23:24:00 +00:00
Edwin Brady
14e9872f07 Don't show MN names in hole contexts
This prevents display of shadowed names from case blocks/where clauses
that are now unusable. It does mean that constraint arguments aren't
displayed, unless given an explicit name - this may not be good, since
we might want to know which constraints are in scope, so it may yet need
a little tweaking.
2020-02-15 22:33:13 +00:00
Edwin Brady
dbb336acef Don't solve constraints before ambiguity
It doesn't achieve anything useful, and can be confusing because it
means behaviour is different for names where ambiguity is pruned by type
vs names where it isn't.
2020-02-15 15:03:59 +00:00
Edwin Brady
7e9c6e29e0 Ignore private names in ambiguity resolution 2020-02-15 14:25:47 +00:00
Edwin Brady
1cc6cd31b2 Fix 'import public'
Reloading is about the visibility flag, not the re-export flag
2020-02-15 14:08:48 +00:00
Edwin Brady
813148b52d Let and linearity again
If a let binding doesn't elaborate with a 'precise' inference, revert to
generalising. I still don't like this - we really need to be able to
postpone choice of multiplicities during unification. But we can't, yet,
so here we go.
2020-02-13 19:05:34 +00:00
Edwin Brady
3fe5c78f86 Conversion checking of case blocks
This is a little bit of a hack, but is for the situation where a case
block arises from the same bit of source but with a different name,
which would happen when elaborating interfaces with cases in a method
signature. If it's the same function with the same scrutinee, it's
convertible.
Fixes #191
2020-02-13 18:26:37 +00:00
Edwin Brady
6267231649 Cut down default search depth
If it's not going to find an auto implicit by then, it never will, and
we'll just take ages to get an error
2020-02-13 18:23:40 +00:00