Commit Graph

824 Commits

Author SHA1 Message Date
Edwin Brady
f21a495711 Merge github.com:idris-lang/Idris2 into tweak-cg 2021-05-11 11:37:12 +01:00
Edwin Brady
efaf290d88 Calculate whether an inlining is safe
It's safe if all top level arguments are used at most once, meaning that
there's no risk of duplication.
2021-05-11 11:29:01 +01:00
G. Allais
004cc45e9d
[ test ] cosmetic changes & retest capability (#1394)
* Banners for test pools
* Summary with the list of failing tests at the end
* Option to write the list of failing tests to a file
* Option to read the list of tests to run from a file
* Using these two latest features to add a new make target to rerun precisely the tests that failed last time
2021-05-11 09:46:21 +01:00
G. Allais
ab241213f3
[ breaking ] making toList part of Foldable (#1395) 2021-05-11 08:26:00 +01:00
Matúš Tejiščák
4de7b2133a
[ new ] Add chez-sep codegen (#1359)
Co-authored-by: Johann Rudloff <johann@sinyax.net>
2021-05-11 08:20:19 +01:00
Stefan Höck
f028981e5a
[ fix #801 ] Use Number for up to 32 bit integers on JS backends (#1375) 2021-05-10 12:17:09 +01:00
Zoe Stafford
8a7aeca1b0
[ builtin ] O(1) natToInteger for any 'Nat'-like type (#1363) 2021-05-10 12:14:19 +01:00
Guillaume ALLAIS
08d61d70c4 [ fix #1370 ] use the lambda's type for eta-expansion 2021-05-10 12:13:29 +01:00
Zoe Stafford
25ae664ef6
[ fix #1378 ] Collect constructors after inlining (#1380) 2021-05-10 11:19:18 +01:00
Ohad Kammar
e58bcfc7ef
Semantic highlighting (#1335)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-05-10 09:05:43 +01:00
Edwin Brady
251d77b92d Swap 'False' and 'True' constructors
It has always bothered me that 'False' got mapped to tag 1 and 'True'
got mapped to tag 0. This doesn't change much in practice (except that
perhaps a code generator might notice some useful things in intToBool)
but I'm changing it now anyway. Also added a couple of inlinings of
boolean operations.
2021-05-09 20:08:38 +01:00
Edwin Brady
e8eab6d763 Flag records and option types
This saves a small amount of allocation, especially since we never
actually look at the tag in a record. We can use null? for Nothing just
like for Nil.
2021-05-09 16:49:59 +01:00
Edwin Brady
fafa76c55c Generalise NIL/CONS to all list shaped things
Also pairs turn into CONS, because we don't need to look at the tag if
there's only one constructor.
2021-05-09 01:43:59 +01:00
Edwin Brady
4389224694 Merge github.com:idris-lang/Idris2 into caseofcase 2021-05-08 18:19:21 +01:00
Edwin Brady
66930113bd Compile lists as scheme lists
This also involves adding a flag to constructors and case alternatives
in CExp which say whether it's a NIL or CONS. Currently, we only do this
for Prelude.List, which already has an effect, but soon I'll extend this
to work for all list-shaped things and rather than being hard coded. We
could also imagine spotting other shapes (enumerations especially) for
code generators to spot as they see fit.

This will require code generators to be fixed to recognise the new
ConInfo flag, but you can just ignore it.

Bootstrap code also updated, because we don't currently have a way of
having separate support.ss/rkt for the bootstrap and normal builds!
2021-05-08 15:42:51 +01:00
Ruslan Feizerakhmanov
5993233057 [test] Update the test that prints constructor names 2021-05-06 19:48:12 +03:00
Johann Rudloff
4b7d85653a [ tests ] Add tests for :doc for records and single-constructor type 2021-05-06 14:38:55 +01:00
Johann Rudloff
62519c5352 Allow --directive command line flag combined with package options 2021-05-05 18:55:55 +01:00
Stefan Höck
6cdf05f1ec
[ new ] Add Int(8/16/32/64) (#1352)
This adds new `Int8`, `Int16`, `Int32` and `Int64` data types
to the compiler, thus working towards properly specified integer
types as discussed in #1048.

In addition, the following changes / corrections are made:

* Support casts from `Char`, `String`, and `Double` to all integer
  types (and back). This fixes #1270.
* Make sure that all casts to limited-precision integers are properly
  bounds checked (this was not the case so far for casts from `String`
  and `Double` to `Int`)
* Add a thorough set of tests to make sure all bounds checks work
  correctly for all supported casts and arithmetic operations
2021-05-04 08:22:06 +01:00
Edwin Brady
e972a23126
Merge pull request #1371 from edwinb/eraseargs
Erasing more things
2021-05-03 16:46:27 +01:00
Edwin Brady
71b401d3de Update tests
Well that was clever. I updated my tests locally and forgot to include
them in the commit...
2021-05-03 15:13:45 +01:00
Edwin Brady
73d374e435 Properly erase 0 quantity arguments
Don't just have a placeholder. While this doesn't have a huge effect (if
any) on performance, it does generate smaller output for Chez to
process, and is tidier. Perhaps it's good for other back ends too, ones
that don't optimise as much as Chez does.

Only doing named functions, not higher order functions. HOFs may be
worth doing too, if we can, since this could remove lambdas and make
fewer closures.

The increment in TTC Version is necessary because otherwise there could
be inconsistencies between libraries and clients erasure properties.
2021-05-03 14:18:01 +01:00
Guillaume ALLAIS
32f42e702a [ fix #1366 ] NType is not an NTCon 2021-05-03 13:52:01 +01:00
Edwin Brady
9e082730c2 Update test output
Some merges have made the output of tests change (due to internal
changes). This brings them up to date.
2021-05-01 17:37:38 +01:00
Edwin Brady
d6d68ff09b
Merge pull request #1195 from buzden/some-funs-to-lazy-list
[ contrib ] Some functions for lazy list + fix for `foldlM`
2021-05-01 16:18:24 +01:00
Edwin Brady
7f7b11ed54 Use transforms for fastPack/fastUnpack
We've had these for a while, used for interface specialisation, but
they're not yet used anywhere else or properly documented. We should
document them soon, but for now, it's a useful performance boost to
always use the fast versions of pack/unpack/concat at runtime.

Also moves a couple to the prelude, to ensure that the fast versions are
defined in the same place as the 'normal' version so that the
transformation will always fire (that is, no need to import Data.String
for the transformation to work).
2021-04-29 23:17:29 +01:00
Edwin Brady
90ec19f053
Merge pull request #1354 from edwinb/casetransform
Add case+lambda transformation
2021-04-29 14:59:11 +01:00
Edwin Brady
c3e5689a62 Add case+lambda transformation
If all branches in a case block are a lambda, lift the lambda out. In
many cases, this can save creating a closure then evaluating it
immediately, because the function is already applied to the extra
argument.

This happens in particular with IO based code, where the extra argument
is the world token. One place where this transformation has a big effect
is 'evalRef' so the evaluator is now a bit faster (about 20% on the
small benchmark I tried it on - but no guarantees that's going to happen
on other examples!)
2021-04-29 13:44:13 +01:00
Guillaume ALLAIS
d9176d47db [ fix #633 ] Pattern-matching on functions is illegal 2021-04-28 20:25:45 +01:00
G. Allais
96a2809f62
[ fix #1169 ] primitive types are not NTCon (#1340) 2021-04-28 09:33:27 +01:00
Stefan Höck
bbea929cf3
[ refactor ] Cleanup integral primops (#1211) 2021-04-28 09:32:46 +01:00
G. Allais
d32daaf36a
[ fix ] properly handle Namespace blocks for DocStrings (#1342) 2021-04-28 09:31:01 +01:00
Guillaume ALLAIS
4224c58651 [ fix ] print infix operators with parens
I noticed that e.g. List's (::) was not printed correctly in `:doc`
so here's a fix.
2021-04-27 14:12:48 +01:00
Tung Alissa
881a5e7fbc
[ fix #1328 ] print infix functions enclosed in grave accents (#1331) 2021-04-25 18:56:08 +01:00
André Videla
9f39ad6ba8 Implement new parameters syntax
Previously, parameter block reused the same syntax as in Idris1:

```
parameters (v1 : t1, … , vn : tn)
```

Unfortunately this syntax presents some issues:
 - It does not allow to declare implicit parameters
 - It does not allow to specify which multiplicity to use
 - It is inconsistent with the syntax used for named arguments elsewhere
   in the language.

This change fixes those three problems by borrowing the syntax for
declaring type parameters in records:

```
parameters (v1 : t2) (v2 : t2) … (vn : tn)
```

It also enables other features like multiple declarations of arguments
with the same type:

```
parameters (v1, v2 : Type)
```
2021-04-23 19:02:48 +01:00
Denis Buzdalov
583442b359
[ contrib ] Arithmetic on Fin (#830)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-04-23 12:05:13 +01:00
Zoe Stafford
c75b3f7f14
Add Agda-like builtins (#1253)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-04-22 13:08:32 +01:00
stefan-hoeck
181b26b250 [ fix ] broken unicode parsing in JSON 2021-04-22 10:59:14 +01:00
claymager
d6583048d8
Fixes for processPackage (#1304) 2021-04-21 10:15:39 +01:00
Tung Alissa
1bf46bc458
[ REPL ] Improving :doc (fixity, totality, colours) (#1316)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-04-21 09:39:18 +01:00
John Mager
9b81cb19d3 Set PREFIX for tests 2021-04-19 11:23:58 +01:00
Guillaume ALLAIS
688e5c586c [ test ] Note that we cannot turn the whole check off
If we were to turn the whole check off instead of just making it
(not incase || isJust (isLHS mode)) then Issue962-case would fail
because `c` would get defaulted to `Integer` and not the `Int` that
is expected.
2021-04-16 18:12:40 +01:00
Guillaume ALLAIS
f6f2f5f5c6 [ fix #962 ] solve defaults on LHS even in case 2021-04-16 18:12:40 +01:00
G. Allais
5946442dc2
[ new ] idris2 --init (#1299) 2021-04-15 14:08:50 +01:00
Niklas Larsson
473b8ee740 Windows test fixes
Translate node error codes
Strip 'b' from flags
Simplify directory wrangling in chez016
2021-04-12 18:47:57 +02:00
Raoul Hidalgo Charman
1211f860b6
Fix issues with use of unix sockets (#1284)
This change adds logic to set up sockaddr correctly for connect and
bind, handles the AF_UNIX case for getSockAddr and expands the existing
test to cover unix sockets.
2021-04-12 11:22:45 +01:00
John Mager
c3ff63ae5f Use absolute path to pass around Idris executable
Rather than tracking how far we are from the project root in the various
Makefile commands, it's much easier to reference the build target with
with an absolute path.
2021-04-11 20:52:36 +01:00
Sören Tempel
c725b11c89 Flush standard out after writing prompt to it
On Unix-like operating systems stdio.h is usually line-buffered. As
putStr uses fputs(3) from stdio.h internally, output will be written to
standard out after a newline character is written to the buffer. Since
the prompt does not contain a newline, it will only be written to
standard output after the user presses return. I encountered this issue
on Alpine Linux which uses musl libc (instead of glibc). However, I
believe this issue is likely also reproducible with glibc. This commit
fixes this issue by flushing standard output after writing the prompt to
it. Surprisingly, `src/Idris/IDEMode/REPL.idr` already does this
correctly, `src/Idris/REPL.idr` does not though.
2021-04-09 15:17:00 +01:00
G. Allais
b7bdd0a99f
Various improvements (#1286) 2021-04-09 13:02:37 +01:00
Stefan Höck
61c43e5337
[ new ] Add Bifoldable and Bitraversable interfaces to Prelude (#1265) 2021-04-08 17:25:37 +01:00
Ohad Kammar
b65907f770
Support Multi-declarations (#1280) 2021-04-07 12:21:17 +01:00
Kamiλ Shakirov
2ac4bea220
[ install ] Check if 'realpath' exists for Chez and Racket backends (#1210) 2021-04-06 15:42:04 +01:00
Mathew Polzin
178f26ec17
[ re #1162 ] Test without install (#1240)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-04-05 11:27:56 +01:00
Edwin Brady
12f40f538f Use correct multiplicity in scope of lets
The scope should be checked at the same multiplicity as the enclosing
expression.
2021-04-04 18:10:34 +01:00
Kamil Shakirov
b27001136b [ tests ] Ignore test artifacts 2021-04-01 10:06:14 +01:00
Guillaume ALLAIS
99b87c8156 [ fix #1248 ] Bring qualified names back for data & record types 2021-03-31 23:17:53 +01:00
Atomotron
a1e7221c32
[ fix #1200 ] Switch scheme backend to flonum functions (#1203)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-03-31 23:17:41 +01:00
Zoe Stafford
f255026d1b
[ fix #1220 ] Update arity of constuctors to reflect erased args (#1225) 2021-03-29 15:08:06 +01:00
G. Allais
238eb62da6
[ fix #1230 ] Better error messages for out-of-scope identifiers (#1233) 2021-03-29 10:45:48 +01:00
CodingCellist
ec77ad21ab
[ re #1185 ] Add primitive for obtaining number of processors (#1209)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-03-26 18:27:25 +00:00
Denis Buzdalov
a6a82a18b5 [ prelude ] foldlM was made to be in the Foldable interface. 2021-03-26 00:59:13 +03:00
Guillaume ALLAIS
2df49ebdd4 [ fix #1224 ] moduleIdent must be capitalised 2021-03-25 15:59:46 +00:00
Guillaume ALLAIS
00929deed6 [ cosmetic ] nicer error messages for uncaught exceptions 2021-03-25 15:59:46 +00:00
Denis Buzdalov
8abd60535b [ fix ] Ability for data types to be operators was restored 2021-03-25 14:16:47 +00:00
G. Allais
97fb5d7b94
[ fix #893 ] proof gadget for with clauses (#1222) 2021-03-25 10:02:06 +00:00
G. Allais
21f2913527
[ fix #710 ] Enforce assumptions about capitalised idents (#1207)
Given we keep getting tripped up by this, here we go:

* Namespaces
* Data names
* Record names
* Data constructor names (except for operators)
* Record constructor names (except for operators)
* Interface constructor names (except for operators)
2021-03-22 13:22:52 +00:00
Guillaume ALLAIS
f600182999 [ close #31 ] test case for the issue 2021-03-18 10:38:48 +00:00
G. Allais
f959987a51
[ fix #834 ] Fix implicitsAs for local definitions (#1199) 2021-03-17 10:54:25 +00:00
André Videla
405c266b5e
[ refactor ] Multiline error report (#1155) 2021-03-16 14:10:45 +00:00
Stefan Höck
591797ebaf
[ new ] Support overloaded floating point literals (#1177) 2021-03-16 14:08:50 +00:00
Guillaume ALLAIS
80f8a0f8fe [ re #1185 ] add threads option to test runner 2021-03-16 14:03:46 +00:00
CodingCellist
89a84a34a4
Patch CVs and sleep in Racket (#1059) 2021-03-15 13:43:12 +00:00
Stefan Höck
1784593abb
[ new ] Applicative and Monad for Pair (#1188) 2021-03-15 13:42:04 +00:00
Matúš Tejiščák
f4a790ded4
Identify prefix and postfix record projections (#1183)
`.proj` and `proj` are identically defined but separate functions.
This patch fixes it by defining `.proj` only once, and adding `proj = (.proj)`
for every projection.
2021-03-15 13:40:13 +00:00
Raoul Hidalgo Charman
3e85e23638
Namespace checks for resugaring (#1161)
This avoids resugaring to the wrong type when there are user defined
symbols which conflicts with builtins such as Pair.

Changed the test linear002 which was relying on this behaviour for a
user defined Unit.

Fixes #634.
2021-03-15 13:34:54 +00:00
Michael Messer
d08c0c78b3
Change :doc to use PTerm instead of Name (#1178) 2021-03-12 09:46:46 +00:00
Edwin Brady
17cdc7fa88
Merge pull request #1171 from edwinb/fix1163
Correct multiplicities when checking Pi binders
2021-03-09 18:36:08 +00:00
Mathew Polzin
06586d401a
Add a test package to the Idris 2 project (#1162) 2021-03-09 18:27:05 +00:00
Edwin Brady
04a0f5001f Correct multiplicities when checking Pi binders
We've always just used 0, which isn't correct if the function is going
to be used in a runtime pattern match. Now calculate correctly so that
we're explicit about which type level variables are used at runtime.

This might cause some programs to fail to compile, if they use functions
that calculate Pi types. The solution is to make those functions
explicitly 0 multiplicity. If that doesn't work, you may have been
accidentally trying to use compile-time only data at run time!

Fixes #1163
2021-03-09 17:23:05 +00:00
Ruslan Feizerahmanov
50c60185a7
[ auto ] Ignore hidden names in Core.Context.getSearchData (#1143)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-03-09 14:13:29 +00:00
Stefan Höck
8d4321eb9a
Add Data.Bits to base (#1033) 2021-03-04 20:59:56 +00:00
Stefan Höck
4c7d0db4bc
[ fix #1148 ] Support hyphenated package names (#1151) 2021-03-04 19:09:15 +00:00
Edwin Brady
c9de4d9f9f Remove more trailing whitespace 2021-03-03 14:36:33 +00:00
Edwin Brady
6a29fab245 Remove trailing whitespace in tests
Keep the linter happy
2021-03-03 13:55:30 +00:00
Edwin Brady
6887a5f95f Record local hints in delayed elaborators
We might not have set up search problems yet when delaying an
elaborator, so we need to know what the local hints were at the point of
delay.
2021-03-03 13:49:32 +00:00
Ruslan Feizerakhmanov
217c44291a [ unify, fix #589 ] Postpone when instantiating if type is unknown 2021-03-02 21:57:42 +03:00
Edwin Brady
a00fc25109
Merge pull request #1146 from edwinb/fix1140
Check current holes only at end of elaboration
2021-03-01 20:51:46 +00:00
Edwin Brady
1d965627c9 Check current holes only at end of elaboration
Fixes #1140 - when checking holes were solved, we checked all of them,
but there may still be some open if there's a local definition.
2021-03-01 19:11:15 +00:00
G. Allais
cee7e38894
[ new ] Proof search from 'Applications of Applicative Proof Search' (#1093) 2021-03-01 08:29:43 +00:00
Edwin Brady
37cc095f7a Merge github.com:idris-lang/Idris2 into versions 2021-02-27 18:00:18 +00:00
Edwin Brady
1d8166b1b2 Version number constraints in 'depends' field
Now reporting an error if we can't find a package that satisfies the
constraints. The version number field can still be a string (as it used
to be) but will give a deprecation warning - and the old style version
string wasn't used anyway.

Version constraints can have an upper and/or lower bound, which can be
inclusive or not.
2021-02-27 17:58:52 +00:00
André Videla
aa27ccbdb6
Merge pull request #1097 from andylokandy/multiline
Implement multi-line string
2021-02-26 21:50:54 +00:00
G. Allais
59de5f1326
[ fix #762 ] Different case tree building strategy (#1125) 2021-02-26 09:33:07 +00:00
Andy Lok
01c5011653 improve error report 2021-02-25 20:14:26 +08:00
Andy Lok
5fed5c2b7a Merge branch 'master' of https://github.com/idris-lang/Idris2 into multiline 2021-02-25 19:52:42 +08:00
Andy Lok
8c23f5944b address comment 2021-02-25 18:43:42 +08:00
G. Allais
fcd834c423
[ fix #110 ] Check the LHS' head is not shadowed (#1121) 2021-02-25 08:51:27 +00:00
Guillaume ALLAIS
da88b80481 [ fix #794 ] missing cases in recoverable 2021-02-24 20:25:04 +00:00
G. Allais
d2eeb7ce86
[ fix #758 ] desugar non-binding sequencing in do blocks to (>>) (#1095) 2021-02-24 11:07:16 +00:00
Denis Buzdalov
95af3cf4be
More compose instances and one usage of them (#1089) 2021-02-23 10:53:43 +00:00
Guillaume ALLAIS
00067e8151 [ fix #637 ] force indentation after a with 2021-02-23 10:52:22 +00:00
G. Allais
c10c1d65a5
[ fix #1022 ] detect more impossible cases (#1108) 2021-02-23 10:51:38 +00:00
Andy Lok
775d7b4bdb Add test for escaping NL 2021-02-23 13:10:36 +08:00
Andy Lok
2358ac0f73 Fix StrError12 test 2021-02-23 02:10:57 +08:00
Guillaume ALLAIS
741960f0d1 [ test ] case for #484
This issue was fixed by #1081
2021-02-22 16:04:04 +00:00
G. Allais
30d402ed7f
[ fix #899 ] Be careful when generating an impossible LHS (#1081) 2021-02-22 09:53:30 +00:00
Mathew Polzin
c3a42966e7 fix indentation in Golden so that prompt happens after both paths under expected and actual outputs don't match. 2021-02-22 09:39:57 +00:00
Andy Lok
83ab4f0f15 Fix lint 2021-02-21 03:13:13 +08:00
Andy Lok
07eb6fda47 Allow hashtag escape for multi-line string 2021-02-21 03:11:01 +08:00
Andy Lok
22a769e6b5 Implement multiline string 2021-02-20 18:05:26 +08:00
Denis Buzdalov
cf1ed0b964 Name quotes were made to use single braces instead of double ones. 2021-02-19 18:05:41 +03:00
Guillaume ALLAIS
7ccc47712e [ re #1087 ] Better error messages in the REPL
(as well as in type signatures now that I know how to do that)
2021-02-19 12:34:19 +00:00
Andy Lok
26464357c1
Implement interpolated string (#1056) 2021-02-18 13:07:22 +00:00
Mathew Polzin
9f8a8b5d76
Add a total way of reading files in. (#1070) 2021-02-18 11:13:25 +00:00
Stefan Hoeck
7401961425
[ new ] Bitwise XOR for Bits64 and Integer (#1026) 2021-02-16 15:14:56 +00:00
Guillaume ALLAIS
059074fe14 [ test ] fix test suite output 2021-02-15 10:35:46 +00:00
Andy Lok
ed7ee4a57b Show more codes in error report 2021-02-15 10:35:46 +00:00
G. Allais
301324b9b3 [ fix #1043 ] throw error if compileExpr failed (#1052)
Also adding a CI target testing the gambit backend.
2021-02-15 10:35:46 +00:00
Z-snails
5384560009 [ new ] support record projections in refc backend (#1054) 2021-02-15 10:35:46 +00:00
Andy Lok
5cd7642991 Small improve
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
2021-02-12 14:01:12 +08:00
Andy Lok
99687976f4 Improve parse error report
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
2021-02-12 01:16:40 +08:00
Andy Lok
b04ebe8cf1 Let lexer recognise grouping
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
2021-02-10 23:33:25 +08:00
Stefan Hoeck
f721281bdc
[ re #1043 ] Fix typo in support.scm (#1047) 2021-02-10 01:00:42 +00:00
Ohad Kammar
891b2d667a
[ fix ] All the REPL commands should be in CommandTable (#1036)
Co-authored-by: Ohad Kammar <ohad.kammar@ed.ac.uk>
2021-02-08 17:25:49 +00:00
stefan-hoeck
f50b22548f tests for bitops 2021-02-08 15:47:23 +00:00
stefan-hoeck
1104776430 fix 1037 2021-02-08 15:47:23 +00:00
Wen Kokke
bd683938bf
Overhaul of concurrency primitives (#968)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-02-05 16:16:20 +00:00
GustavoMF31
7f495999bd
Make :typeat a useful command (#998)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-02-05 16:15:40 +00:00
Guillaume ALLAIS
5720d1c691 [ fix #1023 ] Hexadecimal literals can be pretty big 2021-02-04 13:22:55 +00:00
G. Allais
d709082fc7
[ fix #835 ] Keep names of implicit variables in with clauses (#1017) 2021-02-03 16:16:11 +00:00
André Videla
ab9d1e68ce
Merge pull request #999 from andylokandy/rawstring
Add support for raw strings
2021-02-03 01:02:45 +00:00
G. Allais
d9e0841245
[ contrib ] support for C backend (#1015) 2021-02-02 15:31:30 +00:00
vfrinken
d04b28b62d
Update stringOps.c (#848)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-02-02 14:01:19 +00:00
Andy Lok
4ceccaf00c Support raw string
Add wrap on file end

use rust-style raw string syntax

use swift style syntax raw string

Update src/Parser/Support.idr

Co-authored-by: André Videla <andre.videla@gmail.com>

Escape line wrap

Resolve conflict
2021-02-02 19:37:53 +08:00
Denis Buzdalov
d076bcd649 Double closing brace was made to not be treated specially. 2021-02-02 11:27:34 +00:00
Edwin Brady
f2da5b4a46 Local hints shouldn't be accessible globally
We can't just assume that a hint added in an empty environment is a
global hint, because a top level definition might still have no local
variables.
2021-01-30 13:30:44 +00:00
Michael Messer
05c9029b35
Fix REPL execExp and fix "it" (#908) 2021-01-27 23:14:41 +00:00
Andy Lok
5b367da2c9
[ refactor ] Rename Data.Strings to Data.String (1/2) (#987) 2021-01-27 19:18:34 +00:00
Stiopa Koltsov
901a15e8f8 Move Cast interface to Prelude.Cast
Extract 200 lines file from 1000 lines `Prelude/Types.idr`.  To
make code more discoverable.
2021-01-27 18:31:43 +00:00
stefan-hoeck
606bc577b5 fixed whitespace for *.sh 2021-01-22 15:08:49 +00:00
stefan-hoeck
721cc3162c adjusted source positions in failing tests 2021-01-22 15:08:49 +00:00
stefan-hoeck
8b96614454 fixed whitespace for *.c and *.h files 2021-01-22 15:08:49 +00:00
stefan-hoeck
a52fbfb096 fixed whitespace for *.idr,*.ipkg,*.tex,*.yaff, and *.lidr 2021-01-22 15:08:49 +00:00
mapf0ld
e15b1f0c78
[ refactor ] ltrim in terms of asList (#894)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-01-22 15:07:23 +00:00
Johann Rudloff
043336ba5c [ fix #959 ] ES Codegen: Add casts from integer types to double
A new test is included to verify the cases mentioned in the original
issue.
2021-01-21 12:28:40 +00:00
Stefan Hoeck
fb08004041
removed trailing whitespace (#955) 2021-01-21 11:33:03 +00:00
Nicolas A. Schmidt
61761f4c27
Don't add implicits after non-given explicits. (#918) 2021-01-20 19:13:07 +00:00
G. Allais
47d345f67a
[ fix #954 ] Allow RF names for interface methods (#956) 2021-01-19 20:50:47 +00:00
Fabián Heredia Montiel
b0e0bf17d4 Add time to windows runs due to flaky tests. 2021-01-19 18:40:35 +00:00
Fabián Heredia Montiel
932ded4207 Split Idris Test Pool 2021-01-19 18:40:35 +00:00
Fabián Heredia Montiel
a23871e57e Execute tests concurrently 2021-01-19 18:40:35 +00:00
Edwin Brady
9f906bed81 Update test output
This was changed due to the recent multiplicity update.
2021-01-16 17:09:02 +00:00
Edwin Brady
fec03ea598
Merge pull request #902 from mattpolzin/scratch-work-search-repl
Interactive & REPL :search feature
2021-01-16 14:11:41 +00:00
Stiopa Koltsov
b76c9d91e0 Remove trailing whitespaces and add trailing newlines 2021-01-16 10:00:03 +00:00
Fabián Heredia Montiel
d712ea288a Implement Racket Futures Support 2021-01-15 18:58:51 +00:00
Edwin Brady
3621c5d1bd
Merge pull request #879 from edwinb/no-linearity-subtyping
Remove linearity subtyping
2021-01-12 12:33:26 +00:00
Edwin Brady
fe602caa2c
Merge pull request #765 from ShinKage/ide-mode
IDEMode syntax option and fixed output
2021-01-12 10:39:44 +00:00
André Videla
e99a9b0c84
Merge pull request #901 from andrevidela/fold-count
Add count and foldMap to prelude
2021-01-06 19:29:50 +00:00
André Videla
28c4d1e3bb Add count and foldMap to prelude 2021-01-05 21:59:01 +00:00
Mathew Polzin
2b58434b6e Add test for type search 2021-01-03 13:35:58 -08:00
Jesse Ira Abadilla
372df16726 test: Change function definitions in "Generic.idr". 2021-01-01 14:44:53 +00:00
Michael Messer
709b97c2d7
Add it to REPL (#887)
Co-authored-by: Michael Messer <michaelmesser@users.noreply.github.com>
2020-12-29 23:52:03 +00:00
Edwin Brady
ad632d825d Remove linearity subtyping
It's disappointing to have to do this, but I think necessary because
various issue reports have shown it to be unsound (at least as far as
inference goes) and, at the very least, confusing. This patch brings us
back to the basic rules of QTT.

On the one hand, this makes the 1 multiplicity less useful, because it
means we can't flag arguments as being used exactly once which would be
useful for optimisation purposes as well as precision in the type. On
the other hand, it removes some complexity (and a hack) from
unification, and has the advantage of being correct! Also, I still
consider the 1 multiplicity an experiment.

We can still do interesting things like protocol state tracking, which
is my primary motivation at least.

Ideally, if the 1 multiplicity is going to be more generall useful,
we'll need some kind of way of doing multiplicity polymorphism in the
future. I don't think subtyping is the way (I've pretty much always come
to regret adding some form of subtyping).

Fixes #73 (and maybe some others).
2020-12-27 19:58:35 +00:00
Edwin Brady
69f3c23cbb Treat local hints differently in auto search
Local hints need to reduce (just like global hints do) so we expand
their definition to the lifted name before applying them.
We're identifying the global hints by knowing that the binder name is a
nested function name. This is a bit of hack, and it'd probably be better
to record that information in the binder instead, but that's a more
substantial change than I want to do right now.
2020-12-27 13:41:48 +00:00
Edwin Brady
6c9ad81c12 Add missing test
:#	../../../src/Compiler/.ANF.idr.swp
2020-12-14 13:38:40 +00:00
Edwin Brady
c1f58d963f
Merge branch 'master' into interfaces 2020-12-14 13:34:31 +00:00
Edwin Brady
252292451f Add local hints (basic version)
This gives us the ability to define and use implementations locally, in
where clauses/local let bindings, as well as flag local definitions as
hints.
It's not yet quite equivalent to global hints, however, since it translated
the hint to a local let binding, which doesn't reduce, so if something
relies on the reduction behaviour of the hint, it won't work. This
refinement is coming later
2020-12-14 13:25:50 +00:00
Wen Kokke
daff1f2fb8
Added assert_linear. (#844)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2020-12-13 16:06:18 +00:00
G. Allais
3f6b99e979
[ fix #657 ] RigCount for interface parameters (#808) 2020-12-11 11:58:26 +00:00
Dong Tsing-hsuen
88aa55e875
[ new ] null method in Foldable (#832)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2020-12-10 18:04:23 +00:00
Guillaume ALLAIS
4025896572 [ fix #833, #677 ] bound variables start with a lowercase letter 2020-12-10 18:01:14 +00:00
Fabián Heredia Montiel
87358f19da Increase timings of concurrency tests due to flaky windows runs 2020-12-07 21:20:09 +00:00
Jan de Muijnck-Hughes
3a6e779acf Extended Literate support to include LaTeX. 2020-12-07 14:54:35 +00:00
Jan de Muijnck-Hughes
9c5198cde3 Fixed docs and improved Literate mode.
+ Expanded the documentation on how to use literate modes.
+ Added invisible code blocks in Markdown using specially tagged comment blocks: `<!-- idris -->`.
+ Fixed OrgMode specificaton to recognise comment blocks properly.
2020-12-07 14:54:35 +00:00
Nicolas A. Schmidt
ef6cbcf658
Auto-implicit __con now added before implicits. (#659) 2020-12-07 11:41:47 +00:00
Denis Buzdalov
b3542d66fc
Have lambda-case available everywhere lambda is (#819) 2020-12-07 11:34:48 +00:00
Guillaume ALLAIS
d30e984137 [ debug ] Give the option to log off 2020-12-07 11:33:37 +00:00
Edwin Brady
778d6026e5
Merge pull request #607 from Russoul/record-init
New syntax for named applications and "record" updates
2020-12-04 11:35:05 +00:00
Fabián Heredia Montiel
57a8ef4609
Implement Futures as a Parallelism Primitive (#753)
Co-authored-by: Christian Rasmussen <christian.rasmussen@me.com>
2020-12-04 10:58:26 +00:00
russoul
46519237cd Merge 2020-12-03 15:28:20 +03:00
Edwin Brady
b244d26cd1
Merge pull request #731 from rbarreiro/issue_596
adds mutual recursion optimisation to the javascript backend
2020-12-03 11:48:44 +00:00
G. Allais
502f544d73
[ fix #775 ] integerToNat is not, in fact, id (#799) 2020-11-27 18:48:19 +00:00
Giuseppe Lomurno
c82e2393d4
Test templates (#585)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2020-11-27 15:40:02 +00:00
G. Allais
5e799563fa
[ contrib ] adding Data.Container (#781) 2020-11-27 15:29:19 +00:00
Kamil Shakirov
127db79a6b Require all definitions to be total in tests/typedd-book/chapter11/ArithCmdDo.idr 2020-11-27 11:59:30 +00:00
Alex Humphreys
71a638ef28 Add extra parsers
This also changes the return type of `char` and `string`. They
previously returned `()`, they now return `Char` and `String`
repectively.

Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-11-27 11:54:12 +00:00
Yu Zhang
08a35d694c
Improving error messages (#786)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2020-11-26 11:35:55 +00:00
Denis Buzdalov
60c8695a6d Editor was made run apostrophe-containing modules from REPL normally. 2020-11-26 11:17:36 +00:00
Denis Buzdalov
9990b5ad29 Namespaces were shadowed in all standard codegens.
This allows, for exmaple, to have apostrophes in module names.
Test was added only for chez, however this should be viable for all
targets with `:exec` implemented.
2020-11-26 11:17:36 +00:00
Guillaume ALLAIS
22bfa90971 [ fix ] recoverability criteria
If the "can't convert" error arises from a mismatch between a type
constructor and a primitive value, it is not recoverable.
2020-11-11 19:10:34 +00:00
Giuseppe Lomurno
b0b8330cd9 New IDEMode syntax option and fixed output 2020-10-31 03:51:19 +01:00
Christian Rasmussen
66fe57f340 Run tests chez029 and node022 via code generator 2020-10-24 12:34:04 +01:00
Edwin Brady
ccdfc363e3
Merge pull request #739 from edwinb/refcount-c
Experimental C backend with reference counting
2020-10-21 11:12:28 +01:00
Jan de Muijnck-Hughes
de58c66ab2
Make Idris2 test harness available for the many and not the few. (#719)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2020-10-19 09:26:23 +01:00
Guillaume ALLAIS
14d0141ca2 [ fix #735 ] Make sure type constructors are fully applied 2020-10-16 14:44:11 +01:00
Guillaume ALLAIS
7192ef28a3 [ test ] add IDRIS2_TESTS_CG env variable 2020-10-16 14:44:11 +01:00
russoul
fd90141ed9 Merge branch 'master' of https://github.com/idris-lang/Idris2 into master 2020-10-12 17:36:45 +03:00
Edwin Brady
788bea3906 Update tests to list refc 2020-10-11 15:59:22 +01:00
Matus Tejiscak
668762e693 Merge branch 'revert-projections' into master 2020-10-11 08:12:00 +02:00
Rui Barreiro
44151ecbae Merge branch 'master' of github.com:idris-lang/Idris2 into issue_596 2020-10-05 14:47:17 +01:00
Rui Barreiro
a5b2247f28 mutual tail recursion 2020-10-05 14:39:38 +01:00
russoul
0824e93874 Add more defs and comments into the test file 2020-10-03 19:26:21 +03:00
G. Allais
5e85446e9c
[ fix #724 ] Typo in the magic string (#726) 2020-10-03 14:39:13 +01:00
russoul
98bfff4a27 Merge branch 'master' of https://github.com/idris-lang/Idris2 into master 2020-10-03 11:51:48 +03:00
russoul
d49bf75eac Clean up 2020-10-03 11:50:38 +03:00
G. Allais
4a61146ba0
[ fix #705 ] Normalise primitives in mkPat (#718)
[ log ] prettier log for pats & clauses
[ re #650 ] Even lazier
[ fix #705 ] normalise primitives in mkPat
[ refactor ] introduce getPrimitiveNames
2020-10-02 12:22:57 +01:00
russoul
a667aae797 Fix another DPair parsing regression 2020-10-02 11:22:48 +01:00
MarcelineVQ
1619206d24 add specifier check for cli compilation
Missed a case which is covered now by checking for exceptions where
postOptions is used

add *> <* to Core
2020-10-01 14:12:31 +01:00
russoul
b57b28a64e Implement new application syntax
Add syntax for bind-all-explicits

Add new record update syntax

Remove PInstance
2020-10-01 12:43:43 +03:00
Rodrigo B. de Oliveira
a7cf1143b6 Make NmLet names unique in Compiler.ES.Imperative
Since the imperative form has no nesting of scopes.

Fixes #643
2020-09-30 13:43:59 +01:00
Ruslan Feizerahmanov
1d99a28176
Add Bifunctor interface (#701) 2020-09-30 10:51:07 +01:00
russoul
af62955e07 Merge branch 'master' of https://github.com/idris-lang/Idris2 into master 2020-09-29 12:58:28 +03:00
G. Allais
3df1f9c476
[ fix #63 ] interleaving let binders and local declarations (#691) 2020-09-28 13:15:22 +01:00
Guillaume ALLAIS
416b9578e5 [ fix #37 ] Use filename if we already know it 2020-09-24 15:56:23 +01:00
Guillaume ALLAIS
0d08c0b81b [ log ] for desugaring of idioms 2020-09-24 15:27:40 +01:00
MarcelineVQ
961a28ee64 fix idiom brackets to account for IAlternative
Things like (,) () aren't straightforward IVar's but are IAlternative's
which present options about how the term should resolve. [| |] was not
accounting for this.
2020-09-24 15:27:40 +01:00
Guillaume ALLAIS
cc31076849 [ test ] more corner cases
Making sure the test can distinguish between truncating & rounding.
2020-09-23 19:48:58 +01:00
Guillaume ALLAIS
621a9202ed [ test ] making sure cast works 2020-09-23 19:48:58 +01:00
Christian Rasmussen
091465525b Remove FArgList 2020-09-23 18:33:19 +01:00
G. Allais
d105dd11a7
[ breaking ] remove List1 related ambiguities (#690) 2020-09-22 15:07:40 +01:00
MarcelineVQ
e03096188a add more Name reflections
broaden what Names can be reflected and refied
I did not add the Names I wasn't sure how to test but have put placeholders
that produce clearer error messages.
2020-09-20 00:54:49 -07:00
G. Allais
8d09ec9c93
[ new ] comma-separated interface parameters (#682) 2020-09-19 15:29:23 +01:00
G. Allais
3008c48f77
Adding a whole bunch of tuple sections (#680) 2020-09-19 14:51:57 +01:00
Guillaume ALLAIS
2bb95e59ef [ re #660 ] eta-contract parameter candidates 2020-09-16 15:45:16 +01:00
Guillaume ALLAIS
1152aa3cdd [ re #660 ] inline lets when detecting parameters 2020-09-16 15:45:16 +01:00
Giuseppe Lomurno
98e54cea2f Missing runElab decl check 2020-09-16 12:06:38 +01:00
Chetan Taralekar
3c24bc5ed5
Fix ide mode repl not converting escaped characters (#665) 2020-09-16 10:55:44 +01:00
MarcelineVQ
19bad79847 change runState's to take state first to allow easier use 2020-09-15 09:23:41 +01:00
Guillaume ALLAIS
65e194e9bb [ re #660 ] Positivity checking for empty types 2020-09-14 18:37:47 +01:00
MarcelineVQ
5673d188f3 add nicer errors for bad specifiers 2020-09-13 10:10:53 +01:00
MarcelineVQ
5acb306bf9 add ability to target scheme flavor in foreign specifiers
There's some missing flexibility in how foreign specifiers can be used with
scheme that is addressed here with minimal changes to how scheme specifiers
are read. This opens up uses for users that they otherwise would have had
to modify the compiler's support files to accomplish.
2020-09-13 10:10:53 +01:00
Matus Tejiscak
9652179990 Add two cases to the record projection test. 2020-09-11 00:29:14 +02:00
Matus Tejiscak
ba89bbcc0d Fix tests some more. 2020-09-10 20:41:58 +02:00
Matus Tejiscak
d98686d4f8 Update doc, fix tests. 2020-09-10 20:33:08 +02:00
Matus Tejiscak
e491e2969e Re-introduce %prefix_record_projections. 2020-09-10 20:18:51 +02:00
Matus Tejiscak
aebe3c19d9 Revert postfix dotted application. 2020-09-10 19:00:48 +02:00
Ohad Kammar
0600a9ba11 Fix bug #654
Auxiliary functions introduced in elaboration (e.g., through case splits and with clauses) now
have the same totality annotation as the function they're defined in.

Moved auxiliary function `findSetTotal` into `Context.idr` since it's
now used by `ProcessDef.idr` too.

Added a totality requirement argument to `checkClause` so that the
with-clause case could propagate it to the functions it generates in
elaboration.

Sandwhich the rhs elaboration in pattern matches with code that sets
the global, default, totality requirement to the current one, and
restores the previous default afterwards. It's a bit of a hacky way to
do it, but I don't think we have a better alternative with the current
design.
2020-09-10 08:08:59 +01:00
G. Allais
1963ac8786
[ fix #650 ] Lazier match in NPrimVal vs. ConCase (#655) 2020-09-09 17:17:07 +01:00
G. Allais
a0c0974676
[ debug ] pretty printer for case trees (#652) 2020-09-09 16:22:22 +01:00
russoul
9565f6cf8b Fix DPair parsing 2020-09-05 11:08:44 +01:00
G. Allais
937aa8fc43
[ refactor ] introducing Namespace (#638)
Until now namespaces were stored as (reversed) lists of strings.
It led to:

* confusing code where we work on the underlying representation of
  namespaces rather than say what we mean (using `isSuffixOf` to mean
  `isParentOf`)

* potentially introducing errors by not respecting the invariant cf.
  bug report #616 (but also name generation in the scheme backend
  although that did not lead to bugs as it was self-consistent AFAICT)

* ad-hoc code to circumvent overlapping interface implementation when
  showing / pretty-printing namespaces

This PR introduces a `Namespace` newtype containing a list of strings.
Nested namespaces are still stored in reverse order but the exposed
interface aims to support programming by saying what we mean
(`isParentOf`, `isApproximationOf`, `X <.> Y` computes to `X.Y`, etc.)
irrespective of the underlying representation.
2020-09-05 09:41:31 +01:00
Guillaume ALLAIS
529944267b Revert "[ refactor ] Introducing Namespace and ModuleIdent (#631)"
This reverts commit 481dc431e7.
2020-09-04 09:16:06 +01:00
G. Allais
481dc431e7
[ refactor ] Introducing Namespace and ModuleIdent (#631)
Until now namespaces were stored as (reversed) lists of strings.
It led to:

* confusing code where we work on the representation rather than say
  what we mean (e.g. using `isSuffixOf` to mean `isParentOf`)

* potentially introducing errors by not respecting the invariant cf.
  bug report #616 (but also name generation in the scheme backend
  although that did not lead to bugs as it was self-consistent AFAICT)

* ad-hoc code to circumvent overlapping interface implementations when
  showing / pretty-printing namespaces

This introduces a Namespace newtype containing non-empty lists of
strings. Nested namespaces are still stored in reverse order but the
exposed interface aims to support programming by saying what we mean
(`isParentOf`, `isApproximationOf`, `X <.> Y` computes to `X.Y`, etc.)
irrespective of the underlying representation.
2020-09-02 20:05:33 +01:00
russoul
394b433c59 Typo 2020-09-01 16:18:13 +03:00
russoul
16407b7f08 Make sure there is no unexpected holes 2020-09-01 14:34:46 +03:00
russoul
8338b7adbc Tweaks 2020-09-01 14:32:24 +03:00
russoul
87a58d30d0 Tweak record error, update expected output 2020-09-01 13:46:06 +03:00
russoul
cb1a5f663c Implement #553 V2 2020-09-01 13:31:59 +03:00
russoul
0dfd59d695 Add typedriven resolution, make code a bit prettier 2020-09-01 13:31:22 +03:00
Guillaume ALLAIS
9734b72349 [ test ] for empty records 2020-09-01 13:31:22 +03:00
russoul
53fe889b28 Refine test a bit 2020-09-01 13:31:22 +03:00
russoul
13634e769e Merge 2020-09-01 13:31:14 +03:00
Guillaume ALLAIS
b449e5ae8a [ fix #361 ] Use the default totality by default 2020-08-31 16:42:53 +01:00
MarcelineVQ
57e7f14bca add binary literals
Written via "0b" in the manner of other literals. e.g. 0b111001 = 57
2020-08-31 08:48:05 +01:00
russoul
7de26e7d75 Fix #616 2020-08-30 19:32:33 +01:00
Guillaume ALLAIS
9c59542081 [ new ] allow auto fields in records 2020-08-28 11:38:10 +01:00
Guillaume ALLAIS
c17c6fc522 [ log ] stuck functions found during evaluation 2020-08-27 19:42:52 +01:00
Guillaume ALLAIS
e64a3e910c [ test ] cleanup basic044
All of these internal names are making the output fragile. This
cleanup should allow us to only have to update the golden file
when there is a genuinely interesting change.
2020-08-25 09:33:39 +01:00
Alex Gryzlov
ef5299733a
refactor Data.String.Parser (#579) 2020-08-22 08:13:34 +01:00
G. Allais
56209de4ca
[ close #270 ] Add FC to Binder (#296) 2020-08-21 19:03:53 +01:00
Niklas Larsson
5f1d391242 Make the run script executable 2020-08-21 12:24:23 +02:00
Niklas Larsson
2a45854b96 Add CI checking for the API 2020-08-21 11:51:21 +02:00
lodi
3b49b10832
add extraRuntime option for Scheme backends (#578) 2020-08-21 09:34:57 +01:00
G. Allais
da78ac4783
[ new ] topics for logging levels (#569) 2020-08-20 18:45:34 +01:00
karroffel
7d046652d8
add support for more casts from and to BitsN types (#548)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2020-08-20 15:01:09 +01:00
Kamil Shakirov
8544e80076 Use the same naming convention for foreign primitives 2020-08-19 14:05:28 +01:00
Kamil Shakirov
1d601384ce Rename --consolewidth option to --console-width for consistency 2020-08-19 11:59:31 +01:00
Giuseppe Lomurno
63c15352f4 Prettyprinting hole context 2020-08-18 19:25:36 +01:00
Giuseppe Lomurno
cef2fbbccd Better term printing 2020-08-18 19:25:36 +01:00
Giuseppe Lomurno
42404c2d9d Automatic console width detection 2020-08-18 19:25:36 +01:00
Giuseppe Lomurno
f658ce357f More improvements
- More migrations from String to Doc
- File context in parser errors
2020-08-18 19:25:36 +01:00
Giuseppe Lomurno
607352a191 Error suggestions 2020-08-18 19:25:36 +01:00
Giuseppe Lomurno
6298a6741d Adds bounds to compiler parser
- Added primitive to compiler parser for precise text boundaries
- Reworked parser with the new primitive
2020-08-18 19:25:36 +01:00
Giuseppe Lomurno
5e9837828a Implementations and errors
- Added initial implementations for terms and values
- Error messages converted to pretty printer
- Colorization for error messages
- Color and console width option both as command line and repl command
2020-08-18 19:25:36 +01:00
Giuseppe Lomurno
df4f990b3c PTerm and error intial prettyprinting 2020-08-18 19:25:36 +01:00
Niklas Larsson
76ee7a3b34
Merge pull request #351 from petithug/fixity-precedence-master
Restore Bool operators precedence
2020-08-18 14:08:20 +02:00
Niklas Larsson
93ecb72012
Merge pull request #526 from alexhumphreys/feat/buildExpressionParser
Add BuildExpressionParser to contrib
2020-08-18 14:01:20 +02:00
Kamil Shakirov
68bd8bba52 More post-Idris2-boot cleanups 2020-08-17 13:16:22 +06:00
Edwin Brady
04e05e3f86 Fix repeated argument check
As it was, it could break if the argument was repeated more than twice.
When checking dot patterns, we need to check that no further holes are
solved, and that the pattern variable doesn't unify with some other
pattern variable, but if it had already made progress (either for a good
or bad reason) we missed this. Fixes #536
2020-08-10 14:03:34 +01:00
Alex Humphreys
f47d9cfef2 Add integer paser and extra test
Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-08-10 13:26:20 +02:00
Alex Humphreys
d4cbb8a620 Move natural and digit combinators
Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-08-07 19:20:32 +02:00
Edwin Brady
15b31e69d0
Merge pull request #533 from edwinb/dpair-parse
Refactor grammar for dependent pairs
2020-08-07 17:04:39 +01:00
Edwin Brady
b786621ed6 Refactor grammar for dependent pairs
As it was, there was significant backtracking for big expressions,
getting to the end, not finding a **, so having to try again for
application expressions. Fixes #532
2020-08-07 16:30:25 +01:00
Mark Barbone
e73fdac5cd
Add simple test for implicit binding around quotes 2020-08-06 20:58:02 -04:00
Alex Humphreys
40427bd527 Move combinators to Data.String.Parser 2020-08-06 13:16:47 +02:00
Alex Humphreys
97b41d1ad9 Rename BuildExpressionParser to Parser.Expression
Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-08-06 12:42:38 +02:00
Alex Humphreys
29e49a74c5 Add BuildExpressionParser to contrib
Signed-off-by: Alex Humphreys <alex.humphreys@here.com>
2020-08-06 08:59:57 +02:00
Giuseppe Lomurno
c28133b7d9 Renamed IsString to FromString
- Renaming of the string overload interface
- Added test cases for both string and integer literals overload
2020-08-05 02:33:05 +02:00
Giuseppe Lomurno
b7ba5e88eb Overloaded strings interface
As for integer literals, adds an interface for overloaded string
literals, and the implementation for the prettyprinter library in
contrib.
2020-08-05 02:00:05 +02:00
Edwin Brady
28bb45c61f
Merge pull request #522 from edwinb/more-search
More search improvements
2020-08-04 22:05:23 +01:00
Edwin Brady
45aa8f5815 Add a test for proof search 2020-08-04 20:55:48 +01:00
G. Allais
0a7ea69df5
[ refactor ] introduce List1 to remove impossible case (#520) 2020-08-04 20:03:18 +01:00
Edwin Brady
3c601d9878 Fix recursive call checking in proof search
Need to use full names consistently to check for structural difference
2020-08-04 19:24:58 +01:00
Edwin Brady
3a6614b227 Look at intermediate results in program search
This has involved quite a bit of reorganisation and some improvements in
resugaring so that the results look nice. In summary:

* Expression search now gives back a RawImp rather than a checked term,
  which allows it to include case expressions
* Case with one pattern is resugared to a destructuring let
* Some name generation issues address in function generation

We look at intermediate results for local variables which are functions
that return a concrete type, or recursive calls that return a single
constructor type. In these cases, we:

* let bind the local variable/recursive call
* generate a new definition for the scope, as a 'case' function

When we recursively generate the definition, it's a bit more restricted
so as not to explode the search space. We only take the first result, we
only look one constructor deep, and we go right to left on variable
splitting so only deconstruct the name we've just added.
2020-08-04 12:51:57 +01:00
Edwin Brady
ff48bb2310 Update literate test results
New search heuristic finds a slightly better zipWith, in particular.
2020-07-30 00:08:06 +01:00
Edwin Brady
8d7fa5c642 Add a heuristic for sorting search results
Sort by proportion of bound variables used, which is likely to get us
the right answer quicker. The results are generated in batches of 16 (a
completely arbitrary choice) then sorted.
2020-07-29 23:54:52 +01:00
Edwin Brady
7083f7ac13 Add a 'reject' count to :gd
This gives the number of implementations to reject before accepting one.
It's intended as a reasonably cheap way of giving multiple results from
interactive editing (e.g. the vim mode, which goes via the REPL and
--client rather than the IDE mode)
2020-07-27 14:56:16 +01:00
Edwin Brady
df635cf8d7 Add :psnext and :gdnext at the REPL
These continue the search from :ps and :gd next respectively, giving the
next search result until there are no more results.
Correspondingly, added ':proof-search-next' and ':generate-def-next' in
IDE mode, which continue the search from the previous ':proof-search'
and ':generate-def' respectively.
2020-07-27 13:45:10 +01:00
Edwin Brady
6d96341776 Reorganise expression search
Rather than returning a complete list of results, return a pair of the
first result, and a continuation. The continuation explains how to
continue the search if the given result is deemed unacceptable (either
on encountering an error somewhere, or just if the caller wants the next
result).

This means we don't search needlessly if we're only looking for the
first result. Fixes #228
2020-07-26 17:34:24 +01:00
Niklas Larsson
8a210d536e
Merge pull request #408 from melted/buffer_api
Add concatBuffers and splitBuffer to Data.Buffer
2020-07-21 10:43:17 +02:00
Edwin Brady
690328421a Delay building references for case blocks
...until the definition is complete. This is necessary since sometimes
information outside the case block can help resolve interfaces, and in
the simplest case, we might just have delayed resolving a default
Integer. It turns out this was also an obscure bug waiting to happen
with coverage checking of nested case blocks (so there's a test update
there too).

Fixes #443
2020-07-18 19:22:03 +01:00
Marc Petit-Huguenin
bc21299c51
Restore Bool operators precedence
(&&) traditionally has higher precedence than (||).

Note that this commit requires to bootstrap again.
2020-07-18 05:49:35 -07:00
Edwin Brady
f303e469fb Improve elaborator reflection performance
In a 'Bind', normalise the result of the first action, rather than
quoting the HNF. This improves performance since the HNF could be quite
big when quoted back.

Ideally, we wouldn't have to quote and unquote here, and we can probably
achieve this by tinkering with the evaluator.

This has an unfortunate effect on the reflection002 test, in that the
"typed template Idris" example now evaluates too much. But, I think the
overall performance is too important for the primary motivation
behind elaborator reflection. I will return to this!
2020-07-17 15:18:23 +01:00
Niklas Larsson
6233bbd583
Merge pull request #465 from memoryruins/case-declarations
Wrap Javascript case clauses in brackets to prevent conflicting declarations
2020-07-14 21:29:02 +02:00
memoryruins
7ab00bd191 add test for js case clause scopes 2020-07-14 14:22:08 -04:00
Guillaume ALLAIS
62a5406533 [ fix #454 ] compiling nonexisting file 2020-07-14 15:23:00 +01:00
Dmitry
de00ff74d5
Allow to override log level with package options (#411) 2020-07-14 12:17:03 +01:00
G. Allais
0908e76515
[ fix #346 ] Pull List.length into prelude (#450) 2020-07-14 12:15:57 +01:00
Niklas Larsson
26f9c8a25c
Merge pull request #459 from rbarreiro/master
fix #447
2020-07-13 10:18:36 +02:00
Nick Drozd
e14a589e90 Consolidate boolean expressions 2020-07-12 21:00:33 -05:00
Nick Drozd
6519b5608d Further simplify List 2020-07-12 21:00:33 -05:00
Edwin Brady
6a53e0177c Reorganise prelude into multiple files
This is partly to tidy things up, but also a good test for 'import as'.
Requires some internal changes since there are parts of reflection,
unelaboration and a compiler hack that rely on where things are in the
Prelude.
2020-07-12 16:55:48 +01:00
Rui Barreiro
98f2b8a246 update test 2020-07-12 10:26:30 +01:00
Rui Barreiro
ccf441f42b fix #447 2020-07-12 10:13:45 +01:00
Matthew Ess
6452cdbbd4
Add Ord implementation for Either (#439) 2020-07-09 19:28:59 +01:00
Edwin Brady
23cbc28b1d
Merge pull request #415 from rbarreiro/javascript
Javascript
2020-07-08 22:27:58 +01:00
Edwin Brady
28b52fbc48
Merge pull request #432 from edwinb/docstrings
Initial implementation of :doc and :browse
2020-07-08 18:28:14 +01:00
Edwin Brady
6dce3a0735 Add :browse
Lists all the names in a namespace with their types, and the first line
of their docstring if it exists
2020-07-08 17:56:54 +01:00
Edwin Brady
b0c226f05b Extract interface info from hints 2020-07-08 17:21:28 +01:00
Edwin Brady
656a9d8f98 Also display methods of interfaces
Displaying implementations is a better harder at the moment, since
they're implemented via search hints...
2020-07-08 16:52:56 +01:00
Edwin Brady
ff46a8db14 Initial implementation of :doc
It's not pretty, but at least it exists now
2020-07-08 15:52:57 +01:00
Guillaume ALLAIS
301666b91d [ fix #423 ] --repl should load the main file 2020-07-08 15:29:37 +01:00
Edwin Brady
2959829605
Merge pull request #426 from edwinb/record-implicits
Leave implicit record fields alone on update
2020-07-08 00:33:23 +01:00
Edwin Brady
58359c2d01 Leave implicit record fields alone on update
Unless an explicit update is given
2020-07-07 22:36:15 +01:00
Matus Tejiscak
634fe4d171 Fix tests. 2020-07-07 21:06:35 +01:00
Matus Tejiscak
a4c59204c5 Add postfix projection sections. 2020-07-07 21:06:35 +01:00
Matus Tejiscak
ca2c9163c7 Implement %language PostfixProjections. 2020-07-07 21:06:35 +01:00
Matus Tejiscak
c9aa733626 Add more test examples. 2020-07-07 21:06:35 +01:00
Matus Tejiscak
b46064f688 Update docs and tests. 2020-07-07 21:06:35 +01:00
Rui Barreiro
2feb4b8299 Merge branch 'master' of github.com:idris-lang/Idris2 into javascript 2020-07-07 14:18:00 +01:00
Nick Drozd
7d5788471d Update tests 2020-07-07 10:48:23 +01:00
Edwin Brady
77ad6eac0a
Merge pull request #422 from edwinb/record-implicits
Pay attention to implicits in record update
2020-07-06 18:06:43 +01:00
Edwin Brady
0cf37f621b Pay attention to implicits in record update
Resolves #421
2020-07-06 17:39:55 +01:00
Rui Barreiro
3acc30599e Merge branch 'master' of github.com:idris-lang/Idris2 into javascript 2020-07-06 17:09:11 +01:00
Niklas Larsson
468c8cbae3
Merge pull request #414 from melted/simple_parser
Add a simple parser combinator library for strings
2020-07-06 17:16:19 +02:00
Edwin Brady
abdadead0a More liberal with alternatives in with blocks
Only need to match one possibility (it's essentially impossible to match
more than one after all!). Fixes #297.
2020-07-06 14:23:15 +01:00
Edwin Brady
666ecb36b5 Preserve @ patterns when totality checking case
Resolves #300
2020-07-06 14:03:34 +01:00
Edwin Brady
e25f0a57f9 Use correct implicit generation function
Should make a default implicit, not an auto implicit, when running out
of arguments and expecting a default implicit. Fixes #371
2020-07-06 14:02:45 +01:00
Niklas Larsson
52c6db09d1 Add <?> for replacing error messages 2020-07-06 14:13:56 +02:00
Rui Barreiro
b3216758e9 Merge branch 'master' of github.com:idris-lang/Idris2 into javascript 2020-07-06 11:32:59 +01:00
Niklas Larsson
af83c9303b Add test and documentation 2020-07-05 21:51:12 +02:00
Edwin Brady
8774df8800 Use a String, not an Int, for case/with names
The Int represented the resolved name, but this isn't guaranteed to be
up to date after reloading and, worse, it doesn't display helpfully. I'm
bored of updating the tests which fail as a result!

This also fixes #407, which is about displaying the wrong name after
reloading the ttc.
2020-07-05 20:02:50 +01:00
Rui Barreiro
35961676bc changed tests 2020-07-05 18:55:34 +01:00
Edwin Brady
5487290499
Merge pull request #282 from ether42/master
Fix MkRecord signature
2020-07-05 14:03:57 +01:00
Rui Barreiro
88f8e745b1 Merge branch 'master' of github.com:idris-lang/Idris2 into javascript 2020-07-05 12:19:45 +01:00
Rui Barreiro
4db8c84fe3 self tail rec 2020-07-05 11:53:45 +01:00
Edwin Brady
2ce0335fd5 Implement qualified do
This allows do blocks to be qualified with the namespace that the (>>=)
operator is defined in. Inspired by Purescript's version of the same
thing, and this ghc proposal:
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0216-qualified-do.rst
2020-07-04 23:01:43 +01:00
Edwin Brady
45a9668370 Export all of the Prelude as Prelude
There is an argument that, for import public, this should be automatic
(that is, the publicly imported things should be reexported with the
parent namespace). I decided not to do this, because another use of
import public which we do a lot in the Idris 2 code base is purely as a
convenience, where we still expect things to be in their original
namespace.
Also, where there's a choice between things being explicit and implicit,
I prefer to err on the side of explicit now.
So, if what you really want in an API is to reexport, you can do that,
but explicitly.
2020-07-04 21:57:54 +01:00
Edwin Brady
028624a18d Add "import X as Y" properly
Instead of just the cursory name update that we used to do (which didn't
work properly anyway for a lot of reasons), now we add aliases for all
the names in the imported module.
So, like Idris 1, every global has a canonical name by which we can
refer to it, but it can also have aliases via "import ... as".
2020-07-04 20:26:49 +01:00
Alex Gryzlov
afde930e7a
Vect updates (#335) 2020-07-04 11:02:04 +01:00