Commit Graph

165 Commits

Author SHA1 Message Date
Alex Gryzlov
ce15b48a78 Merge remote-tracking branch 'upstream/master' into misc-fixes 2020-01-15 22:52:38 +01:00
Ohad Kammar
9a591b83ac Add linearity annotations in the prelude 2020-01-09 13:05:05 +00:00
Ohad Kammar
be90749e22 Create a contrib directory in the standard library
Move the TailRec.idr and current poor-man's syntax for:
  equational reasoning (`Syntax.PreorderReasoning`)
  with proof           (`Syntax.WithProof`)
2020-01-09 12:54:55 +00:00
Edwin Brady
663e1b8f69 Add uniqueSearch data type option
This changes the behaviour of 'auto' implicits so that by default they
return the first result, rather than checking for unique results. This
is consistent with Idris 1. However, we still want to check for
uniqueness somtimes (for example, with interface search, which should
reject overlapping results) so the 'uniqueSearch' option means that any
auto implicit search for the type should check uniqueness of results.

Fixes #169
2019-12-07 18:54:02 +00:00
Edwin Brady
ebb1ec3a3a
Merge pull request #167 from ska80/unwords+unlines/idris1
Add unwords and unlines to base/Data.Strings from Idris 1
2019-12-07 15:28:14 +00:00
Edwin Brady
0c4301d1c2
Merge pull request #159 from ska80/integral-nat
Add an implementation of Integral for Nat
2019-12-07 15:26:50 +00:00
Edwin Brady
ba5a798549
Merge pull request #153 from abailly/export-network
export Network.Socket functions
2019-12-07 15:14:42 +00:00
Edwin Brady
050fcfa45a
Merge pull request #148 from msmorgan/list-replicate
Add replicate to base/Data.List.
2019-12-06 10:59:12 +00:00
Edwin Brady
468555bb2e
Merge pull request #143 from ohad/bugfix-#133
Bugfix #133 and library support for tail-recursive list manipulation
2019-12-06 10:56:03 +00:00
Edwin Brady
262177016c
Merge pull request #147 from msmorgan/list-zip
Add zip functions to base/Data.List.
2019-12-06 10:42:11 +00:00
Edwin Brady
078b5be85f
Merge pull request #144 from sysvinit/debug-trace
Port Debug.Trace from Idris 1
2019-12-06 10:38:28 +00:00
Edwin Brady
d9f1b01ef7
Merge branch 'master' into bugfix-#133 2019-12-06 10:28:07 +00:00
Edwin Brady
0a51a72806 Add runElab to syntax tree
Nothing done yet in the elaborator, but it's ready to be filled in later
2019-12-05 18:58:53 +00:00
Edwin Brady
07509f6103 Begin elaboration of quoting terms 2019-11-30 15:26:17 +00:00
Edwin Brady
aae3d0f718 Reorganise Language.Reflection modules 2019-11-30 13:23:03 +00:00
Kamil Shakirov
8afad8ef0a Add unwords and unlines to base/Data.Strings from Idris 1 2019-11-26 01:17:18 +06:00
Alex Gryzlov
1652a6be7d Merge remote-tracking branch 'upstream/master' into misc-fixes 2019-11-25 19:18:09 +03:00
Edwin Brady
1c006b647a Reflect/reify for TTImp
This is further progress towards a metaprogramming system in a form
similar to Elaborator Reflection or Template Haskell, but trying to
avoid leaking too many implementation details of the elaborator itself.
2019-11-24 21:17:16 +00:00
Edwin Brady
2e9eabff71 Merge branch 'master' of github.com:edwinb/Idris2 2019-11-19 14:07:55 +00:00
Kamil Shakirov
15f6e863c4 Add implementation of Integral for Nat 2019-11-15 17:46:26 +06:00
Alex Gryzlov
f0ca75b537 add some lib fuctions from Idris1 2019-11-12 15:58:21 +03:00
Edwin Brady
ca3ea38cde Make sure Force is erased for termination checker
But only for 'Lazy', not for 'Inf'. This is necessary to build the size
change graphs correctly.
2019-11-11 19:35:23 +00:00
Arnaud Bailly
fe4fb532cd export Network.Socket functions fix #152 2019-11-11 08:38:10 +01:00
Michael Morgan
9190ccf883 Add replicate to base/Data.List. 2019-10-29 16:08:13 -07:00
Michael Morgan
2a014d1e19 Add zip functions to base/Data.List.
This includes the following functions: zipWith, zip, zipWith3, zip3
2019-10-29 15:51:15 -07:00
Molly Miller
0fb873949f Implement Debug.Trace, from Idris 1's base package 2019-10-28 20:23:11 +00:00
Ohad Kammar
fd980bc92f Add tail-recursive versions for most of the Data.List functions
Also include proof the tail-recursive versions are extensionally equivalent to the non-tail-recursive one

I'm a bit worried that some of those proofs came through, as
visibility modifiers should get in the way. If they cause problems at
some future point, just delete/comment them out.
2019-10-27 04:07:01 +02:00
Ohad Kammar
fa29941819 Add DIY syntax for:
1. with-proof construct
2. equational reasoning

temporarily, until Idris2 supports those features
2019-10-27 04:05:31 +02:00
Michael Morgan
e6121e0935 Remove trailing whitespace from Idris sources.
This is the result of running the command:

$ find . -name '*.idr' -type f -exec sed -i -E 's/\s+$//' {} +

I confirmed before running it that this would not affect any markdown
formatting in documentation comments.
2019-10-25 14:24:25 -07:00
Edwin Brady
83673b7295
Merge pull request #125 from msmorgan/list-head-tail
Add `head` and `tail` to base/Data.List.
2019-10-19 14:00:08 +01:00
Edwin Brady
1a6c314d15
Merge pull request #119 from timsueberkrueb/add-missing-exports
Add some missing public exports
2019-10-19 13:53:23 +01:00
Michael Morgan
33110d1cda Add head and tail to base/Data.List.
These functions use the NonEmpty predicate type in order to prove
that the operation will be valid.

Implementations copied from Idris1's Prelude.List module, except without
expanding the auto implicit argument.
2019-10-16 15:49:52 -07: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
Tim Süberkrüb
fb0d2b45d6 Make reverse public export 2019-10-08 21:33:05 +02:00
Tim Süberkrüb
7e72f9d2f4 Add some missing public exports 2019-10-08 21:16:41 +02: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
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
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
33780dd5e1 Merge branch 'master' of github.com:edwinb/Idris2 2019-09-14 11:34:32 +01:00
Arnaud Bailly
4194409682 remove another message to make network tests more reliable 2019-09-13 18:43:35 +02: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
Edwin Brady
65db4fbf96 Put built ttcs in build/ttc, rather than build
This is so that we can put other build artefacts (e.g. executables) in
properly organised subdirectories of build, e.g. build/bin/chez,
build/bin/js, etc.
2019-09-04 12:41:16 +01:00
Edwin Brady
68b0d64879 Add parameterised pointer type
For at least a bit of safety in foreign APIs. AnyPtr has the old Ptr
behaviour.
2019-09-04 10:25:45 +01:00
Edwin Brady
bb246a072a Experimenting with a new FFI
Functions can be declared as %foreign with a list of calling
conventions, which a backend will work through until it finds one it can
understand. Currently implemented only in Chez backend. If this works
out, I'll implement it for Racket too, and remove the old primitive
functions.

There's a bit more boiler plate here than before, but it has the benefit
of being more extensible and portable between different back ends.

Some examples, pending proper documentation:

%foreign "C:puts,libc" "scheme:display"
putline : String -> PrimIO ()

%foreign "C:exp, libm.so.6, math.h"
fexp : Double -> Double

%foreign "C:initscr, ncurses_glue.so, ncurses.h"
prim_initscr : PrimIO ()
2019-09-02 17:10:48 +01:00
Edwin Brady
f123fcaf84 Display output on network test fail
This still seems to be failing on travis, so let's see what it looks
like!
2019-08-29 12:56:13 +01:00
Edwin Brady
6a0cfa125a Update network build test
Since it's just to check that it's built successful and we can send a
message back and forth, remove the diagnostic message that might come
out in a different order depending on scheduling.
2019-08-29 11:50:14 +01:00
Edwin Brady
ea75fd21a1 Merge branch 'master' of github.com:edwinb/Idris2 2019-08-29 11:10:44 +01:00
Edwin Brady
09b13eef21
Merge pull request #89 from chrrasmussen/fix-integerToNat
Fixes #88: integerToNat hangs for negative integers
2019-08-29 11:07:50 +01:00
Edwin Brady
02c5aa7b61
Merge pull request #76 from ska80/ignore-build-artifacts
Ignore build artifacts
2019-08-29 11:01:06 +01:00
Edwin Brady
8975eeafb7 Make a start on reflection 2019-08-27 15:49:21 +01:00
Edwin Brady
fb11b89a4e Make some things public export
Anything which might appear in types should be! Fixes #93
2019-08-21 17:44:17 +02:00
Christian Rasmussen
14db785ebe Fixes #88: integerToNat hangs for negative integers 2019-08-20 18:26:13 +02:00
Kamil Shakirov
a6f9fb5e18 Ignore build artifacts 2019-08-07 09:40:30 +06:00
Edwin Brady
0b692e4379 Pack/unpack should be public export
They're likely to be useful when manipulating strings in proofs.
2019-08-01 11:18:04 +01:00
Edwin Brady
89eb495d97 Merge branch 'network-lib' of https://github.com/abailly/Idris2 into abailly-network-lib 2019-08-01 11:11:45 +01:00
Arnaud Bailly
f66d681893
linked libraries should be after the source file referencing them
http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
2019-07-31 14:13:32 +02:00
Edwin Brady
47ad8ee7f5 Propagate implicits to with clauses
Fixes #57. Also move much of the 'with' machinery to its own source
file.
2019-07-30 12:32:33 +01:00
Arnaud Bailly
d600a3980c
added back missing file extension 2019-07-29 13:15:52 +02:00
Arnaud Bailly
ec402c3c4a
reference idris_net library as idris_net.so for all OSes 2019-07-29 12:46:23 +02:00
Arnaud Bailly
75459e7fca
fix execution of network test to correctly load library 2019-07-28 22:53:05 +02:00
Arnaud Bailly
f6b746e7ac
set LD_LIBRARY_PATH for network tests to run 2019-07-28 09:53:33 +02:00
Arnaud Bailly
02978c81fc
Merge branch 'master' of https://github.com/edwinb/Idris2 into network-lib 2019-07-27 17:27:49 +02:00
Arnaud Bailly
a87639d53a
refactor code to be more compact
uses alternative branches for failed pattern matches in do-notation
2019-07-26 09:51:49 +02:00
Arnaud Bailly
87b754de45
fix execution of tests to actually fail if there's an error 2019-07-25 19:49:15 +02:00
Arnaud Bailly
055a5f2449
got a first basic test passing 2019-07-25 09:43:33 +02:00
Alex Gryzlov
c3191f7d90 export decEq implementation 2019-07-24 17:13:47 +03:00
Alex Gryzlov
d289a0da4c fix names 2019-07-24 16:23:18 +03:00
Alex Gryzlov
b9b41dea40 port Data.List 2019-07-24 16:11:27 +03:00
Arnaud Bailly
b5cc727f3b
[wip] test basic server 2019-07-24 10:08:59 +02:00
Arnaud Bailly
dc219a07ec
provide a way to retrieve port of (server) socket bound to 0 2019-07-24 09:17:29 +02:00
Arnaud Bailly
7c1b1bc98d
got code to compile
* removed Cgi
* add a couple of utility functions to the C source
* converted all foreign calls to use cCall
2019-07-23 22:39:54 +02:00
Arnaud Bailly
2b11b7cc32
add test target and basic test 'harness'
test harness is a grand word for just a basic C main file that uses
plain <assert.h> macro to run tests
2019-07-23 09:38:28 +02:00
Arnaud Bailly
7f53d0d54d
add 'missing' functions into base libraries 2019-07-23 09:37:48 +02:00
Arnaud Bailly
18d83420da
initial import of idris 1 network lib 2019-07-22 17:24:55 +02:00
Edwin Brady
6dd18d798a Allow annotating functions with multiplicity
This means we can write truly type level only functions, by annotating
them with a 0 before the type declaration.
2019-07-20 18:04:18 +01:00
Edwin Brady
623024d179
Merge pull request #28 from jfdm/add-either
Inclusion of Either within Base.
2019-07-18 20:31:51 +01:00
Jan de Muijnck-Hughes
5823d6b294 Inclusion of Either within Base.
Straightforward port of Either from Idris to Idris2.
2019-07-18 16:32:19 +01:00
David Smith
96ec5f6b3a Add Data.Morphisms to base 2019-07-18 14:46:59 +01:00
Edwin Brady
b1081e6e04 Add missing export modifiers in Data.Vect
Lots were missing, and some were export, which should probably be public
export because the nature of Vect is that it could commonly be used in
types.

Fixes #13
2019-07-18 11:25:41 +01:00
Edwin Brady
4860d2b751 Add Range interface to prelude
This is part of what we used to have in Enum but I think it's better to
separate the two. Added implementations for Nat, and anything in
Integral/Ord/Neg, so that we get range syntax (at least when its
implemeted) for the most useful cases.
2019-07-11 23:38:25 +02:00
Edwin Brady
fd4f90e331 Add some Control.Monad things
This required a small change to auto implicit search (and I'm still not
sure about this). Now search arguments right to left, because solving
later arguments may resolve earlier arguments by unification and this
can happen in particular when chasing parent interfaces (which may have
fewer parameters).
2019-07-10 20:18:40 +02:00
Edwin Brady
a422294f36 Pass auto implicits through interfaces
This allows 'traverse' to work now (it was treating them as normal
implicits, so building the wrong form of application)
2019-07-10 17:23:33 +02:00
Edwin Brady
2bb496f74b Chapter 11 examples now working 2019-07-08 23:46:20 +02:00
Edwin Brady
1cc097aefc Add Data.Primitives.Views 2019-07-08 22:11:34 +02:00
Edwin Brady
2967a19963 Add more stream functions to Data.Stream 2019-07-08 18:10:47 +02:00
Edwin Brady
11199acab6 Improve 'with' implementation
Now supports with applications on the RHS when auto implicits are
involved. Auto implicit bound names in patterns now become searches on
the rhs in a with-application (I should write this construct up properly
in a paper some time!)
2019-07-08 12:55:55 +02:00
Edwin Brady
ccc53813ca Initial attempt at RHS with application
Still some details to finish, plus testing, plus adding View modules to
the base libraries, but the basic idea works.
2019-07-07 00:07:59 +01:00
Edwin Brady
c02da23c1a Add sort and merge to Data.List 2019-07-06 13:56:57 +01:00
Edwin Brady
7a588d30cc Need to export DecEq implementations! 2019-07-05 18:41:50 +01:00
Edwin Brady
4ab543b83d A bit more library support, for Chapter 9
Also a tweak to errors when compiling to scheme, so that it properly
reports an error then quits if it's supposed to crash.
2019-07-05 17:24:15 +01:00
Edwin Brady
27672444e4 Add flag for whether a hole is an unbound implicit
We use this to decide whether a determining argument is satisfied or not
for unbound implicits. We can tell from the name, which would be a PV,
but this way relies on fewer assumptions.
2019-07-05 14:58:48 +01:00
Edwin Brady
86f402c948 Add a 'match' mode to unification 2019-07-05 13:59:57 +01:00
Edwin Brady
7c34fa1db4 Change equality elaboration
Elaborate via either === (homogeneous equality) or ~=~ (heterogeneous
equality) both of which are synonyms for Equal. This is to get the Idris
1 behaviour that equality is homogeneous by default to reduce the need
for type annotations, but heterogeneous if that doesn't work.
2019-07-05 11:26:45 +01:00
Edwin Brady
0f56c239c2 Parse pattern matching lambda
This is now enough for Chapter 5 tests to work
2019-07-03 13:04:25 +01:00
Edwin Brady
4abe760cc9 Update type on delayed rewrite
Like in delayed ambiguity resolution, we need to reevaluate the target
type because it might have changed - and that's why we delayed in the
first place!
2019-07-03 11:02:53 +01:00