Commit Graph

20 Commits

Author SHA1 Message Date
Zoe Stafford
24f7c9d5be
Add foldMap to Foldable (#1483) 2021-06-01 15:05:04 +01:00
Edwin Brady
1d762d4920 Print constructor labels correctly 2021-05-13 16:09:12 +01:00
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
ab241213f3
[ breaking ] making toList part of Foldable (#1395) 2021-05-11 08:26:00 +01:00
Zoe Stafford
25ae664ef6
[ fix #1378 ] Collect constructors after inlining (#1380) 2021-05-10 11:19:18 +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
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
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
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
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
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
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
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
Zoe Stafford
f255026d1b
[ fix #1220 ] Update arity of constuctors to reflect erased args (#1225) 2021-03-29 15:08:06 +01:00