Commit Graph

944 Commits

Author SHA1 Message Date
Edwin Brady
04c63b593f
Merge pull request #243 from deviant-forks/intercalate-list
Add `intercalate` for `Data.List`
2020-03-31 18:14:29 +01:00
Edwin Brady
b3dc643029 Better disambiguation of pairs
The names weren't fully explicit in the elaborator, so ambiguity
resolution wasn't able to take advantage of type-directed pruning. Now
they're explicit (but hard-coded, which we should fix later...) so they
can be resolved more easily.
2020-03-31 18:12:34 +01:00
Edwin Brady
aaf07d52ce Depth error are ambiguity errors too
This means we delay ambiguity resolution properly if we hit a depth
error, which means that we can come back to it later and hopefully be
able to resolve it by type on a second attempt.
2020-03-31 16:59:07 +01:00
Edwin Brady
7bbd26618e Credit where it's due!
Add a CONTRIBUTORS file. This is generated from the git logs.
2020-03-31 16:21:04 +01:00
Edwin Brady
b417413a11 Report an error if ambiguities go too deep
This is the most likely cause of type checking being too slow, at least
in cases where there's not too much type level computation, so rather
than explore for ages, give up after going under too many ambiguous
names during elaboration.

The depth limit is configurable, with %ambiguity_depth <level>, but it's
very unlikely you'll ever want to do that rather than disambiguating
explicitly.
2020-03-31 14:51:33 +01:00
Edwin Brady
736699c729 Better ambiguity resolution
Do two passes through delayed elaborators (it's impossible to predict
dependency order). Possibly this should keep going as long as it's
making progress? I'll consider that later.
2020-03-31 13:04:42 +01:00
Kamil Shakirov
b3392ae225 Show a hint for help on the banner 2020-03-31 11:33:42 +06:00
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
Matus Tejiscak
16e027218b Use cond and equal? in destroy-prefix. 2020-03-29 22:26:42 +02:00
Marc Petit-Huguenin
7ea39af60e
Literate programming
- Add support for .lidr files.
- Add new Parse Error for Literate fails.
- Add support for Case Split.
- Add support for Add Clause.
- Add support for Add Lemma.
- Add tests.
2020-03-29 11:58:00 -07:00
Matus Tejiscak
2cadbd2cd1 Fix runtime error in (the Int (cast "")). 2020-03-29 20:33:46 +02:00
Matus Tejiscak
fcdfa8e191 Fix comment. 2020-03-29 19:50:43 +02:00
Matus Tejiscak
9154a9b02b Add comments. 2020-03-29 19:48:00 +02:00
Matus Tejiscak
2b264d0517 Make sortBy stable. 2020-03-29 19:38:54 +02: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
Matus Tejiscak
ff813ab6dd Add lambda case. 2020-03-29 01:23:15 +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
Marshall Bowers
5b1e8bf436 Add intercalate for Data.List 2020-03-28 13:18:51 -04: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