Commit Graph

879 Commits

Author SHA1 Message Date
Edwin Brady
ee3011a07f Small improvement in ambiguity resolution
This is a tweak we used in Idris 1: In the end, if there is ambiguity,
and some names generate unification constraints but exactly one doesn't,
take the one that doesn't.
2020-03-31 01:25:37 +01:00
Edwin Brady
65461131fc Better ambiguity errors
If we have lots of delayed elaborators, and more than one fails, we need
to print the name ambiguity error first since that is the most likely
cause of any other errors.
2020-03-31 00:36:32 +01:00
Edwin Brady
7ff1e6275f Allow setting logging mid term
Sometimes this makes debugging easier since the logging is more
localised.
2020-03-30 22:55:08 +01:00
Edwin Brady
6beb6aa7c0 Prioritise resolution of delayed elaborators
'case' goes first, because it might help resolve ambiguities. Ideally
we'd keep retrying delayed elaborators until they work, but that's going
to get slow...
2020-03-30 16:02:23 +01:00
Edwin Brady
b0e55b53eb A bit more library support 2020-03-30 13:06:59 +01:00
Edwin Brady
5703befb0d Fix ! notation in pattern matching let 2020-03-29 17:28:51 +01:00
Edwin Brady
ca512ad55a Parser fix
'then' and 'else' indicate the end of an expression, which means that we
can now nest if blocks more freely
2020-03-29 16:55:44 +01:00
Edwin Brady
95a90d0a05 Note on %hint in documentation 2020-03-29 13:02:10 +01:00
Edwin Brady
725e5ac13d No need to store names with locals in TTC
This is needed for consistency with the self hosted version (where the
names aren't even available at that point - so it turns out we learn
something from erasability :))
2020-03-28 20:22:52 +00:00
Edwin Brady
41ec1fc587 Minor documentation edits 2020-03-28 16:00:33 +00:00
Edwin Brady
c1199deed0
Merge pull request #242 from ziman/fix-seqempty
Fix SeqEmpty in Text.Lexer.Core.
2020-03-28 15:59:43 +00:00
Edwin Brady
8559bc4176 Add :? for REPL help
Needs a special case since ? isn't a name, but it's the only one we'll
need (I think!)
2020-03-28 14:42:21 +00:00
Edwin Brady
52273bec5d Some documentation edits
Update Getting Started with installation instructions
2020-03-28 14:21:12 +00:00
Edwin Brady
7c71d5dd46
Merge pull request #239 from deviant-forks/repl-help
Add basic help to REPL
2020-03-28 14:03:43 +00:00
Matus Tejiscak
d819bf5a9d Fix SeqEmpty in Text.Lexer.Core. 2020-03-28 15:02:08 +01:00
Marshall Bowers
57dc1b62f1 Move :compile to the command table 2020-03-28 00:18:34 -04:00
Marshall Bowers
6b386c482e Move :log to the command table 2020-03-27 23:56:30 -04:00
Marshall Bowers
b0204accd3 Move :set and :unset to the command table 2020-03-27 23:44:38 -04:00
Marshall Bowers
48a7949d4d Add help text for :search and :di 2020-03-27 23:43:04 -04:00
Marshall Bowers
a5fa2e00e6 Reorder commands to the way they were prior to changes 2020-03-27 23:29:54 -04:00
Marshall Bowers
476e776083 Account for the various ways to parse commands 2020-03-27 23:28:32 -04:00
Marshall Bowers
abdad354dc Format the help command 2020-03-27 22:27:36 -04:00
Edwin Brady
2938e86421 Ints in buffers are 32 bit
...for consistency with Idris 1 (probably to be revisited later). So,
when working via the scheme primitives, we need to read/write 32 bits.
2020-03-27 20:54:39 +00:00
Edwin Brady
ebafddcfc9 Look for scrutinee type in case
We can work out what it should be since each case is supposed to have
the same type, so we can look ahead to the alternatives. This way, we
don't have to rely on the scrutinee alone to calculate the type of the
case block. (Idris 1 does this too but I've only just encountered the
need for it in Idris 2 now!)
2020-03-27 14:27:33 +00:00
Marshall Bowers
0371d5b0d1 Move :exec to the command table 2020-03-26 22:35:27 -04:00
Marshall Bowers
9701a178b5 Use the same command table for both parsing and help 2020-03-26 22:17:15 -04:00
Edwin Brady
654c306ed5 Update idemode tests
Change in evaluation order changes the internal names - not that we
should be exposing these anyway, but that can be tidied up later...
2020-03-27 00:34:21 +00:00
Edwin Brady
bce7a5e747
Merge pull request #205 from abailly/syntax-highlight
first stab at syntax highlighting in Emacs
2020-03-27 00:22:19 +00:00
Edwin Brady
ed5b53d97f Rabbit hole
Sorry for the less than informative title :). Lots going on here. It
started as an attempt to fix unification to deal with laziness coercions
in trickier places, but unearthed a couple of tricky and interconnected
issues that are hard to unpick into a single patch. So, this fixes a few
things:

- default hints should only be resolved on the current elaboration (e.g.
nested function definitions, not the outer definition which might not
yet be complete)
- delayed elaborators should be allowed to have nested delayed
elaborators, which means disambiguation is a little bit better
- we should delay elaborating arguments where the type isn't known yet,
because later arguments may resolve the type, and we can use this to
help with disambiguation/laziness coercions
- other bits and pieces arising
2020-03-27 00:11:21 +00:00
Marshall Bowers
290db90025 Add ability to display the help 2020-03-26 00:30:25 -04:00
Marshall Bowers
cca6b06a05 Recognize the help commands 2020-03-25 22:17:40 -04:00
Edwin Brady
bba4b347b9 Don't evaluate under Delay in conversion check
At least, not under LInf. Otherwise we might try to build an infinite
structure, which won't end well. Or, indeed, at all.
2020-03-22 23:20:57 +00:00
Edwin Brady
14de988701 Add missing laziness coercion
We weren't adding laziness coercions when unification failed after a
retry, so sometimes they were getting dropped.
2020-03-22 20:32:18 +00:00
Edwin Brady
2b6bd74286 Small improvements in codegen performance
Lots of time is taken in finding the definitions to compile, mostly
because the definition itself needs to be decoded from the binary format
in the ttc, but we can at least make the rest of the process fast.

Inlining takes a while - we could improve this later by inlining as we
go, per file, rather than doing it just before compilation.
2020-03-21 22:51:20 +00:00
Edwin Brady
b310e28fdf Fix for resolved names
When we're checking if a definition is a hole and needs updating, when
loading ttc, the names might not fully resolved yet, so don't decode the
definition.
2020-03-21 14:27:03 +00:00
Edwin Brady
aaf6868bc7 Nested names need a unique index
We could have the same local name twice in the same parent function, in
different clauses.
2020-03-20 15:47:43 +00:00
Edwin Brady
49510bf164 Need to check multiplicity of names in LinearCheck
This is done during elaboration, but not for things which are solved by
unification or search, and they might be 0 if, say, they're a record
projection or other type level function.
2020-03-20 13:44:17 +00:00
Edwin Brady
b94c31a442 Faster generation of Scheme
fastAppend allocates the whole string at once, rather than concatenating
and therefore reallocating a lot
2020-03-20 13:43:26 +00:00
Edwin Brady
7dcb1cfd34 Metavar solutions might contain 'let'
Mostly if they arise from search, where the target of the search has a
let in the type. So, we need to consider this when checking
metavariables in the linearity check.
2020-03-19 22:14:57 +00:00
Edwin Brady
d666ed50c9 A couple of library functions 2020-03-19 22:14:48 +00:00
Edwin Brady
727d6e8ec5 Quicker building of dependency tree
The old way did a lot of needless traversal, though you wouldn't
typically notice until you start having 40+ modules to build. Now make a
note of what we've looked at already.
2020-03-19 18:51:16 +00:00
Edwin Brady
cbf8785d32 Take account of env in record elaboration
Also need to make sure that the constructor and fields are included in
the nested names so that the parameters get expanded properly.
Fixes #138
2020-03-19 12:12:25 +00:00
Edwin Brady
344a565a49 Comment consistency with code! 2020-03-18 23:10:14 +00:00
Edwin Brady
3cf223b835 Elaborate record bodies on second mutual pass
This is the same behaviour as Idris 1. Fixes #217
2020-03-18 23:09:17 +00:00
Edwin Brady
588a5b74cd Only record fields should be in a new namespace
Record name and constructor are in the outer namespace, fields in the
nested namepsace. Private names in the nested namespace is visible from
the outer namespace. Fixes #183

Also remove the 'nested' flag on INamespace, since it was only there for
records, and not really the right way to do things. The nested namespace
name is now given in the IRecord constructor (a front end might not want
to use a new namespace after all).
2020-03-18 22:48:19 +00:00
Edwin Brady
db7f500665
Merge pull request #234 from diakopter/patch-4
gitignore .so files under tests
2020-03-18 20:38:46 +00:00
Edwin Brady
3a2abe2e45
Merge pull request #231 from andrevidela/ttc-debug
Add version and file to TTCError
2020-03-18 20:38:07 +00:00
Edwin Brady
776abebba1
Merge pull request #227 from ska80/typedd-book/chapter13-14
Port code examples for chapters 13 and 14 from TypeDD book
2020-03-18 20:37:26 +00:00
Edwin Brady
dd7ed89ed0
Merge pull request #222 from ziman/sorted-map-set
Adapt Data.Sorted{Map,Set} from Idris 1
2020-03-18 20:35:33 +00:00
Edwin Brady
6f933ba230
Merge pull request #221 from ziman/parser-lazy
Make the applicative combinators in `Text.Parser.Core` lazier
2020-03-18 20:35:01 +00:00