Commit Graph

210 Commits

Author SHA1 Message Date
Jan de Muijnck-Hughes
874236aac0 A port of Subset and Exists from Idris1.
The ports are rather straight forward and I have purposefully written
the documentation to be beginner friendly.

Note, I have diverged from Idris1 over the naming of the projection
functions to make them consistent with `Pair` and `DPair`.
2020-07-04 11:03:14 +01:00
Alex Gryzlov
afde930e7a
Vect updates (#335) 2020-07-04 11:02:04 +01:00
Niklas Larsson
862bbeb308 Reverse the size check
I'm unsure how it would handle zero-size buffers if size==pos and no one
would need those anyway.
2020-07-04 11:37:51 +02:00
Niklas Larsson
ce3096f919 Add concatBuffers and splitBuffer to Data.Buffer
Expand the buffer test.
2020-07-04 02:25:41 +02:00
Guillaume ALLAIS
bd14d37ddc [ fix ] make some exports public 2020-07-03 12:01:09 +01:00
Jan de Muijnck-Hughes
5abf053818 Fixed visibility of some list functions. 2020-07-03 11:59:55 +01:00
Niklas Larsson
6673f49731 Convert Data.Buffer to HasIO 2020-07-01 23:33:30 +02:00
André Videla
cec56561c6
Merge pull request #387 from LibreCybernetics/fix-export-vect
Make Applicative implementation of Vect n public export.
2020-07-01 17:26:08 +01:00
Mark Barbone
4916dd23a9
Make Data.Vect linear (#333) 2020-06-30 15:05:19 +01:00
Fabián Heredia Montiel
e488c6cf0e Make applicative implementation of Vect public export 2020-06-29 18:27:57 -05:00
Ohad Kammar
6683a2147f Export the lengthCorrect proof, as users might want to use it
Change the `len` to be irrelevant, as it's uniquely determined by
matching on the input vector
2020-06-27 15:54:35 +01:00
Edwin Brady
5ed27947cb Small concurrency fixes
Conditional variables with timeout in Chez didn't work, so changed to a
consistent meaning of the timeout (microseconds). Also fix linearity of
unsafePerformIO.
2020-06-23 19:06:30 +01:00
Edwin Brady
1e6314c4cc
Merge pull request #345 from edwinb/hasio
HasIO interface for IO actions
2020-06-21 20:24:29 +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
Rui Barreiro
ca0c8f9d42 node018 passes 2020-06-21 17:54:50 +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
Matthew Baulch
916c3e7090 Import fgetc and listen from libc (where they actually reside) rather than the support libs 2020-06-21 15:24:45 +10: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
Rui Barreiro
1d2f3d8883 Merge branch 'master' of github.com:idris-lang/Idris2 into javascript 2020-06-20 15:11:08 +01:00
Edwin Brady
8c556d0c26
Merge pull request #340 from edwinb/strefs
Control.Monad.ST and Refs interface
2020-06-20 13:16:27 +01:00
Edwin Brady
d18aac7afd Move Data.ST to Control.Monad.ST
Seems a more appropriate place in the hierarchy (also roughly consistent
with where it is in Haskell base)
2020-06-20 12:51:38 +01:00
Edwin Brady
ab03249d49 Add Data.STRef and a generic Ref interface 2020-06-20 00:46:20 +01:00
Denis Buzdalov
c121181776
Function mapping Not (x=True) to x=False was added for Bools (#322) 2020-06-19 11:13:13 +01:00
Nicolas Biri
c72cb849a8 Add missing modules in base.ipkg 2020-06-18 10:32:51 +01:00
Rui Barreiro
f8f09858e8 Merge branch 'master' of github.com:idris-lang/Idris2 into javascript 2020-06-17 23:48:39 +01:00
Rui Barreiro
cb7dc7bffc test node004 passes 2020-06-17 23:29:54 +01:00
Niklas Larsson
630e4219fc Fix unsetenv
implement Windows support
2020-06-16 12:09:22 +02:00
Nick Drozd
b096062858 Fill in missing Nat proofs 2020-06-15 14:56:19 -05:00
Niklas Larsson
4dc151086c
Merge pull request #283 from timsueberkrueb/more-file-io
Extend Control.App.FileIO
2020-06-15 14:13:17 +02:00
Tim Süberkrüb
30410eda52 Add fflush to Control.App.FileIO 2020-06-12 17:30:54 +02:00
Tim Süberkrüb
535918a3ac Deduplicate Control.App.FileIO 2020-06-12 17:30:54 +02:00
Tim Süberkrüb
e9a80891b7 Extend Control.App.FileIO 2020-06-12 17:30:54 +02:00
Alex Gryzlov
4fffdec6e8 Merge remote-tracking branch 'upstream/master' 2020-06-12 16:39:37 +02:00
Edwin Brady
c3c556f192 Merge https://github.com/idris-lang/Idris2 into linear-things 2020-06-12 14:16:01 +01:00
Edwin Brady
1c576cb068 Add experimental support for linear arrays
Backed by Data.IOArray. Also moved the array external primitives to a
separate module Data.IOArray.Prims, since the next step is to add a
linear bounded array type where the bounds checks are done at compile
time, so we'll want to read and write without bounds likes.
2020-06-12 14:08:00 +01:00
Niklas Larsson
9e4c7c3019
Merge pull request #289 from jfdm/comment-out-unimplemented-proofs-from-data-nat
Remove unsolved holes from `base`.
2020-06-12 14:57:12 +02:00
Jan de Muijnck-Hughes
da81146388 Remove unsolved holes from base.
Having unsolved holes in a 'core' library unneccessarily pollutes the list of holes shown to the user.
Thus, having unfilled holes in a 'core' library is not right.
These constructs can be re-added once the holes have been filled in.
2020-06-12 13:13:48 +01:00
Jan de Muijnck-Hughes
f7cf2dfb06 Ported safe indexing of Lists from Idris1 prelude. 2020-06-12 13:12:15 +01:00
Edwin Brady
c9b20911e1 Add linear pair/dependent pair to the prelude
I'm playing with some linear structures and finding these useful a lot,
so good to have a consistent syntax for it. '#' is chosen because it's
short, looks a bit like a cross if you look at it from the right angle
(!) and so as not to clash with '@@' in preorder reasoning syntax.
2020-06-12 11:18:12 +01:00
Alex Gryzlov
cd443f24f6 various stdlib updates 2020-06-11 23:14:11 +02:00
Kevin Boulain
c148003265 Fix MkRecord signature
Otherwise we'd get:
  When unifying Name and Maybe Name
  Mismatch between:
          Name
  and
          Maybe Name
  Can't reify as Decl
2020-06-11 21:54:40 +02:00
Edwin Brady
07ae16123c Only open in binary mode on windows 2020-06-11 14:53:54 +01:00
Edwin Brady
4b1667fdcf Open files in binary mode
Needed for windows, and harmless on Unix (Idris 1 did it this way).
2020-06-11 14:35:26 +01:00
Edwin Brady
0a246af449 Make Buffer more primitive
Meaning that the FFI is aware of it, so you can send arbitrary byte data
to foreign calls. Fixes #209

This means that we no longer need the hacky way of reading and writing
binary data via scheme, so can have a more general interface for reading
and writing buffer data in files.

It will also enable more interesting high level interfaces to binary
data, with C calls being used where necessary.

Note that the Buffer primitive are unsafe! They always have been, of
course... so perhaps (later) they should have 'unsafe' as part of their
name and better high level safe interfaces on top.

This requires updating the scheme to support Buffer as an FFI primitive,
but shouldn't affect Idris2-boot which loads buffers its own way.
2020-06-11 14:05:52 +01:00
Edwin Brady
4cc4099ace
Merge branch 'master' into nats 2020-06-08 12:11:10 +01:00
Alex Gryzlov
14002213a1 Merge remote-tracking branch 'upstream/master' 2020-06-08 00:27:58 +02:00
Nick Drozd
5665cfab21 Copy over more Nat proofs 2020-06-07 12:19:32 -05:00
Nick Drozd
4292d735eb Simplify Nat proofs
These changes are strictly nonfunctional.
2020-06-07 12:19:32 -05:00
Edwin Brady
d5e4dec119 Reflect 'display names' and record field names
These arise in interface declarations (to give a nicer way of displaying
auto generated names) and for record fields.
2020-06-07 11:51:09 +01:00
Edwin Brady
7733c85fd5 New way of instantiating metavariables
The old way only worked by chance, because the argumemt order happens to
be the same in all cases. I noticed due to some experiments elsewhere
with different ways of elaborating case, which broke that assumption.

The meaning of the list of Vars is actually the opposite of what it was
taken to be... fortunately, the performance works out roughly the same.
Also this way is (arguably) simpler, which is usually a good sign.
2020-06-06 18:43:06 +01:00
Alex Gryzlov
ca32ff9000 Merge remote-tracking branch 'upstream/master' 2020-06-04 00:23:35 +02:00
Edwin Brady
b9ac6e14db Make lambda elaborator dependent
Also remove forall, since I haven't tested it and its type was wrong
anyway. It can go back when we have a use for it...
2020-06-03 20:23:36 +01:00
Edwin Brady
3a7aedf0f4 Add reflection under (explicit) binders
This allows writing a staged well typed interpreter, for example (see
reflection008 test)
2020-06-03 09:17:37 +01:00
Alex Gryzlov
30be32cf85 Merge remote-tracking branch 'upstream/master' 2020-06-03 02:46:45 +02:00
Edwin Brady
08b56e9e75 Add quote operation to Elab
Allows quoting a term back to a TTImp. Test reflection007 shows one
possible use for this, building a reflected, type safe, representation
of an expression.
2020-06-02 23:36:20 +01:00
Edwin Brady
2a75731916 In reflection, check now takes a concrete type
So the type of Elab now gives the expected type that's being elaborated
to, meaning that we can run 'check' in the middle of scripts and use the
result.
2020-06-02 22:41:37 +01:00
Alex Gryzlov
d4f4a74fbf add Data.Fuel 2020-06-02 17:20:42 +02:00
Edwin Brady
a33136aa00 A couple more elab reflection primitives
Get the names of local variables. and add the ability to look up their
types.
When we get a reflected TTImp, either checking the Goal or looking up a
type, it's not impossible that there'll be some repeated binder names,
so also make sure binders are unique relative to the current context.
Ideally we'd also rename things in the environment to guarantee that all
names are unique, but we don't yet.

(This would be much easier if reflected terms were typed such that they
were well scoped, but that would also make reflection harder to use.)
2020-06-01 22:16:27 +01:00
Edwin Brady
d45f92fd97 Add some reflected name manipulation
genSym, for generating a unique global name, and inCurrentNS for putting
a name in the current namespace.
2020-06-01 15:13:42 +01:00
Edwin Brady
02d371a94b Add reflection operation for adding declarations
Declarations can be quoted with `[ decl ]. See reflection004 for an
example.
2020-06-01 15:01:52 +01:00
Edwin Brady
e6f6c105d1 Reflection primitives for querying names/types
See reflection003 test for some examples
2020-06-01 14:26:37 +01:00
Edwin Brady
e2aabd6602 Add syntax for quoting names
`{{ n }} gives a value of type Name. No name resolution is attempted (so
no namespaces added etc)
2020-06-01 13:39:18 +01:00
Edwin Brady
7944da4121
Merge pull request #216 from edwinb/bits-primitives
Bits primitives
2020-06-01 12:37:58 +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
Rohit Grover
e4c6aa282c
some proofs and views around lists (#133) 2020-06-01 08:28:37 +01:00
Edwin Brady
106235c165 Allow scripts to inspect goal
If available (sometimes, say a top level expression, it might need
inferring so there'll be no goal available). Also add the ability to log
the current goal, or indeed any term.
2020-05-31 14:33:34 +01:00
Edwin Brady
9544e05da1 Process elaborator scripts
Still all they can do is check and log. Now scripts must return
something of type TT, which is in practice a TTImp that goes to the
elaborator for final checking
2020-05-31 13:05:06 +01:00
Edwin Brady
85c002c771 Progress on elaborator reflection
Add %runElab and start on scripts, although all they can do so far is
check a term. This does gives us, sort of, "template Idris" (as
demonstrated in test reflection002)
2020-05-31 01:36:54 +01:00
Edwin Brady
c212255290 IOArray needs to export max 2020-05-30 17:40:48 +01:00
Edwin Brady
3f914889b8 Add visibility rules on types
Can't export a type which refers to a private name. This has caught a
couple of visibility errors in the libraries, code and tests, so they've
been updated too.
2020-05-30 17:03:15 +01:00
Edwin Brady
2b08a9df0f
Merge pull request #199 from karroffel/console-api
added more functions to Control.App.Console
2020-05-30 12:42:47 +01:00
Thomas Herzog
e39477aa0e added more functions to Control.App.Console
Now all common console IO functions available from the
prelude are available through the `Control.App.Console`
interface.

Added:
- putChar
- getChar
- getCharLn
- print
- printLn

Renamed:
- getStr to getLine
2020-05-30 12:44:40 +02:00
Edwin Brady
e1dbcad2fc Make a start on reflection
Don't get too excited yet - I want this in so that it doesn't get too
out of sync, but I still have to think about exactly how it's going to
work in practice.
2020-05-29 22:40:29 +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
Tim Süberkrüb
46f7b78b0e Try to fix pclose for Windows
Co-authored-by: Niklas Larsson <metaniklas@gmail.com>
2020-05-28 16:12:26 +02:00
Tim Süberkrüb
c2dfe7de7f Add popen and pclose from Idris 1 2020-05-28 12:58:03 +02:00
Niklas Larsson
696db7f58f
Merge pull request #169 from andylokandy/pathcom
Use Path in the compiler
2020-05-27 21:23:29 +02:00
Edwin Brady
c88bf7af8d Fix import loading
This was taking too long, and adding too many things, because it was
going too deep in the name of having everything accessible at the REPL
and for the compiler. So, it's done a bit differently now, only chasing
everything on a "full" load (i.e., final load at the REPL)

This has some effects:
+ As systems get bigger, load time gets better (on my machine, checking
  Idris.Main now takes 52s from scratch, down from 76s)
+ You might find import errors that you didn't previously get, because
  things were being imported that shouldn't have been. The new way is
  correct!

An unfortunate effect is that sometimes you end up getting "undefined
name" errors even if you didn't explicitly use the name, because
sometimes a module uses a name from another module in a type, which then
gets exported, and eventually needs to be reduced. This mostly happens
because there is a compile time check that should be done which I
haven't implemented yet. That is, public export definitions should only
be allowed to use names that are also public export. I'll get to this
soon.
2020-05-27 15:49:03 +01:00
andylokandy
e8b1d54e0a Refactor Core.Directory 2020-05-27 18:21:40 +08:00
andylokandy
40401b53ec Remove the duplicate isWindows 2020-05-27 03:12:54 +08:00
andylokandy
712a4df140 Gather the straw isWindowss 2020-05-26 17:59:14 +08:00
Edwin Brady
087cb84dda
Merge pull request #130 from clayrat/list-quantifiers
add Data.List.Quantifiers
2020-05-25 11:57:08 +01:00
Alex Gryzlov
eb04046b43 inline removed anyElim, refactor more 2020-05-25 03:53:29 +02:00
Alex Gryzlov
5757c5e5cb remove anyElim 2020-05-25 02:27:19 +02:00
Edwin Brady
1ea54e764b
Merge pull request #144 from idris-lang/coverage
%default covering
2020-05-24 20:42:08 +01:00
Edwin Brady
498421a236 All functions now need to be covering by default
This has caught a couple of things in the Idris 2 code base itself. Some
tests needed partial annotations too.
2020-05-24 19:58:20 +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
Kamil Shakirov
80344b5435 Merge branch 'master' into better-names 2020-05-24 07:59:25 +06:00
Alex Gryzlov
4aede51098 fix typos 2020-05-24 03:18:15 +02:00
Alex Gryzlov
a312409e19 add Data.List.Quantifiers 2020-05-24 03:15:38 +02:00
Edwin Brady
ad9a2a187f Fix Char casting
For the same behaviour as Idris 1, the primitive cast should return 0 if
the integer is out of bounds. (We should probably drop the Cast
implementation though, since ideally they won't be lossy in general, but
that's an issue for another time...)

All the tests pass in racket now, for me.
2020-05-23 22:19:10 +01:00
Edwin Brady
cff5fc2625 Workaround for byte vectors in Racket
Racket appears to have a different notion of current directory than the
system does, so we need to tell it which directory we think we're in
when reading and writing bytevectors using the scheme file functions.
2020-05-23 21:37:31 +01:00
Kamil Shakirov
e61e44205b Merge branch 'master' into better-names 2020-05-24 00:26:52 +06:00
Tim Süberkrüb
5dde7063f8 Add popen and pclose from Idris 1 2020-05-23 18:42:05 +02:00
Matthieu JACQUOT
f84850ea36 add minus proofs on Nats from Idris1 2020-05-22 22:39:09 +02:00
Kamil Shakirov
f696335f2d Rename some file/dir manipulation functions
Renamed:

fileRemove -> removeFile

dirOpen -> openDir
dirClose -> closeDir
rmDir -> removeDir
2020-05-21 18:32:35 +06:00
Kamil Shakirov
806c993d99 Move System.Clock from 'contrib' to 'base' 2020-05-21 17:00:09 +06:00
Edwin Brady
215ad99308
Merge pull request #86 from andylokandy/just
Add a total version of the fromMaybe
2020-05-20 21:41:35 +01:00
andylokandy
a51a665668 Reuse foldr1 in foldr1' 2020-05-21 02:35:18 +08:00
andylokandy
5252a7ae3b Add a total version of the fromMaybe 2020-05-21 02:11:35 +08:00
andylokandy
8de668f1a4 Add folds without default value to List 2020-05-21 02:09:14 +08:00
andylokandy
0d82b5d7da Add System.Path 2020-05-20 22:51:01 +08:00
Edwin Brady
2569b6e991 Update libraries from upstream 2020-05-19 17:03:18 +01:00
Kamil Shakirov
b801b97fcc Refactor makefiles 2020-05-19 18:50:47 +06:00
Edwin Brady
6bbb914fca
Merge pull request #1 from edwinb/remove-directory-system
Add rmDir to System.Directory
2020-05-19 12:24:35 +01:00
Edwin Brady
ede324dc6c Don't collapse empty lines in 'lines'
Now the vim mode works!
2020-05-19 10:47:05 +01:00
André Videla
3321dc6be3 Add rmDir to System.Directory 2020-05-18 18:28:33 +01:00
Edwin Brady
4125b76e90 Add Reflection to base 2020-05-18 16:57:43 +01:00
Edwin Brady
f7b285ec6c Add paths for install
Also remove libraries we aren't using quite yet...
2020-05-18 16:29:18 +01:00
Edwin Brady
dec7dff622 Add libraries 2020-05-18 14:00:08 +01:00