Commit Graph

132 Commits

Author SHA1 Message Date
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
Edwin Brady
e526badfe2 Delay case elaboration
This helps a few things because it delays elaboration of the block until
as much as possible is known about its type.

Also added a few libraries.
2019-07-02 16:53:41 +01:00
Edwin Brady
5eec46f6ce TypeDD chapter 4 tests 2019-07-01 21:35:19 +01:00
Edwin Brady
00514887c4 More base libraries
This has shown up a problem with 'case' which is hard to fix - since it
works by generating a function with the appropriate type, it's hard to
ensure that let bindings computational behaviour is propagated while
maintaining appropriate dependencies between arguments and keeping the
let so that it only evaluates once. So, I've disabled the computational
behaviour of 'let' inside case blocks. I hope this isn't a big
inconvenience (there are workarounds if it's ever needed, anyway).
2019-06-30 23:54:50 +01:00
Edwin Brady
577b68dd5a Make a start on Data.Vect 2019-06-30 17:38:40 +01:00
Edwin Brady
f37da6c5b7 Start adding tests for TypeDD book
Also detailing any changes needed to the code. Added primitives for
Doubles, and repl/replWith to get Chapter 2 code to work.
2019-06-30 15:50:58 +01:00
Edwin Brady
39836f3cd0 Fix instantiation in pattern unification
There was an optimisation that wasn't valid, and it turns out it doesn't
have any useful effect anyway.
2019-06-28 19:41:25 +01:00
Edwin Brady
bf64f843aa A bit more totality checking polish
Need to check for 'assert_total' in getRefs, and get Inf and Lazy the
right way around!
2019-06-25 12:57:49 +01:00
Edwin Brady
0a15c2cda1 Pay attention to visibility of names
Name lookup and search should ignore names which aren't visible (that
is, private names in another namespace)
2019-06-24 00:57:22 +01:00
Edwin Brady
c3a4360ee9 Add missing ipkg 2019-06-19 18:50:46 +01:00
Edwin Brady
02c2358093 Add missing Makefile 2019-06-19 18:49:53 +01:00
Edwin Brady
ecb5cb1e40 Don't keep running delayed elaborators
Also fix a bug where the elaborator state wasn't updated on completing
the delayed elaborator, which could cause issues with implicitly bound
names in particular.
2019-06-16 20:48:31 +01:00
Edwin Brady
4bc87b4c72 Some TTC/Delay fixes
Need to run delayed elaborators before binding implicits, since there
might be some inside the delayed elaborator. Also reorganise TTC
implementations so they're all in one place.
2019-06-16 13:47:20 +01:00
Edwin Brady
a7bf075c94 Get GlobalHint flag right
'True' means a default hint, which is only used if all else fails (and
is only really intended to get default Integer)
2019-06-15 12:42:35 +01:00
Edwin Brady
c121910298 Add 'base' libraries 2019-06-15 11:54:22 +01:00
Edwin Brady
772b098de0 The Prelude type checks! 2019-06-13 13:23:21 +01:00