Commit Graph

31 Commits

Author SHA1 Message Date
André Videla
274954998b
Implement generic interpolation (#1967)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-10-13 17:26:54 +01:00
Dong Tsing-hsuen
505224e9fc
[ typo ] Enum -> Range (#1099) 2021-02-22 10:05:08 +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
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
Matthew Ess
6452cdbbd4
Add Ord implementation for Either (#439) 2020-07-09 19:28:59 +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
faabbfcea1 Add some Uninhabited implementations 2020-07-07 10:48:23 +01:00
Rui Barreiro
68c9990c8a moved big foreign functions to support and added outputDir 2020-07-06 16:58:02 +01:00
Rui Barreiro
b3216758e9 Merge branch 'master' of github.com:idris-lang/Idris2 into javascript 2020-07-06 11:32:59 +01:00
Edwin Brady
7a0b25f994
Merge pull request #369 from cypheon/tailrec-unpack
Make Prelude.unpack tail-recursive
2020-07-05 14:11:02 +01:00
Rui Barreiro
88f8e745b1 Merge branch 'master' of github.com:idris-lang/Idris2 into javascript 2020-07-05 12:19:45 +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
Johann Rudloff
7128f127e8 Make Prelude.unpack tail-recursive 2020-06-26 18:41:52 +02:00
Stiopa Koltsov
c140605a0f Extract Prelude.Basics, Prelude.Uninhabited from Prelude 2020-06-22 18:10:06 +01:00
Edwin Brady
dbdf7dab3d Back to HasIO, remove MonadIO
Following a fairly detailed discussion on slack, the feeling is
generally that it's better to have a single interface. While precision
is nice, it doesn't appear to buy us anything here. If that turns out to
be wrong, or limiting somehow, we can revisit it later. Also:

- it's easier for backend authors if the type of IO operations is
  slightly less restrictive. For example, if it's in HasIO, that limits
  alternative implementations, which might be awkward for some
  alternative back ends.
- it's one less extra detail to learn. This is minor, but there needs to
  be a clear advantage if there's more detail to learn.
- It is difficult to think of an underlying type that can't have a Monad
  instance (I have personally never encountered one - if they turns out
  to exist, again, we can revisit!)
2020-06-21 19:21:22 +01:00
Edwin Brady
28855088c2 Split HasIO into HasIO and MonadIO
For things which don't require (>>=), HasIO is fine, otherwise MonadIO
gives access to the monad interface.
2020-06-21 14:46:14 +01:00
Edwin Brady
d12487f529 HasIO interface for IO actions
Also updates the Prelude and some base libraries to use HasIO rather
than using IO directly.
2020-06-21 01:18:43 +01:00
Edwin Brady
2eb2ce6097 Add Bits primitives
Including appropriate casts, and Num/Eq/Ord/Show implementations.
Also includes new primitives in Data.Buffer, and calls to foreign
functions in C as 'unsigned'.
2020-06-01 11:48:03 +01:00
Edwin Brady
843b30b4d1
Merge pull request #196 from edwinb/with-experiment
Experiment %syntactic flag on with
2020-05-29 17:01:41 +01:00
Edwin Brady
d869eb666c Experiment %syntactic flag on with
This means it abstracts over the value syntactically, rather than by
value, and can significantly speed up elaboration where large types are
involved, at a cost of being less general. Try it if "with" is slow.

There are more flags we want on with (well, at least one: "proof")
2020-05-29 16:39:11 +01:00
Fabián Heredia Montiel
0537aa12f5 Let DocComments trough from Lexer to Parser 2020-05-29 10:37:04 +01:00
Edwin Brady
4ae01d7264 %default doesn't affect interface methods
The required totality of interface methods is now only affected if
there's an explicit modifier on the method. This allows us to set
%default total on the Prelude, which is a good thing to do anyway,
without also requiring that every implementation of the interface in the
prelude has to be total, which would potentially be a pain.

Another good affect is that it speeds up totality checking elsewhere
because totality checking is done lazily, and so with the total flag set
we know in advance that prelude functions are total.
2020-05-28 15:52:03 +01:00
Edwin Brady
9129df359f Simplify doParse
If we're going to use assert_total. we might as well not have the
distinction between empty and non empty results, which only makes the
code harder to follow.

Also there's some kind of issue which seems to mean the token list can't
be erased if we do that. I will investigate if I can make a smaller
example.
2020-05-27 18:16:54 +01:00
Jinwoo Lee
893fbb78c9 Provide sum' and product' separate from sum and product
Not to break backwards compatibility.
2020-05-25 09:59:18 -07:00
Jinwoo Lee
728149f2d1 [prelude] Use foldl for sum and product
To make them tail recursive. Fixes #132.
2020-05-25 09:59:18 -07:00
Edwin Brady
1ea54e764b
Merge pull request #144 from idris-lang/coverage
%default covering
2020-05-24 20:42:08 +01:00
Edwin Brady
222a6a7f31 More fine-grained assert_total in unpack
If it's around the whole thing, it might drop out if unpack is partially
evaluated by the unifier. It should be as fine grained as possible.
2020-05-24 19:13:24 +01:00
Edwin Brady
3ec8631480 More coverage checking fixes
Still a couple of things to resolve in coverage and totality checking
before we can switch on %default, so don't expect quite the right
behaviour just yet. More progress though!

Also working on this has caught a few totality errors in the Idris 2
code base that Idris 1 missed... so these are fixed on the way.
2020-05-24 18:33:43 +01:00
Alex Gryzlov
723f690f7e erase function argument of cong 2020-05-24 05:16:52 +02:00
Edwin Brady
0f724fbc7f Report errors on totality check failure
This means temporarily removing some '%default total' from the libraries
and tests, since the input for codata checking isn't right yet (it needs
appropriate use of inlining)
2020-05-21 13:08:19 +01:00
Edwin Brady
dec7dff622 Add libraries 2020-05-18 14:00:08 +01:00