Commit Graph

762 Commits

Author SHA1 Message Date
Edwin Brady
1c18fe589b Forgot to add the new test again, didn't I... 2020-06-01 19:13:46 +01:00
Edwin Brady
3d2765e930 Add top level %runElab
This invokes a script of type Elab (). %runElan in a term invokes a
script of type Elab TT. The elaborator now pushes in that type, so that
it'll report an appropriate error if you give it a script of the wrong
type.
2020-06-01 19:06:10 +01:00
Edwin Brady
d5b5af91d1 Implement %macro flag
A %macro must always be fully applied. Whenever the elaborator
encounters a %macro application (except in a function LHS) it evaluates
the application and sends the result to %runElab. So:

%macro
foo : args -> Elab TT
...
def = foo a b c

is equivalent to

foo : args -> Elab TT
...
def = %runElab foo a b c
2020-06-01 17:55:54 +01:00
Edwin Brady
adc449acb3
Merge pull request #218 from edwinb/reflect-defs
More elaborator reflection primitives
2020-06-01 15:43:56 +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
d0021f7e48
Merge pull request #212 from normalcoder/gambit-ffi-callbacks
Gambit ffi callbacks
2020-06-01 12:41:58 +01:00
Sventimir
d796cfa126 Define the notion of Factor and GCD and prove some of their properties. 2020-06-01 13:41:00 +02:00
Edwin Brady
7944da4121
Merge pull request #216 from edwinb/bits-primitives
Bits primitives
2020-06-01 12:37:58 +01:00
Sventimir
9c97ab474b Add some helpers for transforming equations and inequalities on Nat. 2020-06-01 13:30:47 +02:00
Sventimir
932ea60dbc Port Data.Fin.Extra module from Idris1. 2020-06-01 13:29:59 +02:00
Edwin Brady
7f6de27f5c Update scheme/racket to deal with Bits types
We need to add Bits primitives to Idris2-boot to keep that at least able
to build this for bootstrapping purposes.
2020-06-01 11:58:22 +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
normalcoder
5e1c0f26bf Support callbacks in ffi for gambit 2020-06-01 02:59:16 +03:00
normalcoder
e001d266fe Add sys/time.h to satisfy xcode.
It seems relevant to all BSD systems.

In xcode the option -Wno-error-implicit-function-declaration is enabled. So the following error occured:
Idris2/support/c/idris_file.c:76:13: Missing '#include <sys/time.h>'; declaration of 'select' must be imported from module 'Darwin.POSIX.sys.time' before it is required

I hope it won't break anything on linux.
2020-06-01 00:48:19 +03:00
Edwin Brady
54119bc4e2
Merge pull request #210 from edwinb/elab-reflection
Initial steps to elaborator reflection
2020-05-31 15:06:50 +01:00
Edwin Brady
5b20fbd45c Workaround for bug in bootstrap version
The bootstrap version has an occasional bug with as patterns, which is
tripped by elabScript. This works around it.
(I'd rather do this than update the Scheme, since Idris2-boot will still
work this way!)
2020-05-31 14:48:40 +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
bb240d4390
Merge pull request #206 from edwinb/coverage-fix
Calculate compile time references even in case
2020-05-30 22:15:18 +01:00
Edwin Brady
26e6e1ed82 Calculate compile time references even in case
If we don't do this, we don't look inside case blocks to check they
cover, and so we might miss coverage errors in nested case blocks.
Fixes #202
2020-05-30 21:53:29 +01:00
Edwin Brady
12aa6b6228
Merge pull request #204 from edwinb/fix-vim
findIpkg needs to set working directory
2020-05-30 19:22:01 +01:00
Edwin Brady
773d0dfdee findIpkg needs to set working directory
This makes vim mode work again.
I don't know a good way to test this, since it involves dealing with
absolute paths. If anyone has the bash skills to get this working in a
pkg test, please do...
2020-05-30 18:49:48 +01:00
Edwin Brady
e7baf313f0
Merge pull request #203 from edwinb/visibility
Add visibility rules on types
2020-05-30 18:01:24 +01:00
Edwin Brady
c212255290 IOArray needs to export max 2020-05-30 17:40:48 +01:00
Edwin Brady
ecaa73bad5 Update test result
Not sure why this didn't fail for me locally... possibly libraries out
of sync.
2020-05-30 17:30:31 +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
c90410334b
Merge pull request #201 from andylokandy/pathfix
Make pathToNS handle absolute path
2020-05-30 16:13:53 +01:00
Edwin Brady
6c37636c1b
Merge pull request #200 from edwinb/findipkg
Allow absolute paths in --find-ipkg
2020-05-30 16:13:02 +01:00
andylokandy
f007c7816e Sync Utils.Path with System.Path 2020-05-30 21:51:12 +08:00
andylokandy
1de3c3bb15 Make pathToNS handle absolute path 2020-05-30 21:43:48 +08: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
Edwin Brady
24664dd9b1 Allow absolute paths in --find-ipkg
Otherwise they need to be relative to know where the root of the module
tree is, so report an error with absolute paths in other cases.
2020-05-30 12:31:44 +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
5fd0f77f4e
Merge pull request #198 from edwinb/path-fix
Allow parsing multiple separators in Path
2020-05-30 11:38:25 +01:00
Edwin Brady
e067355c58 Allow parsing multiple separators in Path
Might help with #194
2020-05-30 11:19:28 +01:00
Edwin Brady
2005269c00
Merge pull request #197 from edwinb/reflection
Make a start on reflection
2020-05-29 23:23:33 +01:00
Edwin Brady
eb141cd54e Oops, forgot Elab.Quote 2020-05-29 22:47:28 +01: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
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
Kamil Shakirov
d43850d86e Merge branch 'master' into use-contrib 2020-05-29 15:05:18 +06:00
Marek
f1daf427b5 Add note to INSTALL.md about Chez thread support requirement when
building Chez Scheme locally from source and
improve formatting of first paragraphs

```
Compiling idris2_app/idris2-boot.ss with output to
idris2_app/idris2-boot.so
Exception: attempt to reference unbound identifier
make-thread-parameter at line 171, char 30 of idris2_app/idris2-boot.ss
```
2020-05-28 20:09:43 +01:00
Edwin Brady
1d87e3cd18
Merge pull request #192 from edwinb/as-patterns
As patterns
2020-05-28 19:46:31 +01:00
Edwin Brady
3b5f47d922 As patterns fix
As patterns weren't getting propagated to local definitions, due to a
combination of being stored as let bindings and being part of a pattern
scrutinee. The solution removes the computation behaviour, but that is
consistent with the way let works everywhere else.

(If we do as patterns as let bindings, the way case and locals elaborate
mean that the value gets recomputed. Fixing this would require changing
the way the core works, and I'm not going to do that for a while.)
2020-05-28 18:57:06 +01:00