Commit Graph

499 Commits

Author SHA1 Message Date
Edwin Brady
d6d950f3dd Make sure Delay is put in the right place!
I got this wrong in the last patch - we need to go under the environment
where the guess was created. This will fix up the term so that it has
the right type after unification.
2019-10-17 18:06:33 +01:00
Edwin Brady
1febab885f Make sure Delay/Force inserted after unification
Always check the result to see if a laziness coercion needs inserting
2019-10-17 14:27:26 +01:00
Edwin Brady
4e019d8093 Tweak overloading rules
Instead of %allow_overloads, which I've never documented or explained,
now we have:
 + if there's more than one possible name after pruning according to
   return type, and there is at least one name with a concrete return
   type, rule out the names which do not have a concrete return type.

Effectively this means if there is a clash between a concrete name and a
polymorphic name, we'll always take the concrete one, which is
consistent with Idris 1.

I still don't know if this is the right choice, but all the possibile
ways of resolving ambiguity have some problems, and this is the fastest
to resolve in the common case!
2019-10-13 19:38:41 +01:00
Edwin Brady
50441ad3df Tweak evaluation rules under Delay
Still need to evaluate holes, if not all the names, because we may need
to bind implicits in types.
2019-10-13 19:36:44 +01:00
Edwin Brady
c572ce69b0 Improve implicit laziness
If the unification problem is delayed, and there's only one constraint,
allow inserting the laziness coercion when rechecking. We need this for
the situation where it's not yet known whether a term is lazy or not
(e.g. the laziness is computed by a type level function)
2019-10-13 18:24:52 +01:00
Edwin Brady
bb6d0e07a7 Fix pruning ambiguities under 'Delayed'
Need to strip the 'delayed' or we'll miss some things
2019-10-13 17:09:31 +01:00
Edwin Brady
6cebc5ca4f Add some handy list functions/properties 2019-10-13 13:59:42 +01:00
Edwin Brady
d9ff8d65a6 Allow implementations to have implicits given
See e.g. Applicative instance in Data.Vect. This allows implementations
to use implicits at run time (by default, they'd be 0 multiplicity so
erased, but it might be useful to have an index available at run time).

At the moment, the parser requires implicits to be given before
constraints. Ideally it should be possible to give them in any order.
I'll come back to this.
2019-10-13 12:32:07 +01:00
Edwin Brady
a162425384 Add curry/uncurry to Prelude 2019-10-13 12:12:49 +01:00
Edwin Brady
519415f82f Add decidable equality for List 2019-10-10 17:38:09 +01:00
Edwin Brady
85459814ef Support foreign callbacks in Racket back end 2019-09-29 19:37:30 +01:00
Edwin Brady
c6039e4fe5 Support callbacks in foreign calls to C
Currently Chez backend only
2019-09-29 17:25:26 +01:00
Edwin Brady
ec814e8555 Allow infix names in record fields
Fixes #103
2019-09-28 18:51:14 +01:00
Edwin Brady
78e44a4353 Reading/writing buffers can fail
So, make them return and Either and wrap the scheme definitions in an
exception handler that returns an error code on failure
2019-09-28 18:33:46 +01:00
Edwin Brady
bf69b89b0d Support for buffers and file erros in Racket CG 2019-09-28 18:10:14 +01:00
Edwin Brady
1a4f424259 Support UTF8 strings
When writing to ttc, need to take the length in bytes rather than the
length in characters. Also need to write to scheme in the appropriate
format for each scheme system.

While we're at it, Idris 1 supports unicode identifiers (although we
don't encourage it :)) so this allows any characeter >127 in an
identifier.
2019-09-28 14:08:23 +01:00
Edwin Brady
0de9e91667
Merge pull request #102 from ska80/nobanner
Add '--no-banner' option
2019-09-26 11:29:41 +01:00
Kamil Shakirov
0722b96fef Add '--no-banner' option 2019-09-24 20:26:25 +06:00
Edwin Brady
f9739b3f66
Merge pull request #96 from abailly/add-version-command
Add version command
2019-09-23 22:54:36 +01:00
Edwin Brady
110d20bbb6 Don't save type of scrutinee in case
It's already done its job when building the case tree and checking
coverage, so save the time and space it takes to save out
2019-09-23 09:56:01 +01:00
Arnaud Bailly
c80bfc0ed7 fix incorrect variable in makefile preventing install 2019-09-22 22:43:08 +02:00
Arnaud Bailly
2f8daa7cf2 Merge branch 'master' of https://github.com/edwinb/Idris2 into add-version-command 2019-09-22 22:39:36 +02:00
Edwin Brady
e0b3839792 Allow annotating record fields with multiplicities
Default is still 1, so only 0 has any effect. (Might revisit this later,
perhaps default should be omega?)
2019-09-22 21:27:00 +01:00
Edwin Brady
76af4518b1 Speed up unelaboration to TTImp
Instead of returning the intermediate types as a Term, return them as a
Glued, so we don't keep converting back and forth between Terms and NF
when unelaborating applications. This appears to be really significant
for bigger applications, and is important for coverage checking where we
occasionally have to recheck a generated term.
2019-09-22 19:27:29 +01:00
Edwin Brady
728ef085a5 Write out less metadata
For the types of local names, don't write out the environment - it's
going to be repeated for every name, mostly it's unhelpful, and if you
want to see the types of other names you can ask directly. This can save
a huge amount of time when environments are slightly complicated.
2019-09-22 18:01:29 +01:00
Arnaud Bailly
9c1f8b6f02
Merge branch 'master' into add-version-command 2019-09-22 15:50:13 +02:00
Edwin Brady
131841b545 Don't write out metadata we don't need
This includes: metadata collected when elaborating impossible cases,
which are just discarded whatever happens; and, types of names of global
definitions, which we can get from the context anyway. This has quite an
impact on performance, because their environment and types have to be
encoded and written out (which, by the way, we could probably do a lot
quicker by organising them by environment so we only have to write out
each environment once).
2019-09-22 14:19:24 +01:00
Edwin Brady
15d25eb4d2 Fix buffer sizing problem in TTCs
Turns out you can contrive to have buffer overruns if you use an unsafe
buffer library... oops! When resizing a buffer, we need to make sure
that the new size is enough for the thing we're about to add. This is
almost certainly the cause of #95.
2019-09-22 12:01:51 +01:00
Edwin Brady
7825d216c0 Push constraint name into default method impls
If a default method implementation refers to another method in the
interface, it's going to be one from the interface being defined, so
push it through explicitly.
This is only going to be guaranteed to be the case for default method
implementations - we can't assume anything for other implementations.
Fixes #77
2019-09-20 19:01:07 +01:00
Edwin Brady
8a255da8ea
Merge pull request #101 from luochen1990/feat-reimpl-rig
reimpl: rigPlus & rigMult in Core/TT
2019-09-20 17:36:53 +01:00
LuoChen
8d5f72c762 reimpl: rigPlus & rigMult in Core/TT 2019-09-20 13:30:13 +08:00
Edwin Brady
2f20f7e136 Add missing source file
(I did add this, then I messed around with git and apparently broke it
without noticing. Oops!)
2019-09-19 13:09:52 +01:00
Edwin Brady
65b3ddb81b Add --libdir option
This makes it easier for more complicated packages (e.g. network, which
needs to install a C shared library) to know where to put things without
having to work out the prefix themselves.
2019-09-19 13:04:39 +01:00
Edwin Brady
a38cce4c90 Record erasable args in definitions
This could allow us to actually erase (rather than compile with nil)
although experiments show that has no impact on performance. It is
useful to see, though, and other back ends may benefit.
2019-09-19 09:56:19 +01:00
Edwin Brady
15289b8222 Need to include version number in package paths
Fixes #100
2019-09-18 11:26:08 +01:00
Edwin Brady
9b639eee35 Nat optimisation needs to look under lambda
Names are saturated, so there might be a lambda in the term we're
optimising. Fixes #62
2019-09-18 10:00:30 +01:00
Edwin Brady
cd2342c45e Tweak ambiguity resolution rules for interfaces
Fixes #85. The pruning of ambiguous names by type should only rule out
%allow_overload functions if their type is not a concrete match for the
target.
2019-09-14 12:33:46 +01:00
Edwin Brady
33780dd5e1 Merge branch 'master' of github.com:edwinb/Idris2 2019-09-14 11:34:32 +01:00
Edwin Brady
d3f3b75fe6
Merge pull request #99 from abailly/fix-network-tests
remove another message to make network tests more reliable
2019-09-14 11:34:24 +01:00
Arnaud Bailly
4194409682 remove another message to make network tests more reliable 2019-09-13 18:43:35 +02:00
Arnaud Bailly
295058130e
Merge branch 'master' into add-version-command 2019-09-13 17:33:14 +02:00
Edwin Brady
253a34dee6 Merge branch 'master' of github.com:edwinb/Idris2 2019-09-13 13:19:35 +01:00
Edwin Brady
65e7bdb153
Merge pull request #98 from clayrat/code-golf
code golfing
2019-09-13 13:18:22 +01:00
Edwin Brady
e08ff47a93
Merge branch 'master' into code-golf 2019-09-13 13:17:39 +01:00
Edwin Brady
9c01bbc886
Merge pull request #97 from lodi/coreutils
Fixed #!/usr/bin/env shebang for Chez backend
2019-09-13 13:14:39 +01:00
Edwin Brady
3169fd45f3
Merge pull request #90 from xoltar/macos-chez
Added note to INSTALL.md to recommend Mac OS X users install Chez fro…
2019-09-13 13:13:30 +01:00
Edwin Brady
4159d43432
Merge pull request #75 from abailly/configurable-ide-mode-socket
Configurable ide-mode-socket REPL
2019-09-13 13:13:02 +01:00
Edwin Brady
421b15aa24 Detect cycles in imports 2019-09-07 14:54:29 +01:00
Alex Gryzlov
e669140f9a code golfing 2019-09-05 03:21:43 +03:00
Edwin Brady
412930522e Put idris version number in package install path
Since they'll be incompatible between different Idris2 versions, this
helps protect against importing the wrong thing by mistake. Also, it
means the canonical place for the version number is now the top level
Makefile.

You'll need to delete src/YafflePaths.idr before rebuilding, since it's
now generated slightly differently.
2019-09-04 16:20:26 +01:00