Commit Graph

2607 Commits

Author SHA1 Message Date
Guillaume ALLAIS
e8aa95479c [ cleanup ] remove duplicated code 2021-10-07 16:07:03 +01:00
Robert Wright
937ab7157c Add Cast to JSON interface implementations 2021-10-06 18:35:25 +01:00
Robert Wright
8c44f423cc Add JSON Show as Idris code interface implementation 2021-10-06 18:35:25 +01:00
Mathew Polzin
76b90cc816
Merge pull request #1960 from attila-lendvai/fix-install-libs 2021-10-05 11:03:33 -07:00
G. Allais
7936bf77d7
[ fix #1744 ] Compare names by root rather than UserName (#1975) 2021-10-05 15:06:16 +01:00
Attila Lendvai
cab5a0a19b
makefile: propagate IDRIS2_INC_CGS=${IDRIS2_CG} to install-libs
Without this change install-libs will not install the .so files, and
consequentially the test 'chez/chez033' fails with 'Error: INTERNAL
ERROR: Missing .so:Prelude/Cast.so' when it is run by an installed
executable.

Also add a test-installed makefile target to run the tests using the
installed executable.
2021-10-04 17:43:00 +02:00
Guillaume ALLAIS
5f314bf103 [ fix idris-hackers/idris-mode#542 ] Bring Metavars back
IDEmode's `Metavariables` should not simply be a wrapper for REPL's.
2021-10-04 14:12:15 +01:00
Guillaume ALLAIS
bb5a891f26 [ refactor ] Share the duplicated code via prettyHoles 2021-10-04 14:12:15 +01:00
Alex Dikelsky
1ba3d8a84b
Backend cookbook rst and typo fixes (#1966) 2021-10-04 11:32:50 +01:00
Mathew Polzin
ebc340c41e
Merge pull request #1961 from attila-lendvai/fix-test-pkg010
[tests] fix idris2/pk010: make it more roboust
2021-10-03 08:04:31 -07:00
Mathew Polzin
7b19099763
print location of implicit name shadowing with the warning. (#1968)
* print location of implicit name shadowing with the warning.

* move location output to bottom of warning.
2021-10-03 10:15:01 +01:00
Mathew Polzin
fa06e9936b
Warn about unreachable default clauses (#1942)
* so much experimentation

* tests that show preliminary evidence the new stuff is working.

* small amount of cleanup

* more cleanup of various troubleshooting code.

* new test case added.

* only log unreachable indices if there are any.

* when traversing deeper simply skip over defaults since they have already been reviewed.

* Remove fallback clause that the changes in this PR correctly identified as unreachable.

* tidying up more.

* move some common functions to a new Core.Case.Util module.

* refer to case builder and case tree under new parent module.

* update imports to look for CaseTree in new submodule.

* update api ipkg

* remove unneeded application operators.

* remove or comment out unreachable default clauses caught by the changes in this PR.

* a bit of code documentation and renaming for clarity.

* bump previous version in CI.

* fix API usage of Util module.

* Add issue 1079 test cases.

* forgot to add new test cases file.

* remove commented-out lines by request of RefC author.

* Use a SortedSet instead of nubbing a list.

* update new case tree import.

* Update src/Core/Case/Util.idr

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>

* remove function with nothing to offer above and beyond a differently named copy of the same code.

* replace a large tuple with a record; discover not all of the tuple's fields were needed.

* fix shadowing warning.

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
2021-10-02 12:55:21 +01:00
stefan-hoeck
3536f8dab5 [ new ] DecEq for Int types 2021-09-30 11:38:38 +01:00
Attila Lendvai
e15a859613
[tests] fix idris2/pk010: make it more roboust 2021-09-29 18:42:20 +02:00
Edwin Brady
a9ccf4db4f
Experimental Scheme based evaluator (#1956)
This is for compiled evaluation at compile-time, for full normalisation. You can try it by setting the evaluation mode to scheme (that is, :set eval scheme at the REPL). It's certainly an order of magnitude faster than the standard evaluator, based on my playing around with it, although still quite a bit slower than compilation for various reasons, including:

* It has to evaluate under binders, and therefore deal with blocked symbols
* It has to maintain enough information to be able to read back a Term from the evaluated scheme object, which means retaining things like types and other metadata
* We can't do a lot of the optimisations we'd do for runtime evaluation particularly setting things up so we don't need to do arity checking

Also added a new option evaltiming (set with :set evaltiming) to display how long evaluation itself takes, which is handy for checking performance.

I also don't think we should aim to replace the standard evaluator, in general, at least not for a while, because that will involve rewriting a lot of things and working out how to make it work as Call By Name (which is clearly possible, but fiddly).

Still, it's going to be interesting to experiment with it! I think it will be a good idea to use it for elaborator reflection and type providers when we eventually get around to implementing them.

Original commit details:

* Add ability to evaluate open terms via Scheme

Still lots of polish and more formal testing to do here before we can
use it in practice, but you can still use ':scheme <term>' at the REPL
to evaluate an expression by compiling to scheme then reading back the
result.

Also added 'evaltiming' option at the REPL, which, when set, displays
how long normalisaton takes (doesn't count resugaring, just the
normalisation step).

* Add scheme evaluation mode

Different when evaluating everything, vs only evaluating visible things.
We want the latter when type checking, the former at the REPL.

* Bring support.rkt up to date

A couple of missing things required for interfacing with scheme objects

* More Scheme readback machinery

We need these things in the next version so that the next-but-one
version can have a scheme evaluator!

* Add top level interface to scheme based normaliser

Also check it's available - currently chez only - and revert to the
default slow normaliser if it's not.

* Bring Context up to date with changes in main

* Now need Idris 0.5.0 to build

* Add SNF type for scheme values

This will allow us to incrementally evaluate under lambdas, which will
be useful for elaborator reflection and type providers.

* Add Quote for scheme evaluator

So, we can now get a weak head normal form, and evaluate the scope of
a binder when we have an argument to plug in, or just quote back the
whole thing.

* Add new 'scheme' evaluator mode at the REPL

Replacing the temporary 'TmpScheme', this is a better way to try out the
scheme based evaluator

* Fix name generation for new UN format

* Add scheme evaluator support to Racket

* Add another scheme eval test

With metavariables this time

* evaltiming now times execution too

This was handy for finding out the difference between the scheme based
evaluator and compilation. Compilation was something like 20 times
faster in my little test, so that'd be about 4-500 times faster than the
standard evaluator. Ouch!

* Fix whitespace errors

* Error handling when trying to evaluate Scheme
2021-09-24 20:38:55 +01:00
Stefan Höck
d180bd4b8c
[ performance ] CSE in linear space (#1949) 2021-09-24 11:28:15 +01:00
Daniel Kröni
931ff85164
Unify IR dumping functions. (#1953) 2021-09-24 11:24:20 +01:00
madman-bob
119d8321d4
[ fix ] Use qualified type name for record elaboration (#1871) (#1948)
* [ fix ] Use qualified type name for record elaboration (#1871)

* Clarify record elaboration `Name` arguments
2021-09-24 11:23:46 +01:00
Guillaume ALLAIS
f4bd911f13 [ fix #1943 ] Allow operator names in named argument applications 2021-09-23 11:41:25 +01:00
Guillaume ALLAIS
a0846af5fa [ decor ] highlighting comments too
Even though the `Comment` aspect is not (currently) supported
in the IDEMode, this is crucial to get proper highlighting in
Katla's LaTeX & HTML backends.
2021-09-20 17:00:25 +01:00
G. Allais
0c551eca87
[ ci ] new bootstrap-specific build (#1936) 2021-09-20 11:26:32 +01:00
Edwin Brady
bf0a157253
Disable -Xcheck-hashes, at least for the moment (#1940)
* Version increment to 0.5.1

This is to remove the requirement on Chez >9.5

* Disable -Xcheck-hases, at least for the moment

If we're going to have this as an option, we need to have a portable way
of finding a sha256sum command. At the moment, we might find a command,
but different versions accept different options. We should at least
allow setting it via an environment variable, and we certainly shouldn't
fail if running the command fails.

* Update bootstrap code ready for 0.5.1 release
2021-09-20 07:51:33 +01:00
Edwin Brady
1e90182311
Version increment to 0.5.1 (#1939)
This is to remove the requirement on Chez >9.5
2021-09-19 20:53:32 +01:00
Guillaume ALLAIS
87c1cb697f [ repl ] better printing of holes
* Fixed printing in the IDEMode (& include highlighting)
* Now also print the type of the holes
2021-09-19 17:49:51 +01:00
Edwin Brady
2e98dd6dab
Abandon auto search on undefined name (#1938)
* Abandon auto search on undefined name

These might arise from names in other modules that haven't been
imported. But it's going to be an error whatever, so give up straight
away. Fixes #1925

* Fix typo

* Fix test source

* Record possible cause when we can't solve a goal

Normally, it's just because we searched and failed. But maybe sometimes,
it's because there's an undefined name, in which case, we can include
this in the error message.

This is good to record because it means we don't abandon elaboration at
the wrong time! Say, if a search fails due to an undefined name, but it
was only in one branch of an ambiguous elaboration.

* Add necessary arguments for perf009 test
2021-09-19 14:31:29 +01:00
Edwin Brady
6802827ddc
Remove __collect_safe from bootstrap chez (#1933)
* Remove __collect_safe from bootstrap chez

We don't need this for bootstrapping, and it prevents building on older
Chez, so we can just remove it. Also added a note to the release
checklist.

* Update Release/CHECKLIST

Co-authored-by: memoryruins <memoryruinsmusic@gmail.com>

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
Co-authored-by: memoryruins <memoryruinsmusic@gmail.com>
2021-09-19 13:02:51 +01:00
Edwin Brady
ada3eb4449
Version 0.5.0 (#1931)
* Update version numbers and bootstrap scheme

* Use wall clock time for search timeouts

That was always the intention in any case, rather than the process time.
2021-09-18 16:07:34 +01:00
Edwin Brady
22c12046df
Small fix for incremental compilation (#1930)
* Small fix for incremental compilation

In incremental mode we need to add the arity of a compiled definition to
the hash, because if that changes, we need to rebuild the dependencies
too to make sure the arity is correct at the call site

* Fix indentation in CHANGELOG
2021-09-18 14:12:20 +01:00
James Cook
971afa9f5d
Add a transform rule making (++) for List tail-recursive. (#1888) 2021-09-16 15:35:29 +01:00
Ruslan Feizerakhmanov
34c7209020 Retain the --client mode behaviour 2021-09-16 14:42:12 +01:00
Kamil Shakirov
304c0e666d [ install ] Fix install-libdocs makefile target
On some systems, `/bin/sh` is a symlink to a minimal shell (e.g. `dash`) that doesn't understand bashisms like `mkdir -p some_dir/{one,two,three}`.
2021-09-16 14:34:55 +01:00
Denis Buzdalov
44328d73de [ fix ] Wrap paths in quotes for one more call for system 2021-09-16 10:49:18 +01:00
G. Allais
8b9916f5b1
[ html ] Various HTML docs fixes (#1924) 2021-09-15 18:41:37 +01:00
G. Allais
426441eecf
[ new ] persistent css switch and alternative style files (#1923) 2021-09-15 15:21:56 +01:00
Denis Buzdalov
f6281afe88
[ elab ] Erase check and quote's main argument (#1847) 2021-09-15 15:01:36 +01:00
G. Allais
32e26c5bd1
[ refactor ] introduce UserName for (UN/RF) (#1926)
Instead of having UN & RF (& Hole in the near future & maybe even
more later e.g. operator names) we have a single UN constructor
that takes a UserName instead of a String.

UserName is (for now)

```idris
data UserName : Type where
  Basic : String -> UserName -- default name constructor       e.g. map
  Field : String -> UserName -- field accessor                 e.g. .fst
  Underscore : UserName      -- no name                        e.g. _
```

This is extracted from the draft PR #1852 which is too big to easily
debug. Once this is working, I can go back to it.
2021-09-15 13:20:58 +01:00
Tim Engler
7baf698f66
Made unifying error msg nicer. (#1922)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-09-15 11:57:50 +01:00
Ruslan
4b4485969e
Thread the option of silencing output to stdout (#1919) 2021-09-15 10:38:23 +01:00
shenlebantongying
d4553a1a2d
Add chez-scheme to chez search path (#1921) 2021-09-14 12:07:44 +01:00
Denis Buzdalov
853547e99c [ golden ] Allow test dir names to contain spaces 2021-09-14 12:05:46 +01:00
Ruslan
9e4d97fbea
invFin: export ~> public export and invFinSpec (#1890)
* export ~> public export

* Add a theorem about `invFin` specification

* Lower the visibility level of `invFinSpec`
2021-09-10 16:06:11 +01:00
stefan-hoeck
281ae86ece [ fix ] string casts on js backends 2021-09-10 08:48:29 +01:00
Mathew Polzin
654d399eaf
Add function that checks whether a file handle points to a TTY device. (#1908)
* Add function that checks whether a file is a terminal device.

* support isTTY function for NodeJS backend.

* don't accidentally interpret 'false' string as truthy number

* less code duplication.
2021-09-10 08:05:21 +01:00
Guillaume ALLAIS
6a6ad3057d [ fix ] consolidating mismatchNF 2021-09-09 18:37:49 +01:00
Guillaume ALLAIS
1f85265193 [ re #1632 ] (->) does not unify with any of TCon/Type/PrimVal 2021-09-09 18:37:49 +01:00
G. Allais
911a907e74
[ highlighting ] Builtin.assert_ functions using postulate face (#1914) 2021-09-09 18:37:37 +01:00
Jan de Muijnck-Hughes
155989110b
[ base ] Indexing Vectors. (#1892) 2021-09-09 10:45:11 +01:00
Guillaume ANDRIEU
71511f4bdd
code-blocks missing in the docs (#1911)
* Update strings.rst

For some reasons the code blocks which are not set as 'idris' are not displayed in the readthedocs rendering.

* Update overloadedlit.rst

* Update overloadedlit.rst
2021-09-08 18:46:46 +01:00
Guillaume ALLAIS
6fcb8b1073 [ cleanup ] Compiler.Opts.CSE
* Use `when`
* Avoid testing `log "compiler.cse" 10` on every single entry of the list
2021-09-08 18:46:20 +01:00
Guillaume ALLAIS
30aa38f707 [ cleanup ] Compiler.Common 2021-09-08 18:46:20 +01:00