Commit Graph

1083 Commits

Author SHA1 Message Date
Joel Berkeley
399d6016a9
[ prelude ] add subtract (#2357) 2022-03-17 18:24:42 +00:00
Joel Berkeley
fc45f7d888
[ base ] add insertAt for List (#2336) 2022-03-17 18:23:47 +00:00
G. Allais
a973396567
[ base ] quantifiers for Snoclists (#2349) 2022-03-16 15:30:16 +00:00
Denis Buzdalov
05d64483f6 [ refactor ] Factor out a type for primitive types out of Constant 2022-03-10 23:07:20 +00:00
G. Allais
fd02bf8b3e
[ fix #2303 ] remove quadratic unwords (#2345) 2022-03-07 18:34:06 +00:00
G. Allais
1c396744d9
[ doc ] :printdef for interface implementations (#2340) 2022-03-07 11:47:20 +00:00
Robert Wright
6b367010ce Inline SnocList foldl utility function
The scoping of the utility function meant that Idris treats `foldl f z (xs :< x)` and `f (foldl f z xs) x` as two different terms, making proving things about it difficult.
2022-03-07 11:46:43 +00:00
Joel Berkeley
0ab0ecb199
add replaceAt for List (#2335) 2022-03-03 23:40:18 +00:00
Joel Berkeley
f436388a6b
adopt backend implementations of pow (#2334) 2022-03-03 23:39:25 +00:00
G. Allais
1011cc6162
[ papers ] Tychonoff (Part I) (#2332) 2022-02-24 11:12:53 +00:00
Jan de Muijnck-Hughes
4ba3bb6670
[ fix ] Literate things (#2312)
Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
2022-02-18 11:29:52 +00:00
octeep
768d164ec9
[ network ] add binary support for socket + fix recvAll (#2308) 2022-02-16 20:12:24 +00:00
Denis Buzdalov
b727ae4a97 [ new ] Add a Monoid instance of the f a where f is Applicative 2022-02-16 14:23:56 +00:00
Denis Buzdalov
e2487106fd
[ prelude ] Ease Compose compositions (#2324) 2022-02-16 14:19:25 +00:00
CodingCellist
c5d96a10e7
[ base ] Split a list according to a decidable property (#2302) 2022-02-11 11:21:20 +00:00
Joel Berkeley
5abc01453d
add deleteAt for List (#2317) 2022-02-11 09:28:36 +00:00
G. Allais
33d99adb53
[ linear ] These seem useful (#2316) 2022-02-11 09:28:15 +00:00
Guillaume Allais
bec4a0a88e [ re #499 ] quantity-aware with-clauses 2022-02-09 09:19:40 +00:00
Mathew Polzin
8208ed2590
[ new ] A couple of nearly trivial proofs about list length. (#2311) 2022-02-07 17:51:04 +00:00
Nick Drozd
2c9bf24d2f [ libs ] Strengthen some totality checks (#2304) 2022-02-03 18:41:51 +00:00
Robert Wright
1776efa8a5 Allow Type-level String operations 2022-02-03 16:10:47 +00:00
CodingCellist
f4b78157cc
[ base,tests ] Reduce dependency on contrib (#1595) 2022-02-02 11:17:10 +00:00
Guillaume Allais
56009ad3ac [ cleanup ] silence warnings in libs 2022-02-02 11:09:03 +00:00
madman-bob
0ee9632e45
[ refactor ] Abstract Prelude.elem to work with all Foldables (#2294) 2022-02-01 21:34:29 +00:00
Denis Buzdalov
b17e65fc82
[ base ] Generalise existing min-max semigroups and add monoid for Fin (#2298) 2022-02-01 21:24:49 +00:00
André Videla
208adb7202
[ linear ] add utilities for linear datastructures (#2293) 2022-02-01 21:22:16 +00:00
Stefan Höck
44245e1683
[ fix ] issue #2288 (#2289) 2022-01-28 09:01:09 +00:00
Guillaume Allais
3c63902d82 [ new ] Dependent Tagless Final 2022-01-27 17:26:52 +00:00
Michael Messer
26527c3a6e
[ fix ] expose Data.Seq.Internal (#2291) 2022-01-26 18:38:22 +00:00
Alias Qli
1ba0008486
[contrib] A finger tree implementation (#1454) 2022-01-25 18:29:48 +00:00
octeep
9a9412e1a2
make writeBufferData return the number of bytes that have been written (#2276) 2022-01-25 13:25:06 +00:00
G. Allais
ec5afa5065
[ libs ] move propaganda out of contrib (#2213) 2022-01-25 12:25:55 +00:00
James Cook
e82600c4d6
[ opt ] transform rule making List.length tail-recursive. (#2100) 2022-01-24 16:12:29 +00:00
stefan-hoeck
1b3be25075 [ breaking, totality ] fGetLine should be covering 2022-01-20 17:48:11 +00:00
Zoe Stafford
5e42bbfcc9
Merge pull request #2274 from octeep/main
make readBufferData return the number of bytes that have been read
2022-01-20 13:11:13 +00:00
Robert Wright
d85016b64d Add Fin modular arithmetic Num instance 2022-01-20 10:13:20 +00:00
Stefan Höck
ca5b1ba094
[ totality ] Data.String.words should be total (#2262) 2022-01-20 09:58:50 +00:00
MarcelineVQ
6d10ca09b4 [ base ] add Show for Ordering 2022-01-19 22:12:36 +00:00
octeep
f7bcd1f0b2 make readBufferData return the number of bytes that have been read 2022-01-19 17:35:14 +00:00
Robert Wright
76d1936fad Add Singleton type 2022-01-19 14:22:40 +00:00
Mathew Polzin
4220c644cf
Add a few missing NodeJS FFI functions to System (#2271)
* support for system command via node backend.

* Add env var set/unset

* fix env unset function

* Update libs/base/System.idr

* modify system test to cover node and chez.

* Add base tests for env get/set
2022-01-18 22:43:03 -08:00
Guillaume Allais
ffff9bc2e1 [ new ] die 2022-01-18 18:44:36 +00:00
Ellis Kesterton
f93e1c4eac
Change associativity for System.Path operators (#2240)
Co-authored-by: eayus <erk@st-andrews.ac.uk>
2022-01-06 18:23:51 +00:00
Mathew Polzin
1b4811b1ed
[cleanup] Unhide string module (#2230)
* unhide string lines/unlines functions and clean up a bit.
* skip the extra newline now that unlines adds one at the end.
2022-01-06 10:34:15 +00:00
Nick Drozd
ec5f40eec7
Injective follow-up (#2155) 2022-01-05 09:40:23 +00:00
Ellis Kesterton
f016a81e37
Add 'tryParse' function to 'System.Path' (#2234) 2021-12-30 16:23:45 -08:00
Mathew Polzin
266e06cab7
[cleanup] Small round of unused import culling. (#2231)
* small round of unused import culling.

* and also the libraries.
2021-12-29 20:42:29 -08:00
Denis Buzdalov
7834539240
[ re #238 ] Fix program error condition of git diff call in Golden (#2119)
* [ fix ] Fix returned status of the `system` function

* [ re #238 ] Fix program error condition of `git diff` call in `Golden`

According to documentation, not only negative exit code means error
2021-12-22 13:33:37 -08:00
alissa-tung
158cb1c75e [ nodejs ] pid 2021-12-22 22:25:21 +08:00
Denis Buzdalov
a09c5082c5
[ base ] Use Fin n as index in Bits (#2192) 2021-12-16 18:26:52 +00:00
teggot
d3aed0404c
[ fix #1959 ] use modern record update syntax (#2196) 2021-12-16 18:23:18 +00:00
Balazs Komuves
3463adbc48
[ fix #2032 ] Slow typechecking on Int operation when Data.Fin.fromInteger is in scope (#2189) 2021-12-13 13:47:53 +00:00
Balazs Komuves
c3ec522077
[ fix #1404 ] Totality annotation for data type definitions (#2179)
Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
Co-authored-by: stefan-hoeck <hock@zhaw.ch>
2021-12-08 16:08:26 +00:00
Kamil Shakirov
ce67a2edd5 [ fix ] Re-add Pretty instances for IntX 2021-12-08 14:58:32 +00:00
André Videla
10b9685e4b
Injective interface and its implementations (#2114)
Co-authored-by: Nick Drozd <nicholasdrozd@gmail.com>
2021-11-26 10:55:17 +00:00
Denis Buzdalov
f1941cecac [ cleanup ] Remove piece of dead code from prelude 2021-11-26 10:14:47 +00:00
G. Allais
059f74ad0b
[ fix #1861 ] rewrite_impl is linear (#2150) 2021-11-25 17:07:05 +00:00
Nick Drozd
9e0676597d Cut relation implicit args 2021-11-25 00:26:57 +00:00
Guillaume ALLAIS
a91fdae426 [ base ] generalise Data.List type signatures 2021-11-24 19:58:35 +00:00
stefan-hoeck
c504a26bc8 [ type inference ] use determining parameter in relation interfaces 2021-11-22 09:52:32 +00:00
Mathew Polzin
1576a578a0
[ cleanup ] Remove unused imports (#2123)
* contrib library unused import removal
* remove a few unused imports.
* another round of unused import removal
* another round of unused import deletion.
* another round of unused import deletion.
2021-11-18 16:47:36 +00:00
Thomas Dziedzic
c31cd9513f make Data.List1.length public 2021-11-18 16:42:49 +00:00
Thomas Dziedzic
88f8f3df8e implement Data.List1.length 2021-11-18 08:38:00 +00:00
Mathew Polzin
0eba4c691e
Add %deprecate pragma (#2086) 2021-11-17 10:41:03 +00:00
André Videla
cc45ff957a
Merge pull request #2085 from andrevidela/string-parser-position
Show the line and column in diagnostic message in String.Parser
2021-11-15 11:09:57 +00:00
Denis Buzdalov
ba180706d6 [ ux ] Make expected and given results be printed colourful in Golden 2021-11-11 23:25:11 +00:00
Kamil Shakirov
ae411fe756 [ doc ] Mark code blocks as Idris code 2021-11-11 18:55:11 +00:00
Mathew Polzin
d2ce85ea05
Merge pull request #2096 from madman-bob/system-run
Add the `System` `run` function
2021-11-10 08:58:39 -08:00
Robert Wright
2ee10d9b34 Add Alternating List odds and evens functions 2021-11-10 08:40:25 +00:00
André Videla
9e6678e3d3
Merge pull request #2102 from madman-bob/list-singleton
Add List singleton function
2021-11-10 00:46:40 +00:00
André Videla
7f932036e9 Show the line and column in diagnostic message
This also updates the error message of some common combinators
2021-11-10 00:44:09 +00:00
Zoe Stafford
3063218d46
[ new ] Add %nomangle (#2063)
This is (for once) not a breaking changes, instead backends will need to opt in to this change, using the utilities in Compiler.NoMangle. See the js backend for an example of how to do this.

This is the first step to being able to use idris to create libraries usable by other languages.
2021-11-09 16:23:50 +00:00
Edwin Brady
2f6ec76223
Get information about names in reflection (#2110)
* Only normalise a search goal if it's fast

While we do end up normalising it anyway on success, there might be
things blocking it that make the intermediate terms very big, so only do
it speculatively to see if it's quick.

* Get information about names in reflection

Currently this is only whether it's a function, or data or type
constructor. I expect more may be useful/possible.
2021-11-07 15:06:53 +00:00
Robert Wright
921bc24a2a Add List singleton function 2021-11-05 16:08:54 +00:00
Robert Wright
4732486bbc Add System run function 2021-11-05 11:59:17 +00:00
Robert Wright
dc47df688c Add System.File fRead function 2021-11-05 11:59:17 +00:00
Robert Wright
c1fc487bec Return error code from pclose 2021-11-05 11:59:17 +00:00
Robert Wright
ac716c1dc7 Add SnocList factConcat transformation 2021-11-05 11:59:17 +00:00
Robert Wright
c964f8d8bc Add System escapeCmd function 2021-11-05 11:59:17 +00:00
G. Allais
668c221474
[ re #2032 ] faster version of fromInteger (#2090) 2021-11-02 17:43:01 +00:00
G. Allais
15cc8243f7
[ re #2001 ] Make some prelude interfaces total (#2083)
The prelude interfaces that have default definitions for all of
their fields are declared total so that users are forced to think
about meeting the minimal requirements for an implementation to be
valid.
2021-11-02 15:34:52 +00:00
André Videla
1a8747541e
Merge pull request #2080 from madman-bob/take-until
Add takeUntil Data.String.Parser parser
2021-11-02 00:38:57 +00:00
Robert Wright
12955bc5bc Add takeUntil Data.String.Parser parser 2021-11-01 13:54:46 +00:00
Bertalan Kis
babf346a77 [base] add IsRight and IsLeft proofs to Data.Either 2021-11-01 11:50:05 +00:00
madman-bob
a6a64c6ddf
[ contrib ] Alternating lists of known parity (#2043) 2021-10-30 00:12:44 +01:00
CodingCellist
0dbdcd30be
[ doc ] Document the System module and its submodules. (#2069) 2021-10-29 17:58:29 +01:00
CodingCellist
20fe83de9a
[ doc ] Completely document the Data.List module (#2061) 2021-10-26 17:16:06 +01:00
Denis Buzdalov
377ae22eac [ elab ] Implement Alternative for Elab using recently added Try 2021-10-25 16:16:51 +01:00
Denis Buzdalov
a47b3d7d0e
[ new ] Elaboration interface (#1860) 2021-10-25 16:16:13 +01:00
Denis Buzdalov
c340e0e713 [ cleanup ] Move left autos that are most likely to be passed explicitly 2021-10-25 13:17:03 +01:00
Mathew Polzin
f078d5f5dc
clean up some deprecations (#2057)
* deprecate Data.Nat.Order.decideLTE

* Add properties for LTE/GTE that produce the difference.

* remove deprecated function now that it is available in the base library.

* remove two deprecated lines.

* remove module deprecated since v0.4.0

* fix prelude reference to renamed primitive.

* finish removing Data.Num.Implementations

* remove deprecated dirEntry function.

* remove deprecated fastAppend. Update CHANGELOG.

* replace fastAppend in test case

* replace fastAppend uses in compiler.

* remove new properties that weren't actually very new.
2021-10-24 12:06:57 +01:00
alissa-tung
453305fb6e [base]: add appendFile 2021-10-23 15:20:22 +01:00
Guillaume ALLAIS
2ee06e9db0 [ fix #2034 ] Productive cantor for Colist1 2021-10-21 16:01:02 +01:00
Daniel Kröni
aa107a9754
Implemented %noinline (#2027)
* Implemented %noinline

* Removed trailing spaces.

* Added missing case in Reify FnOpt

* Added error message when both %inline and %noinline are set.

* Added test.

* Changed from perror to error
2021-10-19 15:22:36 +01:00
Mathew Polzin
a2ea7a76f4
Improvements to System.Random, specifically JS support. (#2009) 2021-10-19 00:04:25 +01:00
Denis Buzdalov
7833829c43 [ base ] Add couple of properties of either function with mappings 2021-10-18 20:11:38 +01:00
Edwin Brady
40f72e74f0
Case building performance/heuristics (#2020)
* Case tree/coverage checking shortcuts

We were calculating some things we didn't need - we can stop computing
the type of a case operator when we know the head, because that's all we
need for coverage checking. We can also abandon checking a left hand
side for coverage purposes if we encounter an empty type. Both of these
can save quite a bit of time in complex cases.

* Normalisation heuristic for pattern variables

If they get bit, fully normalise (like we do with case types) since it's
likely a big term with lots of applications will normalise a lot.
2021-10-17 18:21:35 +01:00
Guillaume Allais
2ce4831010 [ base ] swap for these 2021-10-17 16:57:04 +01:00
Edwin Brady
cfb7395eac
Add try primitive to reflection library (#2008) 2021-10-16 11:24:12 +01:00
stefan-hoeck
62237f74ea [ fix ] fastConcat for JS backends 2021-10-14 14:58:51 +01:00
Guillaume ALLAIS
1877e66309 [ new ] log sugared term Elab primitive 2021-10-14 14:16:14 +01:00
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
Stefan Höck
1ebe204c3f
[ refactor ] use proper int types for Constant (#1964)
* [ refactor ] user proper int types for Constant

* [ cleanup ] declare standalone TTC implementations for BitsN/IntN

Rather than doing the casting inline, have the (en/de)coding all
side by side in one place

* [ cleanup ] remove duplicated code

Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-10-08 12:07:11 +01:00
Zoe Stafford
d4263441b7
[ new ] Some optimisations mainly involving Nat and Fin (#1817)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-10-07 19:21:32 +01:00
Dr. ERDI Gergo
8b8ddfce5c Add buildExpressionParser, based on Parsec's implementation 2021-10-07 16:14:02 +01:00
Robert Wright
937ab7157c Add Cast to JSON interface implementations 2021-10-06 18:35:25 +01:00
Robert Wright
8c44f423cc Add JSON Show as Idris code interface implementation 2021-10-06 18:35:25 +01:00
stefan-hoeck
3536f8dab5 [ new ] DecEq for Int types 2021-09-30 11:38:38 +01:00
Edwin Brady
1e90182311
Version increment to 0.5.1 (#1939)
This is to remove the requirement on Chez >9.5
2021-09-19 20:53:32 +01:00
Edwin Brady
ada3eb4449
Version 0.5.0 (#1931)
* Update version numbers and bootstrap scheme

* Use wall clock time for search timeouts

That was always the intention in any case, rather than the process time.
2021-09-18 16:07:34 +01:00
James Cook
971afa9f5d
Add a transform rule making (++) for List tail-recursive. (#1888) 2021-09-16 15:35:29 +01:00
Denis Buzdalov
44328d73de [ fix ] Wrap paths in quotes for one more call for system 2021-09-16 10:49:18 +01:00
G. Allais
8b9916f5b1
[ html ] Various HTML docs fixes (#1924) 2021-09-15 18:41:37 +01:00
Denis Buzdalov
f6281afe88
[ elab ] Erase check and quote's main argument (#1847) 2021-09-15 15:01:36 +01:00
G. Allais
32e26c5bd1
[ refactor ] introduce UserName for (UN/RF) (#1926)
Instead of having UN & RF (& Hole in the near future & maybe even
more later e.g. operator names) we have a single UN constructor
that takes a UserName instead of a String.

UserName is (for now)

```idris
data UserName : Type where
  Basic : String -> UserName -- default name constructor       e.g. map
  Field : String -> UserName -- field accessor                 e.g. .fst
  Underscore : UserName      -- no name                        e.g. _
```

This is extracted from the draft PR #1852 which is too big to easily
debug. Once this is working, I can go back to it.
2021-09-15 13:20:58 +01:00
shenlebantongying
d4553a1a2d
Add chez-scheme to chez search path (#1921) 2021-09-14 12:07:44 +01:00
Denis Buzdalov
853547e99c [ golden ] Allow test dir names to contain spaces 2021-09-14 12:05:46 +01:00
Ruslan
9e4d97fbea
invFin: export ~> public export and invFinSpec (#1890)
* export ~> public export

* Add a theorem about `invFin` specification

* Lower the visibility level of `invFinSpec`
2021-09-10 16:06:11 +01:00
Mathew Polzin
654d399eaf
Add function that checks whether a file handle points to a TTY device. (#1908)
* Add function that checks whether a file is a terminal device.

* support isTTY function for NodeJS backend.

* don't accidentally interpret 'false' string as truthy number

* less code duplication.
2021-09-10 08:05:21 +01:00
Jan de Muijnck-Hughes
155989110b
[ base ] Indexing Vectors. (#1892) 2021-09-09 10:45:11 +01:00
Denis Buzdalov
5d70c746b1 [ prelude ] Implement Semigroup for ordinary pairs 2021-09-03 18:00:03 +01:00
Denis Buzdalov
d62e45d8d8 [ contrib ] Make sorted map be able to store dependently typed values 2021-09-02 10:57:19 +01:00
Mathew Polzin
ef91cc01c7 Add list difference to base Data.List module. 2021-08-31 13:21:43 +01:00
madman-bob
7a3d557bab
Add copyDir function (#1805)
Co-authored-by: Stiopa Koltsov <stepan.koltsov@gmail.com>
2021-08-30 16:42:58 +01:00
Joel Berkeley
078db21edf
Return a Vect from Stream take (#1812)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-08-30 16:00:20 +01:00
Mathew Polzin
cdc157a333 Add javascript support for getting system time as integer. 2021-08-30 15:35:49 +01:00
madman-bob
3e1f6aba56
Add copyFile to System.File (#1797)
Co-authored-by: Stiopa Koltsov <stepan.koltsov@gmail.com>
2021-08-30 15:31:37 +01:00
G. Allais
1e0027721f
[ fix #1859 ] Undo my mistakes (#1866) 2021-08-27 16:18:24 +01:00
Guillaume ALLAIS
99b005886f [ fix ] invalid Cast instances
integerToNat is only equal to `believe_me` at runtime, not at compile
time. You'd believe it cannot be a problem given that the implementation
of `Cast` is not exported but the REPL reduces everything.
2021-08-25 12:02:04 +01:00
stefan-hoeck
ed9a21f6bc [ new ] support prim__putStr in browser 2021-08-24 03:44:57 +00:00
Daniel Kröni
370a273b35 Inline Neg implementations 2021-08-17 19:34:52 +01:00
stefan-hoeck
1e8f9b3c36 [ fix ] export Show instance for Bounds 2021-08-15 08:49:19 +01:00
Denis Buzdalov
dd7d77d416 [ visibility ] Make Monad of Vect to the visible from outside 2021-08-13 18:59:54 +01:00
Denis Buzdalov
c29dc73c62 [ base ] Add semigroup and monoid instances for Vect 2021-08-13 18:59:54 +01:00
Denis Buzdalov
23bb381f0f [ cleanup ] Small code cleanup, less mutual block and one \case use 2021-08-12 12:38:06 +01:00
Denis Buzdalov
940f588890 [ ttimp ] Add a utility function returning an FC by TTImp 2021-08-11 14:18:41 +01:00
Denis Buzdalov
c3398274d5 [ elab ] Add an ability to fail elab script with a custom FC 2021-08-11 14:18:41 +01:00
Denis Buzdalov
8fb18e24a1 [ fix ] Make standard monad transformer's Alternative be lazy on 2nd arg 2021-08-11 11:33:46 +01:00
Denis Buzdalov
99f1e11ddb [ cleanup ] Slightly improve readability 2021-08-11 11:33:46 +01:00
Denis Buzdalov
9357d777f6 [ base ] Relax requirement of Alternative implementation for ReaderT 2021-08-11 11:33:46 +01:00
G. Allais
21c6f4fb79
[ breaking ] remove parsing of dangling binders (#1711)
* [ breaking ] remove parsing of dangling binders

It used to be the case that

```
ID : Type -> Type
ID a = a

test : ID (a : Type) -> a -> a
test = \ a, x => x
```

and

```
head : List $ a -> Maybe a
head [] = Nothing
head (x :: _) = Just x
```

were accepted but these are now rejected because:

* `ID (a : Type) -> a -> a` is parsed as `(ID (a : Type)) -> a -> a`
* `List $ a -> Maybe a` is parsed as `List (a -> Maybe a)`

Similarly if you want to use a lambda / rewrite / let expression as
part of the last argument of an application, the use of `$` or parens
is now mandatory.

This should hopefully allow us to make progress on #1703
2021-08-10 19:24:32 +01:00
Tim Engler
be37e5b458 Added "lookupBetween" "leftMost" and "rightMost" to Data.SortedMap 2021-08-10 09:42:53 +01:00
Denis Buzdalov
15ccebbcf2 [ contrib ] Implementation of Zippable was added for Validated 2021-08-09 10:06:20 +01:00
Alex Humphreys
f3855d7100
Update contrib Text.Parser to match Library.Text.Parser (#1808)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-08-06 10:03:13 +01:00
Zoe Stafford
1669fc351b
Refactor %builtin (#1803)
* Stub for future 'identity' optimisation
I plan to add this later, but I'm using for now for
NaturalToInteger and IntegerToNatural

* Refactor `%builtin`
fixes #1799

- automatically optimise all Natural shaped things
- NaturalToInteger and IntegerToNatural now use
  new `Identity` flag (internal use only for now)
  which signals the function is identity at runtime

* Use NaturalToInteger and IntegerToNatural for Nat and Fin
Also define show fin in terms of finToInteger, for speed

* Fix name handling for %builtin

* [ tests ] fixes + #1799

* remove %builtin from libs
Add back after next version

* Use resolved names where convenient
2021-08-03 14:19:17 +01:00
Sventimir
4920601fe9
Add tests for Nat ranges and fix bad range [1,2..1] behaviour. (#1794)
Co-authored-by: Marcin Pastudzki <marcin.pastudzki@gmail.com>
2021-07-28 06:52:59 +01:00
Guillaume ALLAIS
c48fe486fa [ cleanup ] on is meant to be used with 2 arguments
The previous definition means it won't reduce until it's applied to
4 arguments which may have detrimental effects: ``f `on` fst`` would
for instance stay blocked, with some implicit arguments of the form
`DPair a b`. This means that `b` appears in a negative position in
the expression which may lead to positivity checking rejecting a
datatype defined using `on`!

I have decided to leave `g` and `f` on the LHS because I expect `on`
to be used either:
  1. partially applied to two arguments
  2. in a section if only applied to 1 and sections get eta-expanded
     by the parser so that's fine.
2021-07-27 13:58:41 +01:00
Guillaume ALLAIS
31ffb4e5c7 [ cleanup ] various public export & cleanup
Turns out that `Smaller` and `LT` won't unify because
1. the instance Sized Nat is not publicly exported
2. Smaller, and LT are stuck until fully applied

The given changes make that go away.
2021-07-27 09:06:20 +01:00
Guillaume ALLAIS
13ef8ba707 [ fix #1782 ] remove the case-specific code
I can't make sense of this code, it seems to try to convert the
case function corresponding to `let (a, b) = f n in ...` into a
different case function where `f n` and `(a, b)` have been unified.
But if `f n` is a bona fide stuck computation, there's no chance of
this happening.

Just turning this off solves the #1782 and only breaks one function
in the whole of the idris2 repo (I would have expected our current
termination oracle to be too weak to detect it as valid anyway!)
and one in frex (which, again, should not have been seen as terminating).

Also fixes #1460
2021-07-26 17:03:16 +01:00
Guillaume ALLAIS
230f42b697 [ re #1771 ] Do not use Erased to go under binders
In the `MkFix : f (Fix f) -> Fix f` example, using `Erased` for `f`
makes the type reduce to `[__] (Fix [__]) -> Fix [__]` and because
`[__] e1 ... en` computes to `[__]`, we end up with `[__] -> Fix [__]`
which does not reference `Fix` anymore.
2021-07-23 13:30:24 +01:00
André Videla
5576d30c27
Merge pull request #1736 from stepancheg/test-discovery
Implement test discovery
2021-07-22 08:56:02 +00:00
Ben Hormann
74db7714d4
[fix] Loading libidris2_support.dll with Racket (#1583) 2021-07-21 14:35:21 +01:00
Mathew Polzin
5f34801200 Make drop and drop' public exported from the vect module. 2021-07-20 14:27:43 +01:00
Nick Drozd
ab36ad71cf Simplify a few Factor proofs
A few proofs have been rewritten, a few unnecessary cases cut, and
lots of unnecessary "explicit implicits" have been cut. Probably these
implicits were required when the code was initially written, and
inference has improved since then.
2021-07-19 08:30:47 +01:00
Stiopa Koltsov
7325002dec Implement test discovery
`testInDir dir ...` lists all directories in `dir` which contains
`run` files, and such directories are considered tests.

This is done to make test addition/maintenance cheaper.

Convert some test directories to `testInDir`, but not all of them
because
* some directories are listed in several test groups
* other directories are have some tests disabled
2021-07-17 16:53:43 +01:00
Stiopa Koltsov
4eff6ac916 System.Directory.listDir
This function is what users want 99.9% of time.
2021-07-17 14:58:57 +01:00
Stiopa Koltsov
c7629e20fe Skip dot and dot-dot in nextDirEntry
These entries returned by `readdir` are legacy of Unix API, we don't
really need them. Most APIs do not return them (for example Java
`Files.newDirectoryStream` or Python `os.listdir`).
2021-07-17 14:58:28 +01:00
Stiopa Koltsov
0ecf74e434 System.Directory.nextDirEntry
* add `nextDirEntry` which returns `Maybe String`, so `Nothing` on
  the end of directory unlike `dirEntry` which returns unspecified error
  on the end of directory
* `dirEntry` is deprecated now, but not removed because compiler depends on it
* native implementation of `dirEntry` is patched to explicitly reset `errno`
  before the `readdir` call: without it end of directory and error were
  indistinguishable
* test added
2021-07-17 14:57:27 +01:00
Stepan Koltsov
ce44d3b50a
Change semantics of lines and unlines function to match Haskell and other languages (#1585)
* Add trailing newline on non-empty list in unlines

There are several reasons to do that:
* a line in a text file is something which ends with newline,
  and the last line is not special
* `unlines []` should be different from `unlines [""]`
* `unlines (a ++ b) = unlines a ++ unlines b`
* Haskell does it

* Change lines function behaviour
2021-07-17 14:54:23 +01:00
Stiopa Koltsov
5a351f4e7e Accept HasIO in onCollect functions
Since most functions work with `HasIO`, it is more convenient to
accept `HasIO` in `onCollect` and `onCollectAny`.
2021-07-17 14:42:34 +01:00
Alex Humphreys
f195aed2cd [ Test ] allow 'N' as an acceptable response
Situation I just ran into that I found confusing:
```
Golden value differs from actual value.
Accept actual value as new golden value? [y/N]
N
Invalid answer.
```
2021-07-17 13:29:13 +01:00
Zoe Stafford
0fec867583 [ fix ] Name in Language.Reflection.TT
This was different to `Name` in `Core.Name`
Specifically `CaseBlock` and `WithBlock` had an `Int` instead of a `String`
2021-07-16 20:05:49 +01:00
Edwin Brady
d2af6e5027 Export throw and catch again in App
Fixes #1706
2021-07-16 11:42:24 +01:00
Edwin Brady
66217b6fa6
Merge branch 'master' into refc-buffer 2021-07-16 09:44:40 +01:00
Edwin Brady
050abe663e
Merge pull request #1638 from stepancheg/idris2-time
Use C idris2_time for all C-based backends
2021-07-16 09:40:08 +01:00
Edwin Brady
a20aba63ee
Merge pull request #1448 from mattpolzin/case-tree-experiments-merge-upstream
Case tree heuristics
2021-07-16 08:47:19 +01:00
Giuseppe Lomurno
07c62e9eef Fixed wrong reflection of records and parameters 2021-07-16 04:28:52 +02:00
Mathew Polzin
89125e96dd merge w/ upstream 2021-07-15 17:21:08 -07:00
Edwin Brady
a880b9884c
Merge pull request #1670 from stepancheg/buffer-names
Add parameter names to Buffer builtins parameter names
2021-07-16 00:53:42 +01:00
Edwin Brady
f4cc2f1ea8
Merge pull request #1721 from edwinb/AliasQli-master
Updated: add doublePow to primitives
2021-07-15 23:17:53 +01:00
Stiopa Koltsov
c80a502627 Return Bool from IOArray.writeArray
As suggested in #1677.

Crashing on out-of-bounds might be more practical, but we can
reconsider it later.
2021-07-15 22:16:22 +01:00
Edwin Brady
4079ae0e25 Merge branch 'master' of https://github.com/AliasQli/Idris2 into AliasQli-master 2021-07-15 21:44:26 +01:00
Edwin Brady
9b0ebcd08b Merge branch 'elab-name-changes' of https://github.com/MarcelineVQ/Idris2 into MarcelineVQ-elab-name-changes 2021-07-15 13:16:47 +01:00
Stiopa Koltsov
291823c752 Remove prim__getErrno from Prelude.IO
The function is not used, and it is defined incorrectly.
2021-07-14 03:15:49 +01:00
Stiopa Koltsov
f81c37ea3a Pass Buffer as char* when using C functions in RefC
To be able to use `C` functions for both Scheme and RefC: it was
not possible for `Buffer` before this PR.

As an example, `writeBufferData` and `readBufferData` functions are
removed: generic C backend implementations are used instead.
2021-07-13 23:04:36 +01:00
Nick Drozd
9cca3a7d35
Use Not instead of -> Void (#1667) 2021-07-13 15:32:01 +01:00
Johann Rudloff
d5abff4e46
[ fix #1260 ] Use blodwen-stringbytelen instead of C's strlen (#1261) 2021-07-13 11:52:15 +01:00
Stiopa Koltsov
1617d95961 System.Errno.strerror
* add `strerror` function
* move `getErrno` to `System.Errno`
* use `strerror` in `Show FileError`
* on node there's no access to `strerror`, so `strerror` just converts the number to string
2021-07-13 10:34:04 +01:00
Stiopa Koltsov
d676ea6ab4 Expose malloc and free from System.FFI
* Move `malloc`/`free` from `Network.FFI` to `System.FFI`
* Might be useful by other code
2021-07-13 10:24:26 +01:00
Stiopa Koltsov
ed40b212b2 Make System.Signal async-signal-safe
It is not safe to call `malloc` or `pthread_mutex_lock` from signal
handler.
2021-07-12 20:43:26 +01:00
Nick Drozd
a07d42ac91
Delete old Order file, update changelog and contributors (#1685) 2021-07-12 10:53:45 +01:00
Stiopa Koltsov
b4918d51ff Add parameter names to Buffer builtins parameter names
Also rename `loc` -> `offset`.
2021-07-11 10:43:12 +01:00
Stefan Höck
599d0635e9
[ refactor ] JS backend overhaul (#1609) 2021-07-10 11:15:21 +01:00
Nick Drozd
61b9a3e4e5
Define and implement Relation interfaces (#1472)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-07-09 09:06:27 +01:00
Stiopa Koltsov
8fd58b3bdd More reliable exception handling in Control.App
Convert `App.Control.Exception` interface to an alias to `HasErr`.

Probably `Exception` interface need to be deprecated or removed.

Note similar problem exists with `PrimIO` calling `PrimIO, Exception`,
also need to be fixed.

Fix this scenario:

```
throwBoth : Has [Exception String, Exception Int] es => App es ()

throwOne : Has [Exception Int] es => App es Int
throwOne {es} = handle {err = String} {e = es} throwBoth (\r => pure 1) (\e => pure 3)
```

With this commit it works, before this commit it failed with:

```
Error: While processing right hand side of throwOne. Can't find an implementation for Exception Int (String :: es).

TestException.idr:8:48--8:57
   |
 8 | throwOne {es} = handle {err = String} {e = es} throwBoth (\r => pure 1) (\e => pure 3)
   |                                                ^^^^^^^^^
```
2021-07-06 10:43:54 +01:00
CodingCellist
fac0e32f48
[ fix ] Chez channels (#1596) 2021-07-02 13:13:50 +01:00
Alissa Tung
2865a70a6e
[ base ] add List functions (#1550)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-07-01 08:00:12 +01:00
John Mager
dc755e1df5 Pretty instances for IntX 2021-06-30 08:18:37 +01:00
Nick Drozd
9cb20f3653
Clean up some assert_total instances (#1644) 2021-06-29 22:05:40 +01:00
Stefan Höck
39d596f3b9
[ new ] Support reflecting on new intX types (#1642) 2021-06-29 20:58:41 +01:00
Stefan Höck
f5bcc81115
[ new ] Add FromChar and FromDouble interfaces to the prelude (#1641) 2021-06-29 08:37:02 +01:00
Stiopa Koltsov
3d5ad0ca91 Use C idris2_time for all C-based backends 2021-06-28 23:57:58 +01:00
kasiaMarek
6f9b926b1b
module Data.SnocList.Elem (#1478)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-06-28 20:34:39 +01:00
Stefan Höck
6ed266d306
[ new ] Missing integer type interfaces (#1629)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-06-28 20:00:10 +01:00
Fabián Heredia Montiel
d5167a0108
[ fix #1581 ] public export Range functions and implementations (#1602)
Since `[a..b]` uses `takeUntil`/`takeBefore` indirectly those too had to
be changed to `public export` clashing with `Data.Stream` definitions.

A small readability refactor was made with the `compare` function from
`EqOrd`.
2021-06-28 16:52:23 +01:00
Tim Engler
05f28724ed
[ fix #1579 ] Nat hack for comparison operators (#1580)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-06-28 16:48:08 +01:00
Nick Drozd
63a6b16517 Cut unneeded type specifications 2021-06-28 16:22:27 +01:00
Nick Drozd
f49aa3c001 Simplify a few more lambdas 2021-06-28 15:57:21 +01:00
technic93
0aa968fe56
Add Split and SplitRec views for Vect (#1624)
Co-authored-by: Denis Buzdalov <public@buzden.ru>
2021-06-28 15:54:43 +01:00
Kamiλ Shakirov
8e30b296c0
[ refactor ] Remove Data.Strings module (#1607) 2021-06-28 13:48:37 +01:00
Stiopa Koltsov
a6555549ee Route System.prim__system through C function
To be able to eventually refactor/extend `system` function: to be
able to specify a directory, environment variables, specify arguments
as array etc. Ideally it should be something like Rust
[`std::process::Command`](https://doc.rust-lang.org/std/process/struct.Command.html).
2021-06-28 11:28:14 +01:00
Edwin Brady
d6370380e6 Missing interface methods now cause an error
This was always the intended behaviour, but until now not implemented!
This caught a couple of issues in contrib and a test.
2021-06-27 20:03:19 +01:00
Jan de Muijnck-Hughes
939bc8d8ff
Merge pull request #1610 from gallais/fix-golden
[ fix ] Various Test.Golden fixes
2021-06-24 20:27:20 +01:00
Guillaume ALLAIS
516b1b18f5 [ fix ] padding shouldn't be affected by ANSI escape codes 2021-06-24 16:38:27 +01:00
Guillaume ALLAIS
c217911573 [ fix ] Only pass --cg to test exec if requested
Do not pass a codegen choice when the test pool specifies it does
not require a codegen to be specified.
2021-06-24 16:36:03 +01:00
Edwin Brady
a93def90a9 Merge github.com:idris-lang/Idris2 into prepare-040 2021-06-23 18:16:36 +01:00
Edwin Brady
5689786b26
Merge pull request #1598 from gallais/show-void
[ fix ] missing Show implementations in libs
2021-06-23 18:11:40 +01:00
Edwin Brady
7d3e3e0719 Check sizes of buffers and strings in TTCs
They need to be positive or we can't make the buffer, which causes a
segfault. This happened when loading old TTCs with a different format.
Fixes #1503
2021-06-23 18:08:27 +01:00
Guillaume ALLAIS
afd55951c2 [ fix ] missing Show (Fin n) in base 2021-06-23 16:46:25 +01:00
Edwin Brady
ae73c39609 Merge github.com:idris-lang/Idris2 into prepare-040 2021-06-23 16:17:40 +01:00
Edwin Brady
c1057a19af
Merge pull request #1489 from buzden/some-uninhabiteds
[ base ] Some lacking implementations for `Uninhabited`
2021-06-23 16:17:32 +01:00
Edwin Brady
a0cfa28621 Update version numbers 2021-06-23 16:15:21 +01:00
Guillaume ALLAIS
21cca08df1 [ fix ] missing Show Void in prelude 2021-06-23 15:33:12 +01:00
G. Allais
d2986e5fea
[ refactor ] to allow testpools to specify a backend (#1591) 2021-06-21 22:12:17 +01:00
G. Allais
49f8cefeff
[ cleanup ] Test.Golden (#1526) 2021-06-21 17:30:11 +01:00
Tim Engler
68c6fe222c
[ Fix #1577 ] Actually use natMinus hack (#1578)
And also make sure that the output is truncated to 0.

Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-06-18 11:50:54 +01:00
CodingCellist
55f8bc3b90
Improve case-splitting formatting to not introduce new whitespace; add a bit of comments+docs. (#1553) 2021-06-17 16:48:59 +01:00
Nick Drozd
0db136d168
Hoist some pures (#1556) 2021-06-16 15:22:52 +01:00
Nick Drozd
ec438760d9
Simplify some lambdas (#1561) 2021-06-16 15:22:30 +01:00
Fabián Heredia Montiel
a28bc65544
Fix deadlocks [Rebased, Squashed] (#1536)
Co-authored-by: Arnaud Bailly <arnaud.oqube@gmail.com>
Co-authored-by: Guillaume Allais <guillaume.allais@ens-lyon.org>
Co-authored-by: Fabián Heredia Montiel <fabianhjr@protonmail.com>
Co-authored-by: Ruslan Feizerakhmanov <me@russoul.me>
2021-06-15 14:31:31 +01:00
Denis Buzdalov
927c358bef [ base ] Some lacking implementations for Uninhabited were added 2021-06-15 15:07:54 +03:00
Nick Drozd
488b4709f4
Use map for some maybes (#1548) 2021-06-14 17:52:43 +01:00
Robert Wright
1875f62248 Remove freeBuffer function
Each backend is now responsible for freeing Buffers in the same way as other objects
2021-06-14 15:06:44 +01:00
Robert Wright
c6a5827319 Add RefC readBufferData/writeBufferData support 2021-06-14 15:06:44 +01:00
Robert Wright
d202139171 Distinguish common C and RefC Buffer functions 2021-06-14 15:06:44 +01:00
Robert Wright
c63f25dac2 Distinguish common C and RefC FFI calls 2021-06-14 15:06:44 +01:00
Robert Wright
85e4df8004 Add filenames to Golden Test missing file error reporting 2021-06-14 12:56:39 +01:00
Mathew Polzin
0209cee41a include the other definition of drop because both are quite useful. 2021-06-14 11:44:38 +01:00
Mathew Polzin
bdd8f4157b Add drop for Vect. 2021-06-14 11:44:38 +01:00
Nick Drozd
4a0a5759b8
Return Maybe from strengthen (#1540)
Co-authored-by: Fabián Heredia Montiel <303897+fabianhjr@users.noreply.github.com>
2021-06-14 10:59:49 +01:00
André Videla
161ea5d50a
Merge pull request #1521 from LibreCybernetics/add-totality-annotatations
Add totality annotations to `src` and `libs/{prelude, base}`
2021-06-13 19:51:48 +00:00
Fabián Heredia Montiel
4c99537062 Add color to tests 2021-06-13 10:36:30 -05:00
Denis Buzdalov
bf0985602f [ totality ] More %default total stuff 2021-06-12 21:06:08 -05:00
Fabián Heredia Montiel
dad4dcdaf8 Add totality annotations to src and libs/{prelude, base} 2021-06-12 21:06:08 -05:00
Edwin Brady
18c7e2c4da Merge github.com:idris-lang/Idris2 into normalise-tweaks 2021-06-10 12:22:02 +01:00
Edwin Brady
7d235272e3 Remove redundant converstion checks in Pi types
We've already checked argument and scope types, so only need to check
mulitplicities. This saves a lot of repetition when checking lambdas.
2021-06-10 12:19:41 +01:00
Ruslan Feizerakhmanov
7aee7c9b7c
[ new ] --install-with-src; refactoring around FCs (#1450)
Why:

* To implement robust cross-project go-to-definition in LSP
  i.e you can jump to definition of any global name coming
  from library dependencies, as well as from the local project files.

What it does:

*  Modify `FC`s to carry `ModuleIdent` for .idr sources,
   file name for .ipkg sources or nothing for interactive runs.

*  Add `--install-with-src` to install the source code alongside
   the ttc binaries. The source is installed into the same directory
   as the corresponding ttc file. Installed sources are made read-only.

*  As we install the sources pinned to the related ttc files we gain
   the versioning of sources for free.
2021-06-05 12:53:22 +01:00
G. Allais
c5b10f0b52
[ doc ] for the linear pair constructor (#1492)
Co-authored-by: Mathew Polzin <matt.polzin@gmail.com>
2021-06-03 13:04:56 +01:00
madman-bob
98d67499db
RefC Integer Support (#1480)
* Add utility functions to treat All as a heterogeneous container
* Distinguish RefC Int and Bits types
* Change RefC Integers to be arbitrary precision
* Add RefC Bits maths operations
* Make RefC div and mod Euclidean
* Add RefC bit-ops tests
* Add RefC integer comparison tests
* Add RefC IntN support
2021-06-03 10:44:42 +01:00
Denis Buzdalov
29cc1f4248 [ refactor ] Use f <$> ... instead of pure f <*> ... in traverses 2021-06-01 20:28:49 +01:00
Zoe Stafford
24f7c9d5be
Add foldMap to Foldable (#1483) 2021-06-01 15:05:04 +01:00
Alias Qli
d477ad7b4c fixes 2021-05-27 21:31:47 +08:00
Kamil Shakirov
2e61779878 [ docs ] Build docs for the 'test' package 2021-05-27 11:12:44 +01:00
Fabián Heredia Montiel
30c178c815
[ feature ] Implement -Werror (WarningsAsErrors) (#1466)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-05-27 09:23:20 +01:00
Guillaume ALLAIS
b5cbf9274d [ test ] cosmetic improvements
Put the dependency checks in the banner, e.g.:

------------------------------------------------------------------------
Base library
✓ Found Chez at /usr/bin/chezscheme9.5
✓ Found node at /usr/bin/node
------------------------------------------------------------------------
2021-05-26 19:50:50 +01:00
Alias Qli
81fc2edbe0
Merge branch 'master' into master 2021-05-27 00:20:07 +08:00
G. Allais
1fd5ccf080
[ fix #1453 ] rename cast -> coerce (#1468) 2021-05-26 08:12:58 +01:00
Mathew Polzin
a0a417240e
Simple signal handling (#1458) 2021-05-25 16:45:46 +01:00
stefan-hoeck
e293d82577 [ fix ] System.getArgs on node backend 2021-05-25 13:26:42 +01:00
Ohad Kammar
699de70301
[contrib] More properties of vectors (#1449) 2021-05-24 08:48:00 +01:00