Commit Graph

949 Commits

Author SHA1 Message Date
Matus Tejiscak
b20ae8d36b Add a test. 2020-04-14 21:30:04 +02:00
Edwin Brady
806e8d2569 Faster inlining phase of compiler
It's still too slow, but better than it was. Instead of all the
weakening, invent a new name when evaluating under a lambda and
substitute later.
Possibly we can improve this later by substituting in batches, like the
main evaluator does.
2020-04-12 22:37:11 +01:00
Edwin Brady
0ed9f6cee6 Occasional performance boost
Check for conversion without reducing names, before unifying arguments.
This is quick to check, and can save a lot of evaluation.
2020-04-12 18:01:45 +01:00
Edwin Brady
841c3f27a5 Change order of argument search in auto implicits
For consistency with interactive expression search
2020-04-10 15:39:45 +01:00
Edwin Brady
69a7640a6e Allow flagging types as externally defined
e.g. in a C file. This means we don't accidentally treat things as
empty, since previously we just defined these as empty types, but that
broke coverage checking. Fixes #240
2020-04-10 11:45:52 +01:00
Edwin Brady
0daece1e0e Fix where under multiple cases
The names the locals were being applied to weren't being updated
properly, so applications of local functions inside case blocks were
sometimes given the wrong arguments. This is one of the few places where
it's hard to keep track of names in the type system! So naturally that'd
be where things go wrong I suppose...
2020-04-09 18:47:39 +01:00
Edwin Brady
6e02ffcb28 Local definitions need to be namespaced
It's unlikely, but possible, that there will be a clash otherwise since
the resolved names aren't unique between modules.
2020-04-09 14:06:53 +01:00
Edwin Brady
211fc359ca Erase %World for the purpose of newtypes
We never inspect it, so it carries no information - it just needs to be
there as a token to make sure that IO operations run at the right time.
So, IORes can be a newtype now and therefore optimised away.
2020-04-09 00:20:37 +01:00
Edwin Brady
471a47255f newtype optimisation
Data types with one constructor, that has one unerased argument, are
translated to that argument for runtime. This doesn't have a huge effect
on its own, but doing this will expose other optimisations later (e.g.
increasing effect of inlining).
2020-04-08 19:34:37 +01:00
Edwin Brady
1b859fa5b3 Complete specialised definitions
Specialisation happens on the run time case tree, so we need to know
separately which names occur at compile time, and which at run time.
Hence, we now have 'refersToRuntime' in addition to 'refersTo' since
they will be different. (In fact there's more differences, because
there's a lot of metavariable names which are needed at compile time but
erased at run time)
2020-04-07 15:05:06 +01:00
Edwin Brady
620172b430 Remove superfluous line 2020-04-06 22:40:21 +01:00
Edwin Brady
2688f070e5 Add an ipkg for Idris2 as a library
This is step 0 towards pluggable back ends
2020-04-06 22:27:31 +01:00
Edwin Brady
d801d0d9ae Start on specialisation
This identifies calls that need specialising and builds a type, but
there's still work to do to build the specialised function.
2020-04-06 22:27:31 +01:00
Edwin Brady
2a81bd9fc3 Syntax for flagging arguments to specialise
We'll use this for specialising interfaces in particular, and eventually
for more partial evaluation. (Semantics not yet implemented)
2020-04-06 22:27:31 +01:00
Edwin Brady
1c4b558b26
Merge pull request #271 from ohad/bugfix-269
Bugfix #269
2020-04-06 22:27:19 +01:00
Edwin Brady
3b07afc601
Merge pull request #268 from gallais/interactive-test
[ new ] interactive test runner
2020-04-06 22:12:15 +01:00
Edwin Brady
e383c2793d
Merge pull request #265 from then0rTh/patch-1
fix typo in docs/tutorial/typesfuns.rst
2020-04-06 22:02:40 +01:00
Edwin Brady
36897138db
Merge pull request #261 from gallais/resugar
Resugar `Nat` literals
2020-04-06 21:58:14 +01:00
Edwin Brady
8beeb6ee5a
Merge pull request #260 from ska80/tutorial/idris-prompt
Update Idris prompt in the tutorial
2020-04-06 21:56:27 +01:00
Edwin Brady
db409e29fe
Merge pull request #259 from gallais/cleanup-lexer
A little cleanup
2020-04-06 21:56:16 +01:00
Ohad Kammar
f7dca2ba7d minor: Fix whitespace 2020-04-06 17:36:09 +01:00
Ohad Kammar
b44619e7a8 Replace redundant <- notation with let
Following @gallais's [review](https://github.com/edwinb/Idris2/pull/271#pullrequestreview-388352322)
2020-04-06 16:43:17 +01:00
Ohad Kammar
fbf82eaf0b Bugfix #269
Make desugaring/elaboration of interfaces, interface implementations,
records, and parameter blocks take into account the pragma
`%unbound_implicits off`.

Main changes:

(a) Execute the pragma also during desugaring
(b) Check whether `isUnboundImplicits` is on at each desugaring step

Alternatives I didn't take:

(1) Changing `findBindableNames` to effectfully check the flag.

  Rationale:
  Apart from turning a pure function into an effectful one, this
  would mean repeatedly calling `findBindableNames`, only to do
  nothing once the flag is read.

(2) Adding another function that takes multiple places (list of terms)
  that might contain bindable names, and before dispatching
  `findBindableNames` on each term, checking the flag.

  Rationale: I didn't want to add another abstraction. (weak
  rationale)

@edwinb @gallais : if you prefer (2), I can do that.
2020-04-06 15:56:48 +01:00
Guillaume Allais
6e2ccb085e [ more ] show the diff in case of mismatch 2020-04-06 11:29:18 +01:00
Guillaume Allais
5ae54488d7 [ new ] interactive test runner 2020-04-06 11:06:19 +01:00
then0rTh
e6fe418a6b
fix typo in docs/tutorial/typesfuns.rst
duplicated word
2020-04-04 22:58:34 +02:00
Guillaume Allais
8cb17de3f9 [ fix ] resugar to drop name prefixes
My first attempt at refolding natural constants led to all names
being printed with their namespace prefixes. This fixes that,
most notably by introducing the massive `mapPTermM` function in
`Idris.Syntax`.
2020-04-03 20:00:59 +01:00
Kamil Shakirov
55b3f880d3 Update Idris prompt in the tutorial 2020-04-03 16:44:12 +06:00
Guillaume Allais
e1aea9fae7 [ new ] resugar Prelude's natural numbers 2020-04-03 00:00:16 +01:00
Guillaume Allais
d92a65c43e [ admin ] add empty default target distinct from clean
Tired of having to rebuild everything because I typed `make` in
the wrong directory.
2020-04-02 22:21:40 +01:00
Guillaume Allais
c3f3fdb224 [ cleanup ] scan
Remove one assert_total by re-using strIndex.
2020-04-02 17:31:15 +01:00
Guillaume Allais
c5903c45e1 [ cosmetic ] various whitespace issues 2020-04-02 17:31:15 +01:00
Guillaume Allais
d433eafa97 [ doc ] various doc comments 2020-04-02 17:31:15 +01:00
Edwin Brady
59503712f3 Add --dumpcases option
Output goes in the same directory as the generated code (so
build/exec/<appname>_app for the Chez back end)
2020-04-02 16:11:10 +01:00
Edwin Brady
8029241458
Merge pull request #256 from gallais/faster-lexer
[ performance ] rewrite-free concatMap
2020-04-02 16:11:02 +01:00
Edwin Brady
f85e1f62b1
Merge pull request #255 from ziman/exec-cwd
Don't clobber CWD in `--exec`
2020-04-02 16:09:16 +01:00
Guillaume Allais
ad916b908f [ performance ] rewrite-free concatMap
Simply removing rewrites took me down from a user time of ~1m8s
to ~54s when running `make test`. The (small) code duplication
in `scan` is a bit annoying.

We could have a core unindexed data structure and then only export
pseudo-constructors with the right phantom arguments. Not sure it
is worth it yet though.

A more principled solution would of course be to make sure the backend
gets rid of the code corresponding to rewrites altogether!
2020-04-02 15:17:32 +01:00
Matus Tejiscak
6917f09a02 Fix tempfile names. 2020-04-01 21:57:36 +02:00
Matus Tejiscak
66169377b1 Don't clobber CWD in --exec. 2020-04-01 21:49:55 +02:00
Edwin Brady
2c41a39df2
Merge pull request #253 from gallais/nested-comments
[ fix ] properly nesting multiline comments
2020-04-01 14:50:08 +01:00
Edwin Brady
e45e562a95
Merge pull request #252 from gallais/updates-cleanup
[ cosmetic ] cleanup trailing whitespace + typos
2020-04-01 14:49:02 +01:00
Guillaume Allais
4cbb02b6b3 [ fix ] properly nesting multiline comments
We should be able to comment out any part of a program that parses
and still get a program that parses. This means we need to properly
ignore `{-` and `-}` when hidden behind a `--` comment or inside of
a string literal.
2020-04-01 12:52:01 +01:00
Guillaume Allais
2c7b2469a4 [ cosmetic ] cleanup trailing whitespace + typos 2020-04-01 10:19:27 +01:00
Edwin Brady
0cbc3b8396 Prioritise List :: at the REPL
This is a temporary hack (no, honestly...) until we get some syntax for
prioritising specific names like the 'with' disambiguation in Idris 1.
There are better ways to achieve this, but this will make the REPL
easier to play with for new users.
2020-04-01 00:08:11 +01:00
Edwin Brady
616495d6c7 Add Idris.Version to ipkg 2020-03-31 23:39:00 +01:00
Edwin Brady
07ed0352a2 Initialise a CHANGELOG 2020-03-31 22:43:58 +01:00
Edwin Brady
7f4659814c Set version number to 0.1.0 2020-03-31 22:41:15 +01:00
Edwin Brady
fb22e3de73 Fix racket codegen
Need a require to get the system function
2020-03-31 22:40:09 +01:00
Edwin Brady
e027e0c434 --build and --clean now looks at executable field
Executables now get built and deleted. Install doesn't do anything with
the executable, and --clean only deletes the executable itself (not any
support files or libraries that might also have been generated in the
exec directory)
2020-03-31 22:33:58 +01:00
Edwin Brady
4f9624a76c Update CONTRIBUTORS 2020-03-31 18:20:46 +01:00