Commit Graph

1200 Commits

Author SHA1 Message Date
Edwin Brady
ccdfc363e3
Merge pull request #739 from edwinb/refcount-c
Experimental C backend with reference counting
2020-10-21 11:12:28 +01:00
Edwin Brady
77ba750abf
Merge pull request #5 from MarcelineVQ/refcount-c
remove some redundancy, make tiny style changes
2020-10-21 10:15:27 +01:00
Edwin Brady
0a705f846c
Merge pull request #4 from melted/refcount-c
Make it build on windows
2020-10-21 10:14:31 +01:00
Jan de Muijnck-Hughes
de58c66ab2
Make Idris2 test harness available for the many and not the few. (#719)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2020-10-19 09:26:23 +01:00
Guillaume ALLAIS
14d0141ca2 [ fix #735 ] Make sure type constructors are fully applied 2020-10-16 14:44:11 +01:00
Guillaume ALLAIS
7192ef28a3 [ test ] add IDRIS2_TESTS_CG env variable 2020-10-16 14:44:11 +01:00
Guillaume ALLAIS
482527063c [ new ] Variant with a runtime irrelevant Domain
Rather than translating the constraints to a Dybjer-Setzer IR code
we can produce an ad-hoc definition of a `Domain` that we will be
able to make runtime irrelevant.

This means that compiled code will never need to construct a proof
that a value is in the domain of the function: it will simply run
the function!
2020-10-15 17:03:32 +01:00
Guillaume ALLAIS
864be2c9dc [ contrib ] add McBride's General monad 2020-10-15 17:03:32 +01:00
Matúš Tejiščák
1483b61091
Merge pull request #741 from ShinKage/ide-flush
Flush stdout in IDE mode first message
2020-10-14 09:12:37 +02:00
Giuseppe Lomurno
37c4fd5771 Flush stdout in IDE mode first message 2020-10-14 03:32:54 +02:00
MarcelineVQ
50faacf69c remove some redundancy, make tiny style changes 2020-10-11 22:18:51 -07:00
Niklas Larsson
604e7ea99e Make it build on windows 2020-10-11 23:36:52 +02:00
Edwin Brady
0972e69287 Update changelog 2020-10-11 18:55:43 +01:00
Edwin Brady
97e5f04c34 Add believe_me and crash primitives to refc 2020-10-11 18:51:45 +01:00
Edwin Brady
3007b5a99d Generate an executable via CC
This builds a .o from the generated C, and statically links with the
libidris2_support library. It doesn't yet dynamically link with any
additional libraries.
2020-10-11 18:35:51 +01:00
Edwin Brady
788bea3906 Update tests to list refc 2020-10-11 15:59:22 +01:00
Edwin Brady
2a39a6461a Merge github.com:idris-lang/Idris2 into refcount-c 2020-10-11 15:12:18 +01:00
Edwin Brady
a76a1322eb Initial merge of reference counting C back end
Written by Volkmar Frinken (@vfrinken). This is intended as a
lightweight (i.e. minimal dependencies) code generator that can be
ported to multiple platforms, especially those with memory constraints.

It shouldn't be expected to be anywhere near as fast as the Scheme back
end, for lots of reasons. The main goal is portability.
2020-10-11 15:05:00 +01:00
Matúš Tejiščák
1a58075a54
Merge pull request #716 from sysvinit/fix-network-constants
Retrieve network address family preprocessor constants from C runtime code
2020-10-11 08:37:44 +02:00
Matúš Tejiščák
1d2437abd5
Merge pull request #717 from zenntenn/patch-1
Suggest adding a Jupyter kernel for Idris
2020-10-11 08:34:19 +02:00
Matus Tejiscak
f64163de1f Merge branch 'unscheme' into master 2020-10-11 08:20:01 +02:00
Matus Tejiscak
668762e693 Merge branch 'revert-projections' into master 2020-10-11 08:12:00 +02:00
Ohad Kammar
ef730c7eb1
preorder reasoning: introduce a Step datatype (#734)
Refactor the DIY equational reasoning library to be a bit more like
the generic pre-order reasoning library:

Change the `...` notation into a constructor for a new `Step` datatype.

This seems to help idris disambiguate between the two kinds of
reasoning when they're used in the same file (e.g., frex).

Co-authored-by: Ohad Kammar <ohad.kammar@ed.ac.uk>
2020-10-07 17:44:18 +01:00
Ohad Kammar
0c1a124704
Division theorem (#695)
Division Theorem. For every natural number `x` and positive natural
number `n`, there is a unique decomposition:
`x = q*n + r`
with `q`,`r` natural and `r` < `n`.

`q` is the quotient when dividing `x` by `n`
`r` is the remainder when dividing `x` by `n`.

This commit adds a proof for this fact, in case
we want to reason about modular arithmetic (for example, when dealing
with binary representations). A future, more systematic, development could
perhaps follow: @clayrat 's (idris1) port of Coq's binary arithmetics:

    https://github.com/sbp/idris-bi/blob/master/src/Data/Bin/DivMod.idr
    https://github.com/sbp/idris-bi/blob/master/src/Data/Biz/DivMod.idr
    https://github.com/sbp/idris-bi/blob/master/src/Data/BizMod2/DivMod.idr

In the process, it bulks up the stdlib with:
+ a generic PreorderReasoning module for arbitrary preorders,
analogous for the equational reasoning module
+ some missing facts about Nat operations.
+ Refactor some Nat order properties using a 'reflect' function

Co-authored-by: Ohad Kammar <ohad.kammar@ed.ac.uk>
Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
2020-10-06 13:09:02 +01:00
Ruslan Feizerahmanov
2e627ad16e
Remove invalid implicit in PreorderReasoning (#727) 2020-10-03 14:53:14 +01:00
G. Allais
5e85446e9c
[ fix #724 ] Typo in the magic string (#726) 2020-10-03 14:39:13 +01:00
Ohad Kammar
c02481fb55
[contrib] Add a Reflects datatype (#722)
* [contrib] Add a `Reflects` datatype

as discussed in PR #695
2020-10-02 17:41:36 +01:00
G. Allais
f17354a503
Fix link in feature-requests-and-proposals.md 2020-10-02 14:40:22 +01:00
G. Allais
4a61146ba0
[ fix #705 ] Normalise primitives in mkPat (#718)
[ log ] prettier log for pats & clauses
[ re #650 ] Even lazier
[ fix #705 ] normalise primitives in mkPat
[ refactor ] introduce getPrimitiveNames
2020-10-02 12:22:57 +01:00
russoul
a667aae797 Fix another DPair parsing regression 2020-10-02 11:22:48 +01:00
zenntenn
f9880a31e4
Update CONTRIBUTING.md 2020-10-01 13:26:36 -04:00
MarcelineVQ
1619206d24 add specifier check for cli compilation
Missed a case which is covered now by checking for exceptions where
postOptions is used

add *> <* to Core
2020-10-01 14:12:31 +01:00
Molly Miller
7d5ec53b53 Add a (>>) operator, implemented in terms of (>>=).
This mirrors the (>>) found in Haskell, which is the same as (>>=), except the
second computation (on the right hand side) takes no arguments, and the result
of the first computation is discarded. This is a trivial implementation written
in terms of (>>=).
2020-10-01 13:16:58 +01:00
Molly Miller
dff0f1da43 network: Retrieve AF_* magic constants from C support code.
The Network.Socket.Data code previously used hardcoded constants manually read
from auto-generated C source code, however these constants are specific to
Linux. The original code looked like this:

    export
    ToCode SocketFamily where
      -- Don't know how to read a constant value from C code in idris2...
      -- gotta to hardcode those for now
      toCode AF_UNSPEC = 0 -- unsafePerformIO (cMacro "#AF_UNSPEC" Int)
      toCode AF_UNIX   = 1
      toCode AF_INET   = 2
      toCode AF_INET6  = 10

The AF_INET6 constant is correct on my Debian 10 laptop:

    molly on flywheel ~> grep -rE '^#define AF_INET6' /usr/include
    /usr/include/x86_64-linux-gnu/bits/socket.h:#define AF_INET6	PF_INET6
    molly on flywheel ~> grep -rE '^#define PF_INET6' /usr/include
    /usr/include/x86_64-linux-gnu/bits/socket.h:#define PF_INET6    10  /* IP version 6.  */

However, this is not the case on an OpenBSD machine:

    spanner# grep -rE '^#define[[:space:]]+AF_INET6' /usr/include
    /usr/include/sys/socket.h:#define	AF_INET6	24		/* IPv6 */

This commit adds accessor functions to the C runtime support library for
retrieving the values of these macros as they appear in the system libc header
files, which can then be invoked using the normal C FFI machinery.
2020-10-01 12:05:42 +01:00
Brandon Elam Barker
28cf2a3083 Making "functional dependencies" easier to find 2020-09-30 19:33:02 +01:00
Rodrigo B. de Oliveira
a7cf1143b6 Make NmLet names unique in Compiler.ES.Imperative
Since the imperative form has no nesting of scopes.

Fixes #643
2020-09-30 13:43:59 +01:00
Arnaud Bailly
85f5d00054 fix totality annotation on some Nat functions 2020-09-30 10:51:51 +01:00
Ruslan Feizerahmanov
1d99a28176
Add Bifunctor interface (#701) 2020-09-30 10:51:07 +01:00
Niklas Larsson
5bbbfaf225
Merge pull request #709 from melted/unix_lib
Put the appdir first in LD_LIBRARY_PATH
2020-09-28 21:54:25 +02:00
Niklas Larsson
d5393b93bd Put the appdir first in LD_LIBRARY_PATH
So that we prefer the local support lib before others in the path.
2020-09-28 21:02:48 +02:00
MarcelineVQ
3f105cdc0f revert binary character literal
this wasn't doing anything anyway as it's first handled while
escaping in src/Parser/Support.idr and ends up clashing with \b
2020-09-28 13:25:03 +01:00
G. Allais
3df1f9c476
[ fix #63 ] interleaving let binders and local declarations (#691) 2020-09-28 13:15:22 +01:00
Guillaume ALLAIS
416b9578e5 [ fix #37 ] Use filename if we already know it 2020-09-24 15:56:23 +01:00
Guillaume ALLAIS
0d08c0b81b [ log ] for desugaring of idioms 2020-09-24 15:27:40 +01:00
MarcelineVQ
961a28ee64 fix idiom brackets to account for IAlternative
Things like (,) () aren't straightforward IVar's but are IAlternative's
which present options about how the term should resolve. [| |] was not
accounting for this.
2020-09-24 15:27:40 +01:00
MarcelineVQ
315fc8ce2d change ForeignFn to use TTImp to match RawImp version 2020-09-24 09:00:00 +01:00
Guillaume Allais
6d8bd62795 [ cleanup ] we only need one ifThenElse 2020-09-23 22:20:45 +01:00
Guillaume ALLAIS
cc31076849 [ test ] more corner cases
Making sure the test can distinguish between truncating & rounding.
2020-09-23 19:48:58 +01:00
Guillaume ALLAIS
621a9202ed [ test ] making sure cast works 2020-09-23 19:48:58 +01:00
russoul
883a8df429 Fix String->Int cast on Scheme backends 2020-09-23 19:48:58 +01:00