on master help sign in
.travis.yml+54−36
since splitsnapshots
unifiedsplit
@@ -1,5 +1,4 @@
1−dist: trusty
1+dist: xenial
2−sudo: false
3
2
4language: c
3language: c
5
4
@@ -9,35 +8,37 @@ env:
9
8
10matrix:
9matrix:
11 include:
10 include:
12− - env: CABALVER="2.2" GHCVER="8.4.1" STACKVER="7.14" STYLISH=YES
11+ - env: CABALVER="2.4" GHCVER="8.6.5" STACKVER="15.4" STYLISH=YES
13− addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.1,hscolour], sources: [hvr-ghc]}}
12+ addons: {apt: {packages: [cabal-install-2.4,ghc-8.6.5,hscolour], sources: [hvr-ghc]}}
14− - env: CABALVER="2.2" GHCVER="7.10.3" TESTS="test_c"
15− compiler: ": #GHC 7.10.3"
16− addons: {apt: {packages: [cabal-install-2.2,ghc-7.10.3,cppcheck,hscolour], sources: [hvr-ghc]}}
17−# Disabled because it's always timing out
18−# - env: CABALVER="1.24" GHCVER="8.0.1" TESTS="test_c"
19−# compiler: ": #GHC 8.0.1"
20−# addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,cppcheck,hscolour], sources: [hvr-ghc]}}
21− - env: CABALVER="2.0" GHCVER="8.2.2" TESTS="lib_doc doc"
13+ - env: CABALVER="2.4" GHCVER="8.2.2" TESTS="lib_doc doc"
22 compiler: ": #GHC 8.2.2"
14 compiler: ": #GHC 8.2.2"
23− addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,cppcheck,hscolour], sources: [hvr-ghc]}}
15+ addons: {apt: {packages: [cabal-install-2.4,ghc-8.2.2,cppcheck,hscolour], sources: [hvr-ghc]}}
24− - env: CABALVER="2.0" GHCVER="8.2.2" TESTS="test_js"
16+ - env: CABALVER="2.4" GHCVER="8.2.2" TESTS="test_js"
25 compiler: ": #GHC 8.2.2"
17 compiler: ": #GHC 8.2.2"
26− addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,cppcheck,hscolour], sources: [hvr-ghc]}}
18+ addons: {apt: {packages: [cabal-install-2.4,ghc-8.2.2,cppcheck,hscolour], sources: [hvr-ghc]}}
27− - env: CABALVER="2.0" GHCVER="8.2.2" TESTS="test_c"
19+ - env: CABALVER="2.4" GHCVER="8.2.2" TESTS="test_c"
28 compiler: ": #GHC 8.2.2"
20 compiler: ": #GHC 8.2.2"
29− addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,cppcheck,hscolour], sources: [hvr-ghc]}}
21+ addons: {apt: {packages: [cabal-install-2.4,ghc-8.2.2,cppcheck,hscolour], sources: [hvr-ghc]}}
30−#TODO: The idris built with those fails due to libffi dynamic linking version mismatch.
22+ - env: CABALVER="2.4" GHCVER="8.4.4" TESTS="lib_doc doc"
31−# Caused by the GHC backport to Trusty?
23+ compiler: ": #GHC 8.4.4"
24+ addons: {apt: {packages: [cabal-install-2.4,ghc-8.4.4,cppcheck,hscolour], sources: [hvr-ghc]}}
25+ - env: CABALVER="2.4" GHCVER="8.4.4" TESTS="test_js"
26+ compiler: ": #GHC 8.4.4"
27+ addons: {apt: {packages: [cabal-install-2.4,ghc-8.4.4,cppcheck,hscolour], sources: [hvr-ghc]}}
32−# - env: CABALVER="2.2" GHCVER="8.4.1" TESTS="lib_doc doc"
28+ - env: CABALVER="2.4" GHCVER="8.4.4" TESTS="test_c"
33−# compiler: ": #GHC 8.4.1"
29+ compiler: ": #GHC 8.4.4"
34−# addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.1,cppcheck,hscolour], sources: [hvr-ghc]}}
30+ addons: {apt: {packages: [cabal-install-2.4,ghc-8.4.4,cppcheck,hscolour], sources: [hvr-ghc]}}
31+ - env: CABALVER="3.0" GHCVER="8.8.3" TESTS="lib_doc doc"
32+ compiler: ": #GHC 8.8.3"
33+ addons: {apt: {packages: [cabal-install-3.0,ghc-8.8.3,cppcheck,hscolour], sources: [hvr-ghc]}}
35−# - env: CABALVER="2.2" GHCVER="8.4.1" TESTS="test_js"
34+ - env: CABALVER="3.0" GHCVER="8.8.3" TESTS="test_js"
36−# compiler: ": #GHC 8.4.1"
35+ compiler: ": #GHC 8.8.3"
37−# addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.1,cppcheck,hscolour], sources: [hvr-ghc]}}
36+ addons: {apt: {packages: [cabal-install-3.0,ghc-8.8.3,cppcheck,hscolour], sources: [hvr-ghc]}}
38−# - env: CABALVER="2.2" GHCVER="8.4.1" TESTS="test_c"
37+ - env: CABALVER="3.0" GHCVER="8.8.3" TESTS="test_c"
39−# compiler: ": #GHC 8.4.1"
38+ compiler: ": #GHC 8.8.3"
40−# addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.1,cppcheck,hscolour], sources: [hvr-ghc]}}
39+ addons: {apt: {packages: [cabal-install-3.0,ghc-8.8.3,cppcheck,hscolour], sources: [hvr-ghc]}}
40+ - env: CABALVER="3.0" GHCVER="8.8.3" IDRIS2=YES
41+ addons: {apt: {packages: [cabal-install-3.0,ghc-8.8.3], sources: [hvr-ghc]}}
41 fast-finish: true
42 fast-finish: true
42
43
43cache:
44cache:
@@ -56,7 +57,7 @@ before_install:
56 - unset CC
57 - unset CC
57 - if [[ $TRAVIS_OS_NAME == 'linux' ]];
58 - if [[ $TRAVIS_OS_NAME == 'linux' ]];
58 then
59 then
59− export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.cabal/bin:$PATH;
60+ export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.cabal/bin:$HOME/opt/scheme/bin/:$PATH;
60 export SED=sed;
61 export SED=sed;
61 export ZCAT=zcat;
62 export ZCAT=zcat;
62 fi
63 fi
@@ -71,6 +72,21 @@ before_install:
71 export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH;
72 export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH;
72 fi
73 fi
73 - if [ -n "$STYLISH" ]; then ./stylize.sh; exit $?; fi
74 - if [ -n "$STYLISH" ]; then ./stylize.sh; exit $?; fi
75+ - if [ -n "$IDRIS2" ];
76+ then
77+ git clone https://github.com/edwinb/Idris2 &&
78+ wget https://github.com/cisco/ChezScheme/archive/v9.5.2.tar.gz &&
79+ tar xvzf v9.5.2.tar.gz &&
80+ cd ChezScheme-9.5.2 &&
81+ ./configure --threads --installprefix=$HOME/opt/scheme &&
82+ make -j install &&
83+ cd .. &&
84+ cabal v1-update &&
85+ travis_wait cabal v1-install &&
86+ cd Idris2 &&
87+ make idris2 && make base && make contrib;
88+ exit $?;
89+ fi
74
90
75install:
91install:
76 - which cabal
92 - which cabal
@@ -88,7 +104,7 @@ install:
88 # causing cabal's default configuration (jobs: $ncpus)
104 # causing cabal's default configuration (jobs: $ncpus)
89 # to run into the GHC #9221 bug which can result in longer build-times.
105 # to run into the GHC #9221 bug which can result in longer build-times.
90 - $SED -i -r 's/(^jobs:).*/\1 2/' $HOME/.cabal/config
106 - $SED -i -r 's/(^jobs:).*/\1 2/' $HOME/.cabal/config
91− - cabal install -f FFI --only-dependencies --enable-tests --dry -v > installplan.txt
107+ - cabal v1-install -f FFI --only-dependencies --enable-tests --dry -v > installplan.txt
92 - $SED -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
108 - $SED -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
93 # check whether current requested install-plan matches cached package-db snapshot
109 # check whether current requested install-plan matches cached package-db snapshot
94 - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
110 - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
@@ -101,7 +117,7 @@ install:
101 echo "cabal build-cache MISS";
117 echo "cabal build-cache MISS";
102 rm -rf $HOME/.cabsnap;
118 rm -rf $HOME/.cabsnap;
103 mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
119 mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
104− cabal install -f FFI --only-dependencies --enable-tests;
120+ cabal v1-install -f FFI --only-dependencies --enable-tests;
105 fi
121 fi
106 # snapshot package-db on cache miss
122 # snapshot package-db on cache miss
107 - if [ ! -d $HOME/.cabsnap ];
123 - if [ ! -d $HOME/.cabsnap ];
@@ -112,28 +128,30 @@ install:
112 cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
128 cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
113 fi
129 fi
114
130
131+
115before_script:
132before_script:
116 - ORIGINAL_DIR=$(pwd)
133 - ORIGINAL_DIR=$(pwd)
117− - cabal sdist
134+ - cabal v1-sdist
118 - cd ..
135 - cd ..
119 - tar -xf ${ORIGINAL_DIR}/dist/${PKGNAME}*.tar.gz
136 - tar -xf ${ORIGINAL_DIR}/dist/${PKGNAME}*.tar.gz
120 - cd ${PKGNAME}*
137 - cd ${PKGNAME}*
121script:
138script:
139+ - export LD_PRELOAD=/opt/ghc/${GHCVER}/lib/ghc-${GHCVER}/rts/libffi.so.7
122###
140###
123 - echo 'Configure...' && echo -en 'travis_fold:start:script.configure\\r'
141 - echo 'Configure...' && echo -en 'travis_fold:start:script.configure\\r'
124− - cabal configure -f FFI -f CI --enable-tests
142+ - cabal v1-configure -f FFI -f CI --enable-tests
125 - echo -en 'travis_fold:end:script.configure\\r'
143 - echo -en 'travis_fold:end:script.configure\\r'
126###
144###
127 - echo 'Build...' && echo -en 'travis_fold:start:script.build\\r'
145 - echo 'Build...' && echo -en 'travis_fold:start:script.build\\r'
128− - cabal build
146+ - cabal v1-build
129 - echo -en 'travis_fold:end:script.build\\r'
147 - echo -en 'travis_fold:end:script.build\\r'
130###
148###
131 - echo 'Copy...' && echo -en 'travis_fold:start:script.copy\\r'
149 - echo 'Copy...' && echo -en 'travis_fold:start:script.copy\\r'
132− - cabal copy
150+ - cabal v1-copy
133 - echo -en 'travis_fold:end:script.copy\\r'
151 - echo -en 'travis_fold:end:script.copy\\r'
134###
152###
135 - echo 'Register...' && echo -en 'travis_fold:start:script.register\\r'
153 - echo 'Register...' && echo -en 'travis_fold:start:script.register\\r'
136− - cabal register
154+ - cabal v1-register
137 - echo -en 'travis_fold:end:script.register\\r'
155 - echo -en 'travis_fold:end:script.register\\r'
138###
156###
139 - echo 'Cppcheck...' && echo -en 'travis_fold:start:script.cppcheck\\r'
157 - echo 'Cppcheck...' && echo -en 'travis_fold:start:script.cppcheck\\r'
CHANGELOG.md+6−2
@@ -1,14 +1,18 @@
1−# New in next version
1+# New since last release
2−+ Documentation added to proof section
2++ Updated to work with GHC 8.8 and cabal 3.0
3
3
4+# New in 1.3.2
5++ Documentation added to proof section
4
6
5## Library updates
7## Library updates
6+ `openFile` opens the file in binary mode on Windows.
8+ `openFile` opens the file in binary mode on Windows.
9++ Added library functions `clockTime` and `fRemove`
7
10
8## Tool updates
11## Tool updates
9+ Modules no longer require building if imports have changed but all
12+ Modules no longer require building if imports have changed but all
10 interfaces (i.e. types for names declared `export` and definitions of names
13 interfaces (i.e. types for names declared `export` and definitions of names
11 declared `public export`) are unchanged.
14 declared `public export`) are unchanged.
15++ The result of calling `:doc` now details the accessbility of items as well as their totality.
12
16
13## Miscellaneous updates
17## Miscellaneous updates
14+ Compiler flag `--optimise-nat-like-types` enables compilation
18+ Compiler flag `--optimise-nat-like-types` enables compilation
CITATION.md+1−1
@@ -17,7 +17,7 @@ If you use `Idris` in your work we would prefer it if you would use the followin
17 pages = {552--593},
17 pages = {552--593},
18 numpages = {42},
18 numpages = {42},
19 doi = {10.1017/S095679681300018X},
19 doi = {10.1017/S095679681300018X},
20− URL = {http://journals.cambridge.org/article_S095679681300018X},
20+ URL = {https://journals.cambridge.org/article_S095679681300018X},
21}
21}
22```
22```
23
23
CONTRIBUTING.md+5−5
@@ -6,9 +6,9 @@ Here are a few guidelines that we would like contributors to follow so that we c
6
6
7## Getting Started
7## Getting Started
8
8
9−1. Make sure you are familiar with [Git](http://git-scm.com/book).
9+1. Make sure you are familiar with [Git](https://git-scm.com/book).
101. Make sure you have a [GitHub account](https://github.com/signup/free).
101. Make sure you have a [GitHub account](https://github.com/signup/free).
11−1. Make sure you are familiar with: [Idris](http://eb.host.cs.st-andrews.ac.uk/writings/idris-tutorial.pdf).
11+1. Make sure you are familiar with: [Idris](https://eb.host.cs.st-andrews.ac.uk/writings/idris-tutorial.pdf).
121. Make sure you can install Idris:
121. Make sure you can install Idris:
13 * [Mac OS X](https://github.com/idris-lang/Idris-dev/wiki/Idris-on-OS-X-using-Homebrew)
13 * [Mac OS X](https://github.com/idris-lang/Idris-dev/wiki/Idris-on-OS-X-using-Homebrew)
14 * [Ubuntu](https://github.com/idris-lang/Idris-dev/wiki/Idris-on-Ubuntu)
14 * [Ubuntu](https://github.com/idris-lang/Idris-dev/wiki/Idris-on-Ubuntu)
@@ -72,7 +72,7 @@ We do not want you wasting your time nor duplicating somebody's work!
72
72
73## Making Changes
73## Making Changes
74
74
75−Idris developers and hackers try to adhere to something similar to the [successful git branching model](http://nvie.com/posts/a-successful-git-branching-model/).
75+Idris developers and hackers try to adhere to something similar to the [successful git branching model](https://nvie.com/posts/a-successful-git-branching-model/).
76The steps are described below.
76The steps are described below.
77
77
78### New contributors
78### New contributors
@@ -175,8 +175,8 @@ To help increase the chance of your pull request being accepted:
175* Idris FAQs: [Official](https://idris.readthedocs.io/en/latest/faq/faq.html); [Unofficial](https://github.com/idris-lang/Idris-dev/wiki/Unofficial-FAQ);
175* Idris FAQs: [Official](https://idris.readthedocs.io/en/latest/faq/faq.html); [Unofficial](https://github.com/idris-lang/Idris-dev/wiki/Unofficial-FAQ);
176* [Idris Manual](https://github.com/idris-lang/Idris-dev/wiki/Manual);
176* [Idris Manual](https://github.com/idris-lang/Idris-dev/wiki/Manual);
177* [Idris Tutorial](https://idris.readthedocs.io/en/latest/tutorial/index.html);
177* [Idris Tutorial](https://idris.readthedocs.io/en/latest/tutorial/index.html);
178−* [Idris News](http://www.idris-lang.org/news/);
178+* [Idris News](https://www.idris-lang.org/news/);
179−* [other Idris docs](http://www.idris-lang.org/documentation/).
179+* [other Idris docs](https://www.idris-lang.org/documentation/).
180* [Using Pull Requests](https://help.github.com/articles/using-pull-requests)
180* [Using Pull Requests](https://help.github.com/articles/using-pull-requests)
181* [General GitHub Documentation](https://help.github.com/).
181* [General GitHub Documentation](https://help.github.com/).
182
182
INSTALL.md+30−5
@@ -70,7 +70,7 @@ NixOS unstable.
70
70
71*Important* Stack will not install any external dependencies required
71*Important* Stack will not install any external dependencies required
72to build Idris. Before you try stack please ensure you have the
72to build Idris. Before you try stack please ensure you have the
73−correct depenencies.
73+correct dependencies.
74
74
75To build Idris with stack use the following command:
75To build Idris with stack use the following command:
76
76
@@ -81,9 +81,9 @@ To install Idris:
81* `stack install`
81* `stack install`
82
82
83Stack will install Idris (and related executables) into `$HOME/.local/bin/`
83Stack will install Idris (and related executables) into `$HOME/.local/bin/`
84−on Unix based systems and an appropriate place on Windows. The libraries that
84+on Unix based systems and an appropriate place on Windows. The libraries that
85−are included with Idris (e.g. Builtins, Prelude) will 'install' into `<source
85+are included with Idris (e.g. Builtins, Prelude) will 'install' into `<source
86−dir>/.stack_work/install/...` so you'll need to keep your source directory
86+dir>/.stack_work/install/...` so you'll need to keep your source directory
87around after you've installed Idris using Stack.
87around after you've installed Idris using Stack.
88
88
89Of note: If you haven't used stack before commands will also setup the
89Of note: If you haven't used stack before commands will also setup the
@@ -125,4 +125,29 @@ encounter this then the fix is to augment the `PKG_CONFIG_PATH` for
125
125
126```
126```
127PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig stack build
127PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig stack build
128−```
128+```
129+
130+## Issue with GHC on Ubuntu/Fedora
131+
132+There is an upstream issue with GHC on some Ubuntu and Fedora machines.
133+The issue is that for GHC versions greater than 8.4.X linking to libFFI uses the version of libFFI shipped with GHC, instead of the system version.
134+
135+See the following GHC issue page for more information:
136+
137+ <https://gitlab.haskell.org/ghc/ghc/issues/15397>
138+
139+This means that an Idris built with `libFFI` support will fail at runtime as the executable would not be able to find the correct `libffi` shared object.
140+This will cause the build to fail.
141+Specifically, one will see an error message along the lines of:
142+
143+> error while loading shared libraries: libffi.so.7: cannot open shared object file: No such file or directory
144+
145+A workround for this bug is to override the used libffi version (this is what we use on CI):
146+
147+```bash
148+export LD_PRELOAD=/opt/ghc/${GHCVER}/lib/ghc-${GHCVER}/rts/libffi.so.7
149+```
150+
151+## GHC 8.6
152+
153+For reasons that haven't been investigated building the Idris compiler with GHC 8.6 leads to a compiler which doesn't pass test.
Makefile+10−10
@@ -15,14 +15,14 @@ endif
15endif
15endif
16
16
17install:
17install:
18− $(CABAL) install $(CABALFLAGS)
18+ $(CABAL) v1-install $(CABALFLAGS)
19
19
20pinstall: CABALFLAGS += --enable-executable-profiling
20pinstall: CABALFLAGS += --enable-executable-profiling
21pinstall: dist/setup-config
21pinstall: dist/setup-config
22− $(CABAL) install $(CABALFLAGS)
22+ $(CABAL) v1-install $(CABALFLAGS)
23
23
24build: dist/setup-config
24build: dist/setup-config
25− $(CABAL) build $(CABALFLAGS)
25+ $(CABAL) v1-build $(CABALFLAGS)
26
26
27test: doc test_c stylize
27test: doc test_c stylize
28
28
@@ -30,15 +30,15 @@ stylize:
30 ./stylize.sh
30 ./stylize.sh
31
31
32test_c:
32test_c:
33− $(CABAL) test $(ARGS) --test-options \
33+ $(CABAL) v1-test $(ARGS) --test-options \
34 "$(TEST-ARGS) --rerun-update +RTS -N$(TEST-JOBS) -RTS"
34 "$(TEST-ARGS) --rerun-update +RTS -N$(TEST-JOBS) -RTS"
35
35
36test_js:
36test_js:
37− $(CABAL) test $(ARGS) --test-options \
37+ $(CABAL) v1-test $(ARGS) --test-options \
38 "$(TEST-ARGS) --node --rerun-update +RTS -N$(TEST-JOBS) -RTS"
38 "$(TEST-ARGS) --node --rerun-update +RTS -N$(TEST-JOBS) -RTS"
39
39
40test_update:
40test_update:
41− $(CABAL) test $(ARGS) --test-options \
41+ $(CABAL) v1-test $(ARGS) --test-options \
42 "$(TEST-ARGS) --accept +RTS -N$(TEST-JOBS) -RTS"
42 "$(TEST-ARGS) --accept +RTS -N$(TEST-JOBS) -RTS"
43
43
44test_clean:
44test_clean:
@@ -49,14 +49,14 @@ lib_clean:
49 $(MAKE) -C libs IDRIS=../../dist/build/idris/idris RTS=../../dist/build/rts/libidris_rts clean
49 $(MAKE) -C libs IDRIS=../../dist/build/idris/idris RTS=../../dist/build/rts/libidris_rts clean
50
50
51relib: lib_clean
51relib: lib_clean
52− $(CABAL) install $(CABALFLAGS)
52+ $(CABAL) v1-install $(CABALFLAGS)
53
53
54linecount:
54linecount:
55 wc -l src/Idris/*.hs src/Idris/Elab/*.hs src/Idris/Core/*.hs src/IRTS/*.hs src/Pkg/*.hs src/Util/*.hs
55 wc -l src/Idris/*.hs src/Idris/Elab/*.hs src/Idris/Core/*.hs src/IRTS/*.hs src/Pkg/*.hs src/Util/*.hs
56
56
57#Note: this doesn't yet link to Hackage properly
57#Note: this doesn't yet link to Hackage properly
58doc: dist/setup-config
58doc: dist/setup-config
59− $(CABAL) haddock --hyperlink-source --html --hoogle --html-location="http://hackage.haskell.org/packages/archive/\$$pkg/latest/doc/html" --haddock-options="--title Idris"
59+ $(CABAL) v1-haddock --hyperlink-source --html --hoogle --html-location="https://hackage.haskell.org/packages/archive/\$$pkg/latest/doc/html" --haddock-options="--title Idris"
60
60
61lib_doc:
61lib_doc:
62 $(MAKE) -C libs IDRIS=../../dist/build/idris/idris doc
62 $(MAKE) -C libs IDRIS=../../dist/build/idris/idris doc
@@ -76,7 +76,7 @@ user_doc_pdf:
76 $(MAKE) -C docs latexpdf
76 $(MAKE) -C docs latexpdf
77
77
78fast:
78fast:
79− $(CABAL) install $(CABALFLAGS) --ghc-option=-O0
79+ $(CABAL) v1-install $(CABALFLAGS) --ghc-option=-O0
80
80
81dist/setup-config:
81dist/setup-config:
82− $(CABAL) configure $(CABALFLAGS)
82+ $(CABAL) v1-configure $(CABALFLAGS)
README.md+7−4
@@ -4,11 +4,11 @@
4[![Appveyor build](https://ci.appveyor.com/api/projects/status/xi8yu81oy1134g7o/branch/master?svg=true)](https://ci.appveyor.com/project/idrislang/idris-dev)
4[![Appveyor build](https://ci.appveyor.com/api/projects/status/xi8yu81oy1134g7o/branch/master?svg=true)](https://ci.appveyor.com/project/idrislang/idris-dev)
5[![Documentation Status](https://readthedocs.org/projects/idris/badge/?version=latest)](https://readthedocs.org/projects/idris/?badge=latest)
5[![Documentation Status](https://readthedocs.org/projects/idris/badge/?version=latest)](https://readthedocs.org/projects/idris/?badge=latest)
6[![Hackage](https://img.shields.io/hackage/v/idris.svg)](https://hackage.haskell.org/package/idris)
6[![Hackage](https://img.shields.io/hackage/v/idris.svg)](https://hackage.haskell.org/package/idris)
7−[![Stackage LTS](http://stackage.org/package/idris/badge/lts)](http://stackage.org/lts/package/idris)
7+[![Stackage LTS](https://stackage.org/package/idris/badge/lts)](https://stackage.org/lts/package/idris)
8−[![Stackage Nightly](http://stackage.org/package/idris/badge/nightly)](http://stackage.org/nightly/package/idris)
8+[![Stackage Nightly](https://stackage.org/package/idris/badge/nightly)](https://stackage.org/nightly/package/idris)
9[![IRC](https://img.shields.io/badge/IRC-%23idris-1e72ff.svg?style=flat)](https://www.irccloud.com/invite?channel=%23idris&hostname=irc.freenode.net&port=6697&ssl=1)
9[![IRC](https://img.shields.io/badge/IRC-%23idris-1e72ff.svg?style=flat)](https://www.irccloud.com/invite?channel=%23idris&hostname=irc.freenode.net&port=6697&ssl=1)
10
10
11−Idris (http://idris-lang.org/) is a general-purpose functional programming
11+Idris (https://idris-lang.org/) is a general-purpose functional programming
12language with dependent types.
12language with dependent types.
13
13
14## Installation Guides.
14## Installation Guides.
@@ -28,7 +28,7 @@ Idris has support for external code generators. Supplied with the distribution
28is a C code generator to compile executables, and a JavaScript code generator
28is a C code generator to compile executables, and a JavaScript code generator
29with support for node.js and browser JavaScript.
29with support for node.js and browser JavaScript.
30
30
31−More information about [code generators can be found on the wiki](http://idris.readthedocs.io/en/latest/reference/codegen.html).
31+More information about [code generators can be found on the wiki](https://idris.readthedocs.io/en/latest/reference/codegen.html).
32
32
33## More Information
33## More Information
34
34
@@ -44,3 +44,6 @@ where some interesting projects are being hosted.
44
44
45For those interested in contributing to Idris directly we kindly ask that
45For those interested in contributing to Idris directly we kindly ask that
46prospective developers please consult the [Contributing Guide](CONTRIBUTING.md) first.
46prospective developers please consult the [Contributing Guide](CONTRIBUTING.md) first.
47+
48+[Idris 2](https://github.com/edwinb/Idris2) is an early preview of the next generation
49+of Idris, implemented in Idris.
Setup.hs−33
@@ -215,36 +215,6 @@ idrisConfigure _ flags pkgdesc local = do
215 autogenComponentModulesDir lbi _ = autogenModulesDir lbi
215 autogenComponentModulesDir lbi _ = autogenModulesDir lbi
216#endif
216#endif
217
217
218−idrisPreSDist args flags = do
219− let dir = S.fromFlag (S.sDistDirectory flags)
220− let verb = S.fromFlag (S.sDistVerbosity flags)
221− generateVersionModule verb "src" True
222− generateBuildFlagsModule verb "src" []
223− generateTargetModule verb "src" "./libs"
224− generateToolchainModule verb "src" Nothing
225− preSDist simpleUserHooks args flags
226−
227−idrisSDist sdist pkgDesc bi hooks flags = do
228− pkgDesc' <- addGitFiles pkgDesc
229− sdist pkgDesc' bi hooks flags
230− where
231− addGitFiles :: PackageDescription -> IO PackageDescription
232− addGitFiles pkgDesc = do
233− files <- gitFiles
234− return $ pkgDesc { extraSrcFiles = extraSrcFiles pkgDesc ++ files}
235− gitFiles :: IO [FilePath]
236− gitFiles = liftM lines (readProcess "git" ["ls-files"] "")
237−
238−idrisPostSDist args flags desc lbi = do
239− Control.Exception.catch (do let file = "src" </> "Version_idris" Px.<.> "hs"
240− let targetFile = "src" </> "Target_idris" Px.<.> "hs"
241− putStrLn $ "Removing generated modules:\n "
242− ++ file ++ "\n" ++ targetFile
243− removeFile file
244− removeFile targetFile)
245− (\e -> let e' = (e :: SomeException) in return ())
246− postSDist simpleUserHooks args flags desc lbi
247−
248#if !(MIN_VERSION_Cabal(2,0,0))
218#if !(MIN_VERSION_Cabal(2,0,0))
249rewriteFileEx :: Verbosity -> FilePath -> String -> IO ()
219rewriteFileEx :: Verbosity -> FilePath -> String -> IO ()
250rewriteFileEx _ = rewriteFile
220rewriteFileEx _ = rewriteFile
@@ -353,8 +323,5 @@ main = defaultMainWithHooks $ simpleUserHooks
353 , postInst = \_ flags pkg local ->
323 , postInst = \_ flags pkg local ->
354 idrisInstall (S.fromFlag $ S.installVerbosity flags)
324 idrisInstall (S.fromFlag $ S.installVerbosity flags)
355 NoCopyDest pkg local
325 NoCopyDest pkg local
356− , preSDist = idrisPreSDist
357− , sDistHook = idrisSDist (sDistHook simpleUserHooks)
358− , postSDist = idrisPostSDist
359 , testHook = idrisTestHook
326 , testHook = idrisTestHook
360 }
327 }
appveyor.yml+2−2
@@ -5,13 +5,13 @@ init:
5
5
6 mkdir C:\ghc
6 mkdir C:\ghc
7
7
8− Invoke-WebRequest "http://downloads.haskell.org/~ghc/8.4.3/ghc-8.4.3-x86_64-unknown-mingw32.tar.xz" -OutFile C:\ghc\ghc.tar.xz -UserAgent "Curl"
8+ Invoke-WebRequest "https://downloads.haskell.org/~ghc/8.8.2/ghc-8.8.2-x86_64-unknown-mingw32.tar.xz" -OutFile C:\ghc\ghc.tar.xz -UserAgent "Curl"
9
9
10 7z x C:\ghc\ghc.tar.xz -oC:\ghc
10 7z x C:\ghc\ghc.tar.xz -oC:\ghc
11
11
12 7z x C:\ghc\ghc.tar -oC:\ghc
12 7z x C:\ghc\ghc.tar -oC:\ghc
13
13
14− $env:PATH="$env:PATH;c:\ghc\ghc-8.4.3\bin;$HOME\AppData\Roaming\cabal\bin"
14+ $env:PATH="$env:PATH;c:\ghc\ghc-8.8.2\bin;$HOME\AppData\Roaming\cabal\bin"
15
15
16 cabal v1-update
16 cabal v1-update
17
17
azure-pipelines.yml+1−1
@@ -68,7 +68,7 @@ jobs:
68 choco install 7zip.portable -y --no-progress
68 choco install 7zip.portable -y --no-progress
69 choco install msys2 -y --no-progress --params "/InstallDir=C:/msys64/"
69 choco install msys2 -y --no-progress --params "/InstallDir=C:/msys64/"
70 mkdir C:\ghc
70 mkdir C:\ghc
71− Invoke-WebRequest "http://downloads.haskell.org/~ghc/8.4.3/ghc-8.4.3-x86_64-unknown-mingw32.tar.xz" -OutFile C:\ghc\ghc.tar.xz -UserAgent "Curl"
71+ Invoke-WebRequest "https://downloads.haskell.org/~ghc/8.4.3/ghc-8.4.3-x86_64-unknown-mingw32.tar.xz" -OutFile C:\ghc\ghc.tar.xz -UserAgent "Curl"
72 7z x C:\ghc\ghc.tar.xz -oC:\ghc
72 7z x C:\ghc\ghc.tar.xz -oC:\ghc
73 7z x C:\ghc\ghc.tar -oC:\ghc
73 7z x C:\ghc\ghc.tar -oC:\ghc
74 displayName: "Setting up environment"
74 displayName: "Setting up environment"
benchmarks/pidigits/pidigits.idr+1−1
@@ -3,7 +3,7 @@ import Data.Vect
3
3
4{- Toy program that outputs the n first digits of Pi.
4{- Toy program that outputs the n first digits of Pi.
5
5
6− Inspired from http://www.haskell.org/haskellwiki/Shootout/Pidigits.
6+ Inspired from https://www.haskell.org/haskellwiki/Shootout/Pidigits.
7 The original ns and str lazy lists have been replaced by strict functions.
7 The original ns and str lazy lists have been replaced by strict functions.
8
8
9 Memory usage seems to be excessive. One of the branches of str is tail recursive, and
9 Memory usage seems to be excessive. One of the branches of str is tail recursive, and
docs/LICENSE+1−1
@@ -7,4 +7,4 @@ rights to Documentation for Idris.
7
7
8More information concerning the CC0 can be found online at:
8More information concerning the CC0 can be found online at:
9
9
10− http://creativecommons.org/publicdomain/zero/1.0/
10+ https://creativecommons.org/publicdomain/zero/1.0/
docs/Makefile+1−1
@@ -9,7 +9,7 @@ BUILDDIR = _build
9
9
10# User-friendly check for sphinx-build
10# User-friendly check for sphinx-build
11ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
11ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12−$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
12+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from https://www.sphinx-doc.org/)
13endif
13endif
14
14
15# Internal variables.
15# Internal variables.
docs/README.md+3−3
@@ -1,7 +1,7 @@
1# Documentation for the Idris Language.
1# Documentation for the Idris Language.
2
2
3
3
4−This manual has been prepared using ReStructured Text and the [Sphinx Documentation Generator](http://sphinx-doc.org) for future inclusion on [Read The Docs](http://www.readthedocs.org).
4+This manual has been prepared using ReStructured Text and the [Sphinx Documentation Generator](https://www.sphinx-doc.org) for future inclusion on [Read The Docs](https://www.readthedocs.org).
5
5
6## Dependencies
6## Dependencies
7
7
@@ -12,7 +12,7 @@ To build the manual the following dependencies must be met. We assume that you h
12Python should be installed by default on most systems.
12Python should be installed by default on most systems.
13Sphinx can be installed either through your hosts package manager or using pip/easy_install.
13Sphinx can be installed either through your hosts package manager or using pip/easy_install.
14
14
15−*Note* [ReadTheDocs](http://www.readthedocs.org) works with Sphinx
15+*Note* [ReadTheDocs](https://www.readthedocs.org) works with Sphinx
16 `v1.2.2`. If you install a more recent version of sphinx then
16 `v1.2.2`. If you install a more recent version of sphinx then
17 'incorrectly' marked up documentation may get passed the build system
17 'incorrectly' marked up documentation may get passed the build system
18 of readthedocs and be ignored. In the past we had several code-blocks
18 of readthedocs and be ignored. In the past we had several code-blocks
@@ -45,7 +45,7 @@ rights to Documentation for Idris.
45
45
46More information concerning the CC0 can be found online at:
46More information concerning the CC0 can be found online at:
47
47
48− http://creativecommons.org/publicdomain/zero/1.0/
48+ https://creativecommons.org/publicdomain/zero/1.0/
49
49
50
50
51When contributing material to the manual please bear in mind that the work will be licensed as above.
51When contributing material to the manual please bear in mind that the work will be licensed as above.
docs/conf.py+4−3
@@ -51,7 +51,7 @@ master_doc = 'index'
51
51
52# General information about the project.
52# General information about the project.
53project = u'Idris'
53project = u'Idris'
54−copyright = u'2017-2019, The Idris Community'
54+copyright = u'2017-2020, The Idris Community'
55author = u'The Idris Community'
55author = u'The Idris Community'
56
56
57# The version info for the project you're documenting, acts as replacement for
57# The version info for the project you're documenting, acts as replacement for
@@ -61,7 +61,7 @@ author = u'The Idris Community'
61# The short X.Y version.
61# The short X.Y version.
62version = '1.3'
62version = '1.3'
63# The full version, including alpha/beta/rc tags.
63# The full version, including alpha/beta/rc tags.
64−release = '1.3.1'
64+release = '1.3.2'
65
65
66# The language for content autogenerated by Sphinx. Refer to documentation
66# The language for content autogenerated by Sphinx. Refer to documentation
67# for a list of supported languages.
67# for a list of supported languages.
@@ -251,6 +251,7 @@ latex_elements = {
251# Additional stuff for the LaTeX preamble.
251# Additional stuff for the LaTeX preamble.
252'preamble': r'''
252'preamble': r'''
253\usepackage{lmodern}
253\usepackage{lmodern}
254+\usepackage{textalpha}
254\usepackage[T1]{fontenc}
255\usepackage[T1]{fontenc}
255\usepackage[utf8x]{inputenc}
256\usepackage[utf8x]{inputenc}
256\usepackage{titlesec}
257\usepackage{titlesec}
@@ -300,7 +301,7 @@ latex_elements = {
300# (source start file, target name, title,
301# (source start file, target name, title,
301# author, documentclass [howto, manual, or own class]).
302# author, documentclass [howto, manual, or own class]).
302latex_documents = [
303latex_documents = [
303− ('index', 'idris-documentation-complete.tex', u'Documentation for the Idris Language', u'The Idris Community', 'report'),
304+ # (master_doc, 'idris.tex', u'Documentation for the Idris Language', u'The Idris Community', 'report')
304 ('tutorial/index', 'idris-tutorial.tex', u'The Idris Tutorial', u'The Idris Community', 'howto'),
305 ('tutorial/index', 'idris-tutorial.tex', u'The Idris Tutorial', u'The Idris Community', 'howto'),
305]
306]
306
307
docs/effects/conclusions.rst+1−1
@@ -51,7 +51,7 @@ foundations are also well-studied see [5]_, [6]_, [7]_, [8]_.
51 Programming Languages and Systems (APLAS '09), Zhenjiang Hu
51 Programming Languages and Systems (APLAS '09), Zhenjiang Hu
52 (Ed.). Springer-Verlag, Berlin, Heidelberg,
52 (Ed.). Springer-Verlag, Berlin, Heidelberg,
53 95-110. DOI=10.1007/978-3-642-10672-9_9
53 95-110. DOI=10.1007/978-3-642-10672-9_9
54− http://link.springer.com/chapter/10.1007%2F978-3-642-10672-9_9
54+ https://link.springer.com/chapter/10.1007%2F978-3-642-10672-9_9
55
55
56
56
57.. [4] Ohad Kammar, Sam Lindley, and Nicolas Oury. 2013. Handlers in
57.. [4] Ohad Kammar, Sam Lindley, and Nicolas Oury. 2013. Handlers in
docs/effects/depeff.rst+18−9
@@ -43,8 +43,8 @@ express this as follows:
43
43
44.. code-block:: idris
44.. code-block:: idris
45
45
46− readInt : Eff ()[STATE (Vect n Int), STDIO]
46+ readInt : Eff () [STATE (Vect n Int), STDIO]
47− [STATE (Vect (S n) Int), STDIO]
47+ [STATE (Vect (S n) Int), STDIO]
48 readInt = do let x = trim !getStr
48 readInt = do let x = trim !getStr
49 putM (cast x :: !get)
49 putM (cast x :: !get)
50
50
@@ -153,12 +153,21 @@ file management follows a resource usage protocol with the following
153
153
154- When a file is closed, its handle should no longer be used
154- When a file is closed, its handle should no longer be used
155
155
156−These requirements can be expressed formally in , by creating a
156+These requirements can be expressed formally by creating a
157``FILE_IO`` effect parameterised over a file handle state, which is
157``FILE_IO`` effect parameterised over a file handle state, which is
158either empty, open for reading, or open for writing. The ``FILE_IO``
158either empty, open for reading, or open for writing. The ``FILE_IO``
159−effect’s definition is given below. Note that this
159+effect’s definition is given below.
160+
161+.. note::
160−effect is mainly for illustrative purposes—typically we would also like
162+ This effect is mainly for illustrative purposes.
163+ Typically we would also like to support random access files and
161−to support random access files and better reporting of error conditions.
164+ better reporting of error conditions.
165+
166+ Moreover, the ``FILE`` effect in the ``Effect.File`` module of
167+ the ``effects`` library uses slightly more complicated types to
168+ support erroneous behaviour of each function and to support more
169+ compilcated modes of opening, like for reading **and** writing,
170+ appending or truncating.
162
171
163.. code-block:: idris
172.. code-block:: idris
164
173
@@ -173,7 +182,7 @@ to support random access files and better reporting of error conditions.
173
182
174 open : (fname : String)
183 open : (fname : String)
175 -> (m : Mode)
184 -> (m : Mode)
176− -> Eff Bool [FILE_IO ()]
185+ -> Eff Bool [FILE_IO ()]
177 (\res => [FILE_IO (case res of
186 (\res => [FILE_IO (case res of
178 True => OpenFile m
187 True => OpenFile m
179 False => ())])
188 False => ())])
@@ -191,7 +200,7 @@ In particular, consider the type of ``open``:
191
200
192 open : (fname : String)
201 open : (fname : String)
193 -> (m : Mode)
202 -> (m : Mode)
194− -> Eff Bool [FILE_IO ()]
203+ -> Eff Bool [FILE_IO ()]
195 (\res => [FILE_IO (case res of
204 (\res => [FILE_IO (case res of
196 True => OpenFile m
205 True => OpenFile m
197 False => ())])
206 False => ())])
@@ -207,7 +216,7 @@ we continue the protocol accordingly.
207
216
208 readFile : Eff (List String) [FILE_IO (OpenFile Read)]
217 readFile : Eff (List String) [FILE_IO (OpenFile Read)]
209 readFile = readAcc [] where
218 readFile = readAcc [] where
210− readAcc : List String -> Eff (List String) [FILE_IO (OpenFile Read)]
219+ readAcc : List String -> Eff (List String) [FILE_IO (OpenFile Read)]
211 readAcc acc = if (not !eof)
220 readAcc acc = if (not !eof)
212 then readAcc (!readLine :: acc)
221 then readAcc (!readLine :: acc)
213 else pure (reverse acc)
222 else pure (reverse acc)
docs/effects/index.rst+1−1
@@ -25,7 +25,7 @@ A tutorial on the `Effects` package in `Idris`.
25 Idris Community* has waived all copyright and related or neighbouring
25 Idris Community* has waived all copyright and related or neighbouring
26 rights to Documentation for Idris.
26 rights to Documentation for Idris.
27
27
28− More information concerning the CC0 can be found online at: http://creativecommons.org/publicdomain/zero/1.0/
28+ More information concerning the CC0 can be found online at: https://creativecommons.org/publicdomain/zero/1.0/
29
29
30.. toctree::
30.. toctree::
31 :maxdepth: 1
31 :maxdepth: 1
docs/effects/introduction.rst+3−2
@@ -3,7 +3,7 @@ Introduction
3************
3************
4
4
5Pure functional languages with dependent types such as `Idris
5Pure functional languages with dependent types such as `Idris
6−<http://www.idris-lang.org/>`_ support reasoning about programs directly
6+<https://www.idris-lang.org/>`_ support reasoning about programs directly
7in the type system, promising that we can *know* a program will run
7in the type system, promising that we can *know* a program will run
8correctly (i.e. according to the specification in its type) simply
8correctly (i.e. according to the specification in its type) simply
9because it compiles. Realistically, though, things are not so simple:
9because it compiles. Realistically, though, things are not so simple:
@@ -17,7 +17,8 @@ exceptions, and verified resource management.
17This tutorial assumes familiarity with pure programming in Idris,
17This tutorial assumes familiarity with pure programming in Idris,
18as described in Sections 1–6 of the main tutorial [1]_. The examples
18as described in Sections 1–6 of the main tutorial [1]_. The examples
19presented are tested with Idris and can be found in the
19presented are tested with Idris and can be found in the
20−examples directory of the Idris repository.
20+examples directory of the Idris repository. The ``-p effects`` flag
21+is needed when starting Idris.
21
22
22Consider, for example, the following introductory function which
23Consider, for example, the following introductory function which
23illustrates the kind of properties which can be expressed in the type
24illustrates the kind of properties which can be expressed in the type
docs/effects/summary.rst+23−23
@@ -43,16 +43,16 @@ FILE\_IO
43 data OpenFile : Mode -> Type
43 data OpenFile : Mode -> Type
44
44
45 open : (fname : String)
45 open : (fname : String)
46− -> (m : Mode)
46+ -> (m : Mode)
47− -> Eff Bool [FILE_IO ()]
47+ -> Eff Bool [FILE_IO ()]
48− (\res => [FILE_IO (case res of
48+ (\res => [FILE_IO (case res of
49− True => OpenFile m
49+ True => OpenFile m
50− False => ())])
50+ False => ())])
51 close : Eff () [FILE_IO (OpenFile m)] [FILE_IO ()]
51 close : Eff () [FILE_IO (OpenFile m)] [FILE_IO ()]
52
52
53− readLine : Eff String [FILE_IO (OpenFile Read)]
53+ readLine : Eff String [FILE_IO (OpenFile Read)]
54 writeLine : String -> Eff () [FILE_IO (OpenFile Write)]
54 writeLine : String -> Eff () [FILE_IO (OpenFile Write)]
55− eof : Eff Bool [FILE_IO (OpenFile Read)]
55+ eof : Eff Bool [FILE_IO (OpenFile Read)]
56
56
57 Handler FileIO IO where { ... }
57 Handler FileIO IO where { ... }
58
58
@@ -69,9 +69,9 @@ RND
69
69
70 RND : EFFECT
70 RND : EFFECT
71
71
72− srand : Integer -> Eff m () [RND]
72+ srand : Integer -> Eff () [RND]
73− rndInt : Integer -> Integer -> Eff m Integer [RND]
73+ rndInt : Integer -> Integer -> Eff Integer [RND]
74− rndFin : (k : Nat) -> Eff m (Fin (S k)) [RND]
74+ rndFin : (k : Nat) -> Eff (Fin (S k)) [RND]
75
75
76 Handler Random m where { ... }
76 Handler Random m where { ... }
77
77
@@ -86,7 +86,7 @@ SELECT
86
86
87 SELECT : EFFECT
87 SELECT : EFFECT
88
88
89− select : List a -> Eff m a [SELECT]
89+ select : List a -> Eff a [SELECT]
90
90
91 Handler Selection Maybe where { ... }
91 Handler Selection Maybe where { ... }
92 Handler Selection List where { ... }
92 Handler Selection List where { ... }
@@ -102,10 +102,10 @@ STATE
102
102
103 STATE : Type -> EFFECT
103 STATE : Type -> EFFECT
104
104
105− get : Eff m x [STATE x]
105+ get : Eff x [STATE x]
106− put : x -> Eff m () [STATE x]
106+ put : x -> Eff () [STATE x]
107− putM : y -> Eff m () [STATE x] [STATE y]
107+ putM : y -> Eff () [STATE x] [STATE y]
108− update : (x -> x) -> Eff m () [STATE x]
108+ update : (x -> x) -> Eff () [STATE x]
109
109
110 Handler State m where { ... }
110 Handler State m where { ... }
111
111
@@ -121,12 +121,12 @@ STDIO
121
121
122 STDIO : EFFECT
122 STDIO : EFFECT
123
123
124− putChar : Handler StdIO m => Char -> Eff m () [STDIO]
124+ putChar : Char -> Eff () [STDIO]
125− putStr : Handler StdIO m => String -> Eff m () [STDIO]
125+ putStr : String -> Eff () [STDIO]
126− putStrLn : Handler StdIO m => String -> Eff m () [STDIO]
126+ putStrLn : String -> Eff () [STDIO]
127
127
128− getStr : Handler StdIO m => Eff m String [STDIO]
128+ getStr : Eff String [STDIO]
129− getChar : Handler StdIO m => Eff m Char [STDIO]
129+ getChar : Eff Char [STDIO]
130
130
131 Handler StdIO IO where { ... }
131 Handler StdIO IO where { ... }
132 Handler StdIO (IOExcept a) where { ... }
132 Handler StdIO (IOExcept a) where { ... }
@@ -144,9 +144,9 @@ SYSTEM
144
144
145 SYSTEM : EFFECT
145 SYSTEM : EFFECT
146
146
147− getArgs : Handler System e => Eff e (List String) [SYSTEM]
147+ getArgs : Eff (List String) [SYSTEM]
148− time : Handler System e => Eff e Int [SYSTEM]
148+ time : Eff Int [SYSTEM]
149− getEnv : Handler System e => String -> Eff e (Maybe String) [SYSTEM]
149+ getEnv : String -> Eff (Maybe String) [SYSTEM]
150
150
151 Handler System IO where { ... }
151 Handler System IO where { ... }
152 Handler System (IOExcept a) where { ... }
152 Handler System (IOExcept a) where { ... }
docs/proofs/elabReflection.rst → docs/elaboratorReflection/elabReflection.rstrenamed

The content is the same.

docs/reference/elaborator-reflection.rst → docs/elaboratorReflection/elaborator-reflection.rstrenamed+11−5
@@ -1,8 +1,8 @@
1.. _elaborator-reflection:
1.. _elaborator-reflection:
2
2
3−*********************
3+**********************************
4−Elaborator Reflection
4+Elaborator Reflection Introduction
5−*********************
5+**********************************
6
6
7The Idris elaborator is responsible for converting high-level Idris code into the core language.
7The Idris elaborator is responsible for converting high-level Idris code into the core language.
8It is implemented as a kind of embedded tactic language in Haskell, where tactic scripts are written in an *elaboration monad* that provides error handling and a proof state.
8It is implemented as a kind of embedded tactic language in Haskell, where tactic scripts are written in an *elaboration monad* that provides error handling and a proof state.
@@ -198,6 +198,12 @@ This is primarily useful for code generation, particularly for generating patter
198
198
199Learn More
199Learn More
200==========
200==========
201−While this documentation is still incomplete, elaboration reflection works in Idris today.
201+
202+Some tactics are introduced in the :ref:`proofs-index` section with further details, of those most relevant to elaborator reflection, on the following pages.
203+
202−As you wait for the completion of the documentation, the list of built-in tactics can be obtained using the ``:browse`` command in an Idris REPL or the corresponding feature in one of the graphical IDE clients to explore the ``Language.Reflection.Elab.Tactics`` namespace.
204+The list of built-in tactics can be obtained using the ``:browse`` command in an Idris REPL or the corresponding feature in one of the graphical IDE clients to explore the ``Language.Reflection.Elab.Tactics`` namespace.
203All of the built-in tactics contain documentation strings.
205All of the built-in tactics contain documentation strings.
206+
207+For alternative ways to extend the Idris language see the :ref:`reference-index` section.
208+
209+The following pages explain more about the theory and practice of elaborator reflection.
docs/proofs/example1.rst → docs/elaboratorReflection/example1.rstrenamed+47−94
@@ -48,28 +48,20 @@ The following is a walkthough looking at the state after each tactic:
48 * - The term is:
48 * - The term is:
49 - ?{hole_0} ≈ ? {hole_2} . {hole_2} . {hole_0}
49 - ?{hole_0} ≈ ? {hole_2} . {hole_2} . {hole_0}
50
50
51− * - It is possible to read the state from the script by calling getEnv, getGoal and getHoles. To show the results I hacked this: `my code`_.
51+ * - It is possible to read the state from the script by calling getEnv, getGoal and getHoles.
52
52
53+ - The output of these calls contain structures with TT code. To show the results I hacked this: `my code`_. TT code is not really designed to be readable by humans, all the names are fully expanded, everything has a type down to universes (type of types). This is shown here to illustrate the information available.
54+
53− - .. code-block:: idris
55+ .. code-block:: idris
54
56
55 getEnv=[]
57 getEnv=[]
56
58
57− getGoal=({hole_2}, {TT:Bind
59+ getGoal=(hole_2, __pi_arg:(Nat.["Nat", "Prelude"]:{
58− name=`{{__pi_arg}}
60+ type constructor tag=8 number=0}.Type:U=(20:./Prelude/Nat.idr)->.
59− binder={
60− Π ({`{{Nat}}.["Nat", "Prelude"]}:{type const tag=8,0}).{
61− TT:TType tt=ext=./Prelude/Nat.idr#20
62− }
63− }
64− tt={
65− TT:Parameter name ref
66− NameType={type const tag=8,0}
67− TTName={`{{Nat}}.["Nat","Prelude"]}
61+ {name ref{type constructor tag=8 number=0}Nat.["Nat","Prelude"]:
68− TT={TT:TType
69− tt=ext=./Prelude/Nat.idr#20
62+ Type:U=(20:./Prelude/Nat.idr)
70− }
63+ })
71− }
72− })
64+ })
73
65
74 getHoles=[{hole_2},{hole_0}]
66 getHoles=[{hole_2},{hole_0}]
75
67
@@ -96,24 +88,14 @@ The following is a walkthough looking at the state after each tactic:
96
88
97 - .. code-block:: idris
89 - .. code-block:: idris
98
90
99− getEnv=[(
100− `{{x}}, {
101− λ ({`{{Nat}}.["Nat", "Prelude"]}:{type const tag=8,0}).
91+ getEnv=[(x, {λ (Nat.["Nat", "Prelude"]:{
102− {TT:TType
92+ type constructor tag=8 number=0}).
103− tt=ext=./Prelude/Nat.idr#20
93+ Type:U=(20:./Prelude/Nat.idr)
104− }
105− }
106− )]
94+ })]
107−
95+
108− getGoal=({hole_2},{
96+ getGoal=(hole_2, {name ref{type constructor tag=8 number=0}
109− TT:Parameter name ref
110− NameType={type const tag=8,0}
111− TTName={`{{Nat}}.["Nat", "Prelude"]}
97+ Nat.["Nat","Prelude"]:Type:U=(20:./Prelude/Nat.idr)
112− TT={TT:TType
113− tt=ext=./Prelude/Nat.idr#20
114− }
98+ })
115− }
116− )
117
99
118 getHoles=[{hole_2},{hole_0}]
100 getHoles=[{hole_2},{hole_0}]
119
101
@@ -140,38 +122,24 @@ The following is a walkthough looking at the state after each tactic:
140
122
141 - .. code-block:: idris
123 - .. code-block:: idris
142
124
143− getEnv=[(`{{x}}, {λ ({`{{Nat}}.["Nat", "Prelude"]}:
125+ getEnv=[(x, {λ (Nat.["Nat", "Prelude"]:
144− {type const tag=8,0}).
126+ {type constructor tag=8 number=0}).
145− {TT:TType
146− tt=ext=./Prelude/Nat.idr#20
127+ Type:U=(20:./Prelude/Nat.idr)
147− }
148− }
149− )]
128+ })]
150−
129+
151− getGoal=({hole_2},
130+ getGoal=(hole_2, {name ref{type constructor tag=8 number=0}
152− {TT:Parameter name ref
153− NameType={type const tag=8,0}
154− TTName={`{{Nat}}.["Nat", "Prelude"]}
131+ Nat.["Nat","Prelude"]:Type:U=(20:./Prelude/Nat.idr)
155− TT={TT:TType
156− tt=ext=./Prelude/Nat.idr#20
157− }
158− })
132+ })
159
133
160 getHoles=[{hole_2}, {hole_0}]
134 getHoles=[{hole_2}, {hole_0}]
161
135
162 * - getGuess
136 * - getGuess
163 - .. code-block:: idris
137 - .. code-block:: idris
164
138
165− {TT:Parameter name ref
139+ {name ref bound x:
166− NameType=NameType just bound by intro
140+ {name ref{type constructor tag=8 number=0}
167− TTName=`{{x}}
168− TT={TT:Parameter name ref
169− NameType={type const tag=8,0}
170− TTName={`{{Nat}}.["Nat", "Prelude"]}
141+ Nat.["Nat","Prelude"]:Type:U=(20:./Prelude/Nat.idr)
171− TT={TT:TType
172− tt=ext=./Prelude/Nat.idr#20
173− }
174− }
142+ }
175 }
143 }
176
144
177 * - Substitute a guess into a hole.
145 * - Substitute a guess into a hole.
@@ -195,45 +163,30 @@ The following is a walkthough looking at the state after each tactic:
195
163
196 getEnv=[]
164 getEnv=[]
197
165
198− getGoal=({hole_0}, {TT:Bind
199− name=`{{__pi_arg}}
200− binder={
201− Π ({`{{Nat}}.["Nat", "Prelude"]}:
166+ getGoal=(hole_0, __pi_arg:(Nat.["Nat", "Prelude"]:{
202− {type const tag=8,0}).{TT:TType
167+ type constructor tag=8 number=0}.
203− tt=ext=./Prelude/Nat.idr#20
168+ Type:U=(20:./Prelude/Nat.idr)
204− }
205− }
206− tt={TT:Parameter name ref
169+ ->.{name ref
207− NameType={type const tag=8,0}
170+ {type constructor tag=8 number=0}
208− TTName={`{{Nat}}.["Nat","Prelude"]}
171+ Nat.["Nat","Prelude"]:Type:U=(20:./Prelude/Nat.idr)
209− TT={TT:TType tt=ext=./Prelude/Nat.idr#20}
210− }
172+ })
211− })
173+ })
212
174
213 getHoles=[{hole_0}]
175 getHoles=[{hole_0}]
214
176
215 * - getGuess
177 * - getGuess
216 - .. code-block:: idris
178 - .. code-block:: idris
217
179
218− {TT:Bind
219− name=`{{x}}
220− binder={λ ({`{{Nat}}.["Nat","Prelude"]}:{type const tag=8,0}).{
180+ x:({λ (Nat.["Nat", "Prelude"]:{
221− TT:TType
181+ type constructor tag=8 number=0}).
182+ Type:U=(20:./Prelude/Nat.idr)
183+ }.{
184+ name ref bound
185+ x:{name ref {type constructor tag=8 number=0}
222− tt=ext=./Prelude/Nat.idr#20
186+ Nat.["Nat","Prelude"]:Type:U=(20:./Prelude/Nat.idr)
187+ }
223− }
188+ })
224 }
189 }
225− tt={TT:Parameter name ref
226− NameType=NameType just bound by intro
227− TTName=`{{x}}
228− TT={TT:Parameter name ref
229− NameType={type const tag=8,0}
230− TTName={`{{Nat}}.["Nat", "Prelude"]}
231− TT={TT:TType
232− tt=ext=./Prelude/Nat.idr#20
233− }
234− }
235− }
236− }
237
190
238.. target-notes::
191.. target-notes::
239.. _`my code`: https://github.com/martinbaker/Idris-dev/blob/uglyTTPrinter/libs/prelude/Language/Reflection/TTPrinter.idr
192.. _`my code`: https://github.com/martinbaker/Idris-dev/blob/uglyTTPrinter/libs/prelude/Language/Reflection/TTPrinter.idr
docs/proofs/generatingData.rst → docs/elaboratorReflection/generatingData.rstrenamed

The content is the same.

docs/proofs/holes.rst → docs/elaboratorReflection/holes.rstrenamed

The content is the same.

docs/elaboratorReflection/index.rstnew file+27
@@ -0,0 +1,27 @@
1+.. _elaborator-index:
2+
3+#####################
4+Elaborator Reflection
5+#####################
6+
7+A tutorial on theorem proving in Idris.
8+
9+.. note::
10+
11+ The documentation for Idris has been published under the Creative
12+ Commons CC0 License. As such to the extent possible under law, *The
13+ Idris Community* has waived all copyright and related or neighboring
14+ rights to Documentation for Idris.
15+
16+ More information concerning the CC0 can be found online at: http://creativecommons.org/publicdomain/zero/1.0/
17+
18+.. toctree::
19+ :maxdepth: 1
20+
21+ elaborator-reflection
22+ elabReflection
23+ tactics
24+ holes
25+ example1
26+ primitive
27+ generatingData
docs/proofs/primitive.rst → docs/elaboratorReflection/primitive.rstrenamed+41−2
@@ -21,15 +21,39 @@ Primitive Operators
21 * - solve
21 * - solve
22 - Substitute a guess into a hole.
22 - Substitute a guess into a hole.
23
23
24+
25+ .. image:: ../image/solve.png
26+ :width: 141px
27+ :height: 74px
28+ :alt: diagram illustrating solve tactic
29+
30+
24 Substitute the focused guess throughout its scope, eliminating it and moving focus to the next element of the hole queue. Fail if the focus is not a guess.
31 Substitute the focused guess throughout its scope, eliminating it and moving focus to the next element of the hole queue. Fail if the focus is not a guess.
25
32
26 Signature:
33 Signature:
27
34
28 solve : Elab ()
35 solve : Elab ()
29
36
37+ Example:
38+
39+ .. code-block:: idris
40+
41+ %language ElabReflection
42+
43+ testFn : Nat
44+ testFn = %runElab (do fill `(Z)
45+ solve)
46+
30 * - fill
47 * - fill
31 - Place a term into a hole, unifying its type. Fails if the focus is not a hole.
48 - Place a term into a hole, unifying its type. Fails if the focus is not a hole.
32
49
50+
51+ .. image:: ../image/fill.png
52+ :width: 140px
53+ :height: 74px
54+ :alt: diagram illustrating fill tactic
55+
56+
33 Signature:
57 Signature:
34
58
35 fill : (e : Raw) -> Elab ()
59 fill : (e : Raw) -> Elab ()
@@ -46,6 +70,16 @@ Primitive Operators
46
70
47 This unification can result in the solution of further holes or the establishment of additional unsolved unification constraints.
71 This unification can result in the solution of further holes or the establishment of additional unsolved unification constraints.
48
72
73+ Example:
74+
75+ .. code-block:: idris
76+
77+ %language ElabReflection
78+
79+ testFn : Nat
80+ testFn = %runElab (do fill `(Z)
81+ solve)
82+
49 * - apply
83 * - apply
50 - Attempt to apply an operator to fill the current hole, potentially solving arguments by unification.
84 - Attempt to apply an operator to fill the current hole, potentially solving arguments by unification.
51
85
@@ -110,9 +144,14 @@ Primitive Operators
110 unfocus : TTName -> Elab ()
144 unfocus : TTName -> Elab ()
111
145
112 * - attack
146 * - attack
113− - Convert a hole to make it suitable for bindings - that is, transform it such that it has the form
147+ - Convert a hole to make it suitable for bindings.
148+
149+
150+ .. image:: ../image/attack.png
151+ :width: 152px
152+ :height: 70px
153+ :alt: diagram illustrating attack tactic
114
154
115− `?h : t . h` as opposed to `?h : t . f h`.
116
155
117 The binding tactics require that a hole be directly under its binding, or else the scopes of the generated terms won't make sense. This tactic creates a new hole of the proper form, and points the old hole at it.
156 The binding tactics require that a hole be directly under its binding, or else the scopes of the generated terms won't make sense. This tactic creates a new hole of the proper form, and points the old hole at it.
118
157
docs/proofs/tactics.rst → docs/elaboratorReflection/tactics.rstrenamed

The content is the same.

docs/faq/faq.rst+2−2
@@ -37,7 +37,7 @@ Is there some documentation for the standard lib? List of functions?
37=====================================================================
37=====================================================================
38
38
39API documentation for the shipped packages is listed on `the
39API documentation for the shipped packages is listed on `the
40−documentation page <http://www.idris-lang.org/documentation/>`_.
40+documentation page <https://www.idris-lang.org/documentation/>`_.
41
41
42Unfortunately, the default prelude and shipped packages for `Idris`
42Unfortunately, the default prelude and shipped packages for `Idris`
43are not necessarily complete with regards to documentation. Other
43are not necessarily complete with regards to documentation. Other
@@ -310,7 +310,7 @@ better and it will make sense to revisit this. For now, however, Idris will not
310be offering arbitrary Unicode symbols in operators.
310be offering arbitrary Unicode symbols in operators.
311
311
312This seems like an instance of `Wadler's
312This seems like an instance of `Wadler's
313−Law <http://www.haskell.org/haskellwiki/Wadler%27s_Law>`__ in action.
313+Law <https://www.haskell.org/haskellwiki/Wadler%27s_Law>`__ in action.
314
314
315This answer is based on Edwin Brady's response in the following
315This answer is based on Edwin Brady's response in the following
316`pull request <https://github.com/idris-lang/Idris-dev/pull/694#issuecomment-29559291>`_.
316`pull request <https://github.com/idris-lang/Idris-dev/pull/694#issuecomment-29559291>`_.
docs/guides/index.rst+1−1
@@ -12,7 +12,7 @@ Tutorials submitted by community members.
12 Idris Community* has waived all copyright and related or neighboring
12 Idris Community* has waived all copyright and related or neighboring
13 rights to Documentation for Idris.
13 rights to Documentation for Idris.
14
14
15− More information concerning the CC0 can be found online at: http://creativecommons.org/publicdomain/zero/1.0/
15+ More information concerning the CC0 can be found online at: https://creativecommons.org/publicdomain/zero/1.0/
16
16
17
17
18.. toctree::
18.. toctree::
docs/guides/theorem-prover.rst+1−1
@@ -22,7 +22,7 @@ We will be given the following prompt, in future releases the version string wil
22 ____ __ _
22 ____ __ _
23 / _/___/ /____(_)____
23 / _/___/ /____(_)____
24 / // __ / ___/ / ___/ Version 0.9.18.1
24 / // __ / ___/ / ___/ Version 0.9.18.1
25− _/ // /_/ / / / (__ ) http://www.idris-lang.org/
25+ _/ // /_/ / / / (__ ) https://www.idris-lang.org/
26 /___/\__,_/_/ /_/____/ Type :? for help
26 /___/\__,_/_/ /_/____/ Type :? for help
27
27
28 Idris is free software with ABSOLUTELY NO WARRANTY.
28 Idris is free software with ABSOLUTELY NO WARRANTY.
docs/guides/type-providers-ffi.rst+1−1
@@ -3,7 +3,7 @@ Type Providers in Idris
3***********************
3***********************
4
4
5`Type providers in Idris
5`Type providers in Idris
6−<http://www.davidchristiansen.dk/pubs/dependent-type-providers.pdf>`__
6+<https://www.davidchristiansen.dk/pubs/dependent-type-providers.pdf>`__
7are simple enough, but there are a few caveats to using them that it
7are simple enough, but there are a few caveats to using them that it
8would be worthwhile to go through the basic steps. We also go over
8would be worthwhile to go through the basic steps. We also go over
9foreign functions, because these will often be used with type
9foreign functions, because these will often be used with type
docs/image/attack.pngnew file

Binary file not shown.

docs/image/attack.svgnew file+199
@@ -0,0 +1,199 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3+
4+<svg
5+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6+ xmlns:cc="http://creativecommons.org/ns#"
7+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8+ xmlns:svg="http://www.w3.org/2000/svg"
9+ xmlns="http://www.w3.org/2000/svg"
10+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12+ width="210mm"
13+ height="297mm"
14+ viewBox="0 0 210 297"
15+ version="1.1"
16+ id="svg8"
17+ inkscape:version="0.92.2 5c3e80d, 2017-08-06"
18+ sodipodi:docname="attack.svg">
19+ <defs
20+ id="defs2">
21+ <marker
22+ inkscape:stockid="Arrow1Mend"
23+ orient="auto"
24+ refY="0.0"
25+ refX="0.0"
26+ id="marker890"
27+ style="overflow:visible;"
28+ inkscape:isstock="true">
29+ <path
30+ id="path888"
31+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
32+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
33+ transform="scale(0.4) rotate(180) translate(10,0)" />
34+ </marker>
35+ <marker
36+ inkscape:isstock="true"
37+ style="overflow:visible;"
38+ id="marker838"
39+ refX="0.0"
40+ refY="0.0"
41+ orient="auto"
42+ inkscape:stockid="Arrow1Mend"
43+ inkscape:collect="always">
44+ <path
45+ transform="scale(0.4) rotate(180) translate(10,0)"
46+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
47+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
48+ id="path836" />
49+ </marker>
50+ <marker
51+ inkscape:stockid="Arrow1Mend"
52+ orient="auto"
53+ refY="0.0"
54+ refX="0.0"
55+ id="Arrow1Mend"
56+ style="overflow:visible;"
57+ inkscape:isstock="true"
58+ inkscape:collect="always">
59+ <path
60+ id="path4529"
61+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
62+ style="fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1;fill:#ff0000;fill-opacity:1"
63+ transform="scale(0.4) rotate(180) translate(10,0)" />
64+ </marker>
65+ </defs>
66+ <sodipodi:namedview
67+ id="base"
68+ pagecolor="#ffffff"
69+ bordercolor="#666666"
70+ borderopacity="1.0"
71+ inkscape:pageopacity="0.0"
72+ inkscape:pageshadow="2"
73+ inkscape:zoom="1"
74+ inkscape:cx="313.5"
75+ inkscape:cy="696.5"
76+ inkscape:document-units="mm"
77+ inkscape:current-layer="layer1"
78+ showgrid="false"
79+ inkscape:window-width="1920"
80+ inkscape:window-height="1015"
81+ inkscape:window-x="0"
82+ inkscape:window-y="0"
83+ inkscape:window-maximized="1" />
84+ <metadata
85+ id="metadata5">
86+ <rdf:RDF>
87+ <cc:Work
88+ rdf:about="">
89+ <dc:format>image/svg+xml</dc:format>
90+ <dc:type
91+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
92+ <dc:title />
93+ </cc:Work>
94+ </rdf:RDF>
95+ </metadata>
96+ <g
97+ inkscape:label="Layer 1"
98+ inkscape:groupmode="layer"
99+ id="layer1">
100+ <rect
101+ style="fill:#ffff00;fill-opacity:1;stroke-width:0.26458332"
102+ id="rect22"
103+ width="28.839582"
104+ height="6.0854182"
105+ x="66.67498"
106+ y="114.4375"
107+ inkscape:export-xdpi="61.120499"
108+ inkscape:export-ydpi="61.120499" />
109+ <text
110+ xml:space="preserve"
111+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
112+ x="65.352081"
113+ y="105.17709"
114+ id="text12"
115+ inkscape:export-xdpi="61.120499"
116+ inkscape:export-ydpi="61.120499"><tspan
117+ sodipodi:role="line"
118+ x="65.352081"
119+ y="105.17709"
120+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
121+ id="tspan847">?h ∶ t1→t2 . f h</tspan></text>
122+ <text
123+ id="text16"
124+ y="118.67083"
125+ x="56.356247"
126+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
127+ xml:space="preserve"
128+ inkscape:export-xdpi="61.120499"
129+ inkscape:export-ydpi="61.120499"><tspan
130+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
131+ y="118.67083"
132+ x="56.356247"
133+ id="tspan14"
134+ sodipodi:role="line">?h ≈ (?h' ∶ t1→t2 . h')∶ t1→t2 . f h</tspan></text>
135+ <text
136+ id="text20"
137+ y="110.99791"
138+ x="82.814583"
139+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
140+ xml:space="preserve"
141+ inkscape:export-xdpi="61.120499"
142+ inkscape:export-ydpi="61.120499"><tspan
143+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
144+ y="110.99791"
145+ x="82.814583"
146+ id="tspan18"
147+ sodipodi:role="line">attack</tspan></text>
148+ <path
149+ style="fill:none;stroke:#ff0000;stroke-width:0.5291667;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Mend)"
150+ d="m 80.668481,106.30075 -0.0032,7.57492"
151+ id="path4518"
152+ inkscape:connector-curvature="0"
153+ sodipodi:nodetypes="cc"
154+ inkscape:export-xdpi="61.120499"
155+ inkscape:export-ydpi="61.120499" />
156+ <text
157+ inkscape:export-ydpi="61.120499"
158+ inkscape:export-xdpi="61.120499"
159+ xml:space="preserve"
160+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
161+ x="63.235413"
162+ y="94.85833"
163+ id="text832"><tspan
164+ sodipodi:role="line"
165+ id="tspan830"
166+ x="63.235413"
167+ y="94.85833"
168+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332">focus</tspan></text>
169+ <path
170+ inkscape:export-ydpi="61.120499"
171+ inkscape:export-xdpi="61.120499"
172+ sodipodi:nodetypes="cc"
173+ inkscape:connector-curvature="0"
174+ id="path834"
175+ d="m 66.645564,94.659084 -0.0032,5.458256"
176+ style="fill:none;stroke:#0000ff;stroke-width:0.5291667;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker838)" />
177+ <text
178+ id="text884"
179+ y="110.23682"
180+ x="61.94511"
181+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
182+ xml:space="preserve"
183+ inkscape:export-xdpi="61.120499"
184+ inkscape:export-ydpi="61.120499"><tspan
185+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332"
186+ y="110.23682"
187+ x="61.94511"
188+ id="tspan882"
189+ sodipodi:role="line">focus</tspan></text>
190+ <path
191+ style="fill:none;stroke:#0000ff;stroke-width:0.5291667;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker890)"
192+ d="m 66.67818,108.97924 -0.0032,5.45826"
193+ id="path886"
194+ inkscape:connector-curvature="0"
195+ sodipodi:nodetypes="cc"
196+ inkscape:export-xdpi="61.120499"
197+ inkscape:export-ydpi="61.120499" />
198+ </g>
199+</svg>
docs/image/fill.pngnew file

Binary file not shown.

docs/image/fill.svgnew file+163
@@ -0,0 +1,163 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3+
4+<svg
5+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6+ xmlns:cc="http://creativecommons.org/ns#"
7+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8+ xmlns:svg="http://www.w3.org/2000/svg"
9+ xmlns="http://www.w3.org/2000/svg"
10+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12+ width="210mm"
13+ height="297mm"
14+ viewBox="0 0 210 297"
15+ version="1.1"
16+ id="svg8"
17+ inkscape:version="0.92.2 5c3e80d, 2017-08-06"
18+ sodipodi:docname="fill.svg">
19+ <defs
20+ id="defs2">
21+ <marker
22+ inkscape:isstock="true"
23+ style="overflow:visible;"
24+ id="marker838"
25+ refX="0.0"
26+ refY="0.0"
27+ orient="auto"
28+ inkscape:stockid="Arrow1Mend">
29+ <path
30+ transform="scale(0.4) rotate(180) translate(10,0)"
31+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
32+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
33+ id="path836" />
34+ </marker>
35+ <marker
36+ inkscape:stockid="Arrow1Mend"
37+ orient="auto"
38+ refY="0.0"
39+ refX="0.0"
40+ id="Arrow1Mend"
41+ style="overflow:visible;"
42+ inkscape:isstock="true"
43+ inkscape:collect="always">
44+ <path
45+ id="path4529"
46+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
47+ style="fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1;fill:#ff0000;fill-opacity:1"
48+ transform="scale(0.4) rotate(180) translate(10,0)" />
49+ </marker>
50+ </defs>
51+ <sodipodi:namedview
52+ id="base"
53+ pagecolor="#ffffff"
54+ bordercolor="#666666"
55+ borderopacity="1.0"
56+ inkscape:pageopacity="0.0"
57+ inkscape:pageshadow="2"
58+ inkscape:zoom="1"
59+ inkscape:cx="313.5"
60+ inkscape:cy="696.5"
61+ inkscape:document-units="mm"
62+ inkscape:current-layer="layer1"
63+ showgrid="false"
64+ inkscape:window-width="1920"
65+ inkscape:window-height="1015"
66+ inkscape:window-x="0"
67+ inkscape:window-y="0"
68+ inkscape:window-maximized="1" />
69+ <metadata
70+ id="metadata5">
71+ <rdf:RDF>
72+ <cc:Work
73+ rdf:about="">
74+ <dc:format>image/svg+xml</dc:format>
75+ <dc:type
76+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
77+ <dc:title />
78+ </cc:Work>
79+ </rdf:RDF>
80+ </metadata>
81+ <g
82+ inkscape:label="Layer 1"
83+ inkscape:groupmode="layer"
84+ id="layer1">
85+ <rect
86+ style="fill:#ffff00;fill-opacity:1;stroke-width:0.26458332"
87+ id="rect22"
88+ width="31.75"
89+ height="5.5562501"
90+ x="70.114571"
91+ y="114.96667"
92+ inkscape:export-xdpi="61.120499"
93+ inkscape:export-ydpi="61.120499" />
94+ <text
95+ xml:space="preserve"
96+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
97+ x="65.352081"
98+ y="105.17709"
99+ id="text12"
100+ inkscape:export-xdpi="61.120499"
101+ inkscape:export-ydpi="61.120499"><tspan
102+ sodipodi:role="line"
103+ id="tspan10"
104+ x="65.352081"
105+ y="105.17709"
106+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332">? {hole} . {hole}</tspan></text>
107+ <text
108+ id="text16"
109+ y="118.67083"
110+ x="56.356247"
111+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
112+ xml:space="preserve"
113+ inkscape:export-xdpi="61.120499"
114+ inkscape:export-ydpi="61.120499"><tspan
115+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
116+ y="118.67083"
117+ x="56.356247"
118+ id="tspan14"
119+ sodipodi:role="line">?{hole} ≈ Prelude.Nat.Z . {hole}</tspan></text>
120+ <text
121+ id="text20"
122+ y="110.99791"
123+ x="82.814583"
124+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
125+ xml:space="preserve"
126+ inkscape:export-xdpi="61.120499"
127+ inkscape:export-ydpi="61.120499"><tspan
128+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
129+ y="110.99791"
130+ x="82.814583"
131+ id="tspan18"
132+ sodipodi:role="line">fill `(Z)</tspan></text>
133+ <path
134+ style="fill:none;stroke:#ff0000;stroke-width:0.5291667;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Mend)"
135+ d="m 80.668481,106.30075 -0.0032,7.57492"
136+ id="path4518"
137+ inkscape:connector-curvature="0"
138+ sodipodi:nodetypes="cc"
139+ inkscape:export-xdpi="61.120499"
140+ inkscape:export-ydpi="61.120499" />
141+ <text
142+ inkscape:export-ydpi="61.120499"
143+ inkscape:export-xdpi="61.120499"
144+ xml:space="preserve"
145+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
146+ x="63.499996"
147+ y="93.006248"
148+ id="text832"><tspan
149+ sodipodi:role="line"
150+ id="tspan830"
151+ x="63.499996"
152+ y="93.006248"
153+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332">focus</tspan></text>
154+ <path
155+ inkscape:export-ydpi="61.120499"
156+ inkscape:export-xdpi="61.120499"
157+ sodipodi:nodetypes="cc"
158+ inkscape:connector-curvature="0"
159+ id="path834"
160+ d="m 66.645564,94.659084 -0.0032,5.458256"
161+ style="fill:none;stroke:#0000ff;stroke-width:0.5291667;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker838)" />
162+ </g>
163+</svg>
docs/image/parserModules.pngnew file

Binary file not shown.

docs/image/parserModules.svgnew file+1251
@@ -0,0 +1,1251 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3+
4+<svg
5+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6+ xmlns:cc="http://creativecommons.org/ns#"
7+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8+ xmlns:svg="http://www.w3.org/2000/svg"
9+ xmlns="http://www.w3.org/2000/svg"
10+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12+ width="210mm"
13+ height="297mm"
14+ viewBox="0 0 210 297"
15+ version="1.1"
16+ id="svg8"
17+ inkscape:version="0.92.2 5c3e80d, 2017-08-06"
18+ sodipodi:docname="parserModules.svg">
19+ <defs
20+ id="defs2">
21+ <marker
22+ inkscape:isstock="true"
23+ style="overflow:visible;"
24+ id="marker1078"
25+ refX="0.0"
26+ refY="0.0"
27+ orient="auto"
28+ inkscape:stockid="Arrow1Mend">
29+ <path
30+ transform="scale(0.4) rotate(180) translate(10,0)"
31+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
32+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
33+ id="path1076" />
34+ </marker>
35+ <marker
36+ inkscape:isstock="true"
37+ style="overflow:visible"
38+ id="marker1074"
39+ refX="0.0"
40+ refY="0.0"
41+ orient="auto"
42+ inkscape:stockid="Arrow1Mstart">
43+ <path
44+ transform="scale(0.4) translate(10,0)"
45+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
46+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
47+ id="path1072" />
48+ </marker>
49+ <marker
50+ inkscape:stockid="Arrow1Mend"
51+ orient="auto"
52+ refY="0.0"
53+ refX="0.0"
54+ id="marker1021"
55+ style="overflow:visible;"
56+ inkscape:isstock="true"
57+ inkscape:collect="always">
58+ <path
59+ id="path1019"
60+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
61+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
62+ transform="scale(0.4) rotate(180) translate(10,0)" />
63+ </marker>
64+ <marker
65+ inkscape:stockid="Arrow1Mstart"
66+ orient="auto"
67+ refY="0.0"
68+ refX="0.0"
69+ id="marker1017"
70+ style="overflow:visible"
71+ inkscape:isstock="true"
72+ inkscape:collect="always">
73+ <path
74+ id="path1015"
75+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
76+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
77+ transform="scale(0.4) translate(10,0)" />
78+ </marker>
79+ <marker
80+ inkscape:isstock="true"
81+ style="overflow:visible;"
82+ id="marker973"
83+ refX="0.0"
84+ refY="0.0"
85+ orient="auto"
86+ inkscape:stockid="Arrow1Mend"
87+ inkscape:collect="always">
88+ <path
89+ transform="scale(0.4) rotate(180) translate(10,0)"
90+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
91+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
92+ id="path971" />
93+ </marker>
94+ <marker
95+ inkscape:isstock="true"
96+ style="overflow:visible"
97+ id="marker969"
98+ refX="0.0"
99+ refY="0.0"
100+ orient="auto"
101+ inkscape:stockid="Arrow1Mstart"
102+ inkscape:collect="always">
103+ <path
104+ transform="scale(0.4) translate(10,0)"
105+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
106+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
107+ id="path967" />
108+ </marker>
109+ <marker
110+ inkscape:stockid="Arrow1Mend"
111+ orient="auto"
112+ refY="0.0"
113+ refX="0.0"
114+ id="Arrow1Mend"
115+ style="overflow:visible;"
116+ inkscape:isstock="true"
117+ inkscape:collect="always">
118+ <path
119+ id="path1214"
120+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
121+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
122+ transform="scale(0.4) rotate(180) translate(10,0)" />
123+ </marker>
124+ <marker
125+ inkscape:stockid="Arrow1Mstart"
126+ orient="auto"
127+ refY="0.0"
128+ refX="0.0"
129+ id="Arrow1Mstart"
130+ style="overflow:visible"
131+ inkscape:isstock="true"
132+ inkscape:collect="always">
133+ <path
134+ id="path1211"
135+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
136+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
137+ transform="scale(0.4) translate(10,0)" />
138+ </marker>
139+ <marker
140+ inkscape:isstock="true"
141+ style="overflow:visible;"
142+ id="marker1000"
143+ refX="0.0"
144+ refY="0.0"
145+ orient="auto"
146+ inkscape:stockid="Arrow1Mend">
147+ <path
148+ transform="scale(0.4) rotate(180) translate(10,0)"
149+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
150+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
151+ id="path998" />
152+ </marker>
153+ <marker
154+ inkscape:isstock="true"
155+ style="overflow:visible;"
156+ id="marker1127"
157+ refX="0.0"
158+ refY="0.0"
159+ orient="auto"
160+ inkscape:stockid="Arrow1Mend">
161+ <path
162+ transform="scale(0.4) rotate(180) translate(10,0)"
163+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
164+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
165+ id="path1125" />
166+ </marker>
167+ <marker
168+ inkscape:isstock="true"
169+ style="overflow:visible;"
170+ id="marker1123"
171+ refX="0.0"
172+ refY="0.0"
173+ orient="auto"
174+ inkscape:stockid="Arrow1Mend">
175+ <path
176+ transform="scale(0.4) rotate(180) translate(10,0)"
177+ style="fill-rule:evenodd;stroke:#00aa3f;stroke-width:1pt;stroke-opacity:1;fill:#00aa3f;fill-opacity:1"
178+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
179+ id="path1121" />
180+ </marker>
181+ <marker
182+ inkscape:isstock="true"
183+ style="overflow:visible;"
184+ id="marker1117"
185+ refX="0.0"
186+ refY="0.0"
187+ orient="auto"
188+ inkscape:stockid="Arrow1Mend">
189+ <path
190+ transform="scale(0.4) rotate(180) translate(10,0)"
191+ style="fill-rule:evenodd;stroke:#00aa3f;stroke-width:1pt;stroke-opacity:1;fill:#00aa3f;fill-opacity:1"
192+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
193+ id="path1115" />
194+ </marker>
195+ <marker
196+ inkscape:stockid="Arrow1Mend"
197+ orient="auto"
198+ refY="0.0"
199+ refX="0.0"
200+ id="marker1111"
201+ style="overflow:visible;"
202+ inkscape:isstock="true"
203+ inkscape:collect="always">
204+ <path
205+ id="path1109"
206+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
207+ style="fill-rule:evenodd;stroke:#00aa3f;stroke-width:1pt;stroke-opacity:1;fill:#00aa3f;fill-opacity:1"
208+ transform="scale(0.4) rotate(180) translate(10,0)" />
209+ </marker>
210+ <marker
211+ inkscape:isstock="true"
212+ style="overflow:visible;"
213+ id="marker1105"
214+ refX="0.0"
215+ refY="0.0"
216+ orient="auto"
217+ inkscape:stockid="Arrow1Mend"
218+ inkscape:collect="always">
219+ <path
220+ transform="scale(0.4) rotate(180) translate(10,0)"
221+ style="fill-rule:evenodd;stroke:#00aa3f;stroke-width:1pt;stroke-opacity:1;fill:#00aa3f;fill-opacity:1"
222+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
223+ id="path1103" />
224+ </marker>
225+ <marker
226+ inkscape:isstock="true"
227+ style="overflow:visible;"
228+ id="marker1057"
229+ refX="0.0"
230+ refY="0.0"
231+ orient="auto"
232+ inkscape:stockid="Arrow1Mend">
233+ <path
234+ transform="scale(0.4) rotate(180) translate(10,0)"
235+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
236+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
237+ id="path1055" />
238+ </marker>
239+ <marker
240+ inkscape:stockid="Arrow1Mend"
241+ orient="auto"
242+ refY="0.0"
243+ refX="0.0"
244+ id="marker1045"
245+ style="overflow:visible;"
246+ inkscape:isstock="true"
247+ inkscape:collect="always">
248+ <path
249+ id="path1043"
250+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
251+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
252+ transform="scale(0.4) rotate(180) translate(10,0)" />
253+ </marker>
254+ <marker
255+ inkscape:stockid="Arrow1Mend"
256+ orient="auto"
257+ refY="0.0"
258+ refX="0.0"
259+ id="marker1033"
260+ style="overflow:visible;"
261+ inkscape:isstock="true">
262+ <path
263+ id="path1031"
264+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
265+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
266+ transform="scale(0.4) rotate(180) translate(10,0)" />
267+ </marker>
268+ <marker
269+ inkscape:stockid="Arrow1Mend"
270+ orient="auto"
271+ refY="0.0"
272+ refX="0.0"
273+ id="marker1027"
274+ style="overflow:visible;"
275+ inkscape:isstock="true">
276+ <path
277+ id="path1025"
278+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
279+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
280+ transform="scale(0.4) rotate(180) translate(10,0)" />
281+ </marker>
282+ <marker
283+ inkscape:isstock="true"
284+ style="overflow:visible;"
285+ id="marker1015"
286+ refX="0.0"
287+ refY="0.0"
288+ orient="auto"
289+ inkscape:stockid="Arrow1Mend"
290+ inkscape:collect="always">
291+ <path
292+ transform="scale(0.4) rotate(180) translate(10,0)"
293+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
294+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
295+ id="path1013" />
296+ </marker>
297+ <marker
298+ inkscape:isstock="true"
299+ style="overflow:visible;"
300+ id="marker1009"
301+ refX="0.0"
302+ refY="0.0"
303+ orient="auto"
304+ inkscape:stockid="Arrow1Mend">
305+ <path
306+ transform="scale(0.4) rotate(180) translate(10,0)"
307+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
308+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
309+ id="path1007" />
310+ </marker>
311+ <marker
312+ inkscape:isstock="true"
313+ style="overflow:visible;"
314+ id="marker1003"
315+ refX="0.0"
316+ refY="0.0"
317+ orient="auto"
318+ inkscape:stockid="Arrow1Mend">
319+ <path
320+ transform="scale(0.4) rotate(180) translate(10,0)"
321+ style="fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1;fill:#ff0000;fill-opacity:1"
322+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
323+ id="path1001" />
324+ </marker>
325+ <marker
326+ inkscape:stockid="Arrow1Mend"
327+ orient="auto"
328+ refY="0.0"
329+ refX="0.0"
330+ id="marker997"
331+ style="overflow:visible;"
332+ inkscape:isstock="true"
333+ inkscape:collect="always">
334+ <path
335+ id="path995"
336+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
337+ style="fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1;fill:#ff0000;fill-opacity:1"
338+ transform="scale(0.4) rotate(180) translate(10,0)" />
339+ </marker>
340+ <marker
341+ inkscape:isstock="true"
342+ style="overflow:visible;"
343+ id="marker991"
344+ refX="0.0"
345+ refY="0.0"
346+ orient="auto"
347+ inkscape:stockid="Arrow1Mend"
348+ inkscape:collect="always">
349+ <path
350+ transform="scale(0.4) rotate(180) translate(10,0)"
351+ style="fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1;fill:#ff0000;fill-opacity:1"
352+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
353+ id="path989" />
354+ </marker>
355+ <marker
356+ inkscape:stockid="Arrow1Mend"
357+ orient="auto"
358+ refY="0.0"
359+ refX="0.0"
360+ id="marker967"
361+ style="overflow:visible;"
362+ inkscape:isstock="true"
363+ inkscape:collect="always">
364+ <path
365+ id="path965"
366+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
367+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
368+ transform="scale(0.4) rotate(180) translate(10,0)" />
369+ </marker>
370+ <marker
371+ inkscape:isstock="true"
372+ style="overflow:visible;"
373+ id="marker961"
374+ refX="0.0"
375+ refY="0.0"
376+ orient="auto"
377+ inkscape:stockid="Arrow1Mend"
378+ inkscape:collect="always">
379+ <path
380+ transform="scale(0.4) rotate(180) translate(10,0)"
381+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
382+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
383+ id="path959" />
384+ </marker>
385+ <marker
386+ inkscape:isstock="true"
387+ style="overflow:visible;"
388+ id="marker3617"
389+ refX="0.0"
390+ refY="0.0"
391+ orient="auto"
392+ inkscape:stockid="Arrow1Mend">
393+ <path
394+ transform="scale(0.4) rotate(180) translate(10,0)"
395+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
396+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
397+ id="path3615" />
398+ </marker>
399+ <marker
400+ inkscape:stockid="Arrow1Mend"
401+ orient="auto"
402+ refY="0.0"
403+ refX="0.0"
404+ id="marker2049"
405+ style="overflow:visible;"
406+ inkscape:isstock="true"
407+ inkscape:collect="always">
408+ <path
409+ id="path2047"
410+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
411+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
412+ transform="scale(0.4) rotate(180) translate(10,0)" />
413+ </marker>
414+ <marker
415+ inkscape:isstock="true"
416+ style="overflow:visible;"
417+ id="marker1539"
418+ refX="0.0"
419+ refY="0.0"
420+ orient="auto"
421+ inkscape:stockid="Arrow1Mend"
422+ inkscape:collect="always">
423+ <path
424+ transform="scale(0.4) rotate(180) translate(10,0)"
425+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
426+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
427+ id="path1537" />
428+ </marker>
429+ </defs>
430+ <sodipodi:namedview
431+ id="base"
432+ pagecolor="#ffffff"
433+ bordercolor="#666666"
434+ borderopacity="1.0"
435+ inkscape:pageopacity="0.0"
436+ inkscape:pageshadow="2"
437+ inkscape:zoom="1"
438+ inkscape:cx="368.33949"
439+ inkscape:cy="547.05121"
440+ inkscape:document-units="mm"
441+ inkscape:current-layer="layer1"
442+ showgrid="false"
443+ inkscape:window-width="1800"
444+ inkscape:window-height="1011"
445+ inkscape:window-x="86"
446+ inkscape:window-y="0"
447+ inkscape:window-maximized="0"
448+ inkscape:snap-nodes="false" />
449+ <metadata
450+ id="metadata5">
451+ <rdf:RDF>
452+ <cc:Work
453+ rdf:about="">
454+ <dc:format>image/svg+xml</dc:format>
455+ <dc:type
456+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
457+ <dc:title />
458+ </cc:Work>
459+ </rdf:RDF>
460+ </metadata>
461+ <g
462+ inkscape:label="Layer 1"
463+ inkscape:groupmode="layer"
464+ id="layer1">
465+ <text
466+ inkscape:export-ydpi="61.120499"
467+ inkscape:export-xdpi="61.120499"
468+ id="text854"
469+ y="119.72919"
470+ x="131.23334"
471+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
472+ xml:space="preserve"><tspan
473+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
474+ y="129.46077"
475+ x="131.23334"
476+ id="tspan852"
477+ sodipodi:role="line" /></text>
478+ <rect
479+ inkscape:export-ydpi="61.120499"
480+ inkscape:export-xdpi="61.120499"
481+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
482+ id="rect875"
483+ width="43.656246"
484+ height="18.520832"
485+ x="92.339577"
486+ y="110.20418" />
487+ <path
488+ inkscape:export-ydpi="61.120499"
489+ inkscape:export-xdpi="61.120499"
490+ inkscape:connector-curvature="0"
491+ id="path881"
492+ d="m 135.73129,118.93554 16.66875,-0.26459"
493+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker2049)" />
494+ <text
495+ inkscape:export-ydpi="61.120499"
496+ inkscape:export-xdpi="61.120499"
497+ id="text895"
498+ y="115.76046"
499+ x="138.37698"
500+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
501+ xml:space="preserve"><tspan
502+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
503+ y="115.76046"
504+ x="138.37698"
505+ id="tspan893"
506+ sodipodi:role="line">PTerm</tspan></text>
507+ <text
508+ inkscape:export-ydpi="61.120499"
509+ inkscape:export-xdpi="61.120499"
510+ id="text903"
511+ y="115.23129"
512+ x="93.927078"
513+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
514+ xml:space="preserve"><tspan
515+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332"
516+ y="115.23129"
517+ x="93.927078"
518+ id="tspan901"
519+ sodipodi:role="line">module Idris.Parser</tspan><tspan
520+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332"
521+ y="128.46045"
522+ x="93.927078"
523+ sodipodi:role="line"
524+ id="tspan1021" /></text>
525+ <rect
526+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
527+ id="rect905"
528+ width="44.185421"
529+ height="18.785423"
530+ x="40.463421"
531+ y="141.50723"
532+ inkscape:export-xdpi="61.120499"
533+ inkscape:export-ydpi="61.120499" />
534+ <rect
535+ y="155.183"
536+ x="95.51458"
537+ height="18.256256"
538+ width="49.212498"
539+ id="rect907"
540+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
541+ inkscape:export-xdpi="61.120499"
542+ inkscape:export-ydpi="61.120499" />
543+ <path
544+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker961)"
545+ d="m 84.648837,152.88468 9.013662,7.32603"
546+ id="path909"
547+ inkscape:connector-curvature="0"
548+ inkscape:export-xdpi="61.120499"
549+ inkscape:export-ydpi="61.120499"
550+ sodipodi:nodetypes="cc" />
551+ <path
552+ inkscape:connector-curvature="0"
553+ id="path911"
554+ d="m 22.471756,152.09108 16.66875,-0.26459"
555+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1539)"
556+ inkscape:export-xdpi="61.120499"
557+ inkscape:export-ydpi="61.120499" />
558+ <text
559+ xml:space="preserve"
560+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
561+ x="24.059256"
562+ y="148.91547"
563+ id="text917"
564+ inkscape:export-xdpi="61.120499"
565+ inkscape:export-ydpi="61.120499"><tspan
566+ sodipodi:role="line"
567+ id="tspan915"
568+ x="24.059256"
569+ y="148.91547"
570+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332">String</tspan></text>
571+ <text
572+ id="text923"
573+ y="137.72075"
574+ x="65.087494"
575+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
576+ xml:space="preserve"
577+ inkscape:export-xdpi="61.120499"
578+ inkscape:export-ydpi="61.120499"><tspan
579+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
580+ y="137.72075"
581+ x="65.087494"
582+ sodipodi:role="line"
583+ id="tspan921">List (TokenData Token)</tspan></text>
584+ <text
585+ id="text931"
586+ y="218.41846"
587+ x="36.512497"
588+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332;"
589+ xml:space="preserve"
590+ inkscape:export-xdpi="61.120499"
591+ inkscape:export-ydpi="61.120499"><tspan
592+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332;"
593+ y="218.41846"
594+ x="36.512497"
595+ id="tspan929"
596+ sodipodi:role="line">module Text.Lexer</tspan></text>
597+ <text
598+ xml:space="preserve"
599+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
600+ x="98.160408"
601+ y="161.00386"
602+ id="text935"
603+ inkscape:export-xdpi="61.120499"
604+ inkscape:export-ydpi="61.120499"><tspan
605+ sodipodi:role="line"
606+ id="tspan933"
607+ x="98.160408"
608+ y="161.00386"
609+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332">module Parser.Support</tspan></text>
610+ <rect
611+ inkscape:export-ydpi="61.120499"
612+ inkscape:export-xdpi="61.120499"
613+ y="214.18488"
614+ x="32.01458"
615+ height="6.3500061"
616+ width="43.656254"
617+ id="rect937"
618+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
619+ <rect
620+ inkscape:export-ydpi="61.120499"
621+ inkscape:export-xdpi="61.120499"
622+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
623+ id="rect939"
624+ width="42.862495"
625+ height="6.8791728"
626+ x="94.985413"
627+ y="214.18488" />
628+ <text
629+ inkscape:export-ydpi="61.120499"
630+ inkscape:export-xdpi="61.120499"
631+ xml:space="preserve"
632+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
633+ x="42.31551"
634+ y="147.59224"
635+ id="text951"><tspan
636+ sodipodi:role="line"
637+ id="tspan949"
638+ x="42.31551"
639+ y="147.59224"
640+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332">module Parser.Lexer</tspan></text>
641+ <path
642+ sodipodi:nodetypes="cc"
643+ inkscape:export-ydpi="61.120499"
644+ inkscape:export-xdpi="61.120499"
645+ inkscape:connector-curvature="0"
646+ id="path963"
647+ d="m 53.299561,213.22831 1.53604,-51.85834"
648+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker967)" />
649+ <text
650+ inkscape:export-ydpi="61.120499"
651+ inkscape:export-xdpi="61.120499"
652+ xml:space="preserve"
653+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332;"
654+ x="23.220526"
655+ y="251.01649"
656+ id="text971"><tspan
657+ sodipodi:role="line"
658+ id="tspan969"
659+ x="23.220526"
660+ y="251.01649"
661+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332;">module Text.Lexer.Core</tspan></text>
662+ <rect
663+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
664+ id="rect973"
665+ width="47.889587"
666+ height="6.3500061"
667+ x="21.633026"
668+ y="246.51833"
669+ inkscape:export-xdpi="61.120499"
670+ inkscape:export-ydpi="61.120499" />
671+ <path
672+ style="fill:none;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker991)"
673+ d="m 48.369316,228.83873 0.04943,-6.71548"
674+ id="path975"
675+ inkscape:connector-curvature="0"
676+ inkscape:export-xdpi="61.120499"
677+ inkscape:export-ydpi="61.120499"
678+ sodipodi:nodetypes="cc" />
679+ <text
680+ id="text979"
681+ y="241.96643"
682+ x="23.283329"
683+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332;"
684+ xml:space="preserve"
685+ inkscape:export-xdpi="61.120499"
686+ inkscape:export-ydpi="61.120499"><tspan
687+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332;"
688+ y="241.96643"
689+ x="23.283329"
690+ id="tspan977"
691+ sodipodi:role="line">module Text.Quantity</tspan></text>
692+ <rect
693+ inkscape:export-ydpi="61.120499"
694+ inkscape:export-xdpi="61.120499"
695+ y="237.46826"
696+ x="21.695829"
697+ height="6.2469702"
698+ width="43.853985"
699+ id="rect981"
700+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
701+ <text
702+ inkscape:export-ydpi="61.120499"
703+ inkscape:export-xdpi="61.120499"
704+ xml:space="preserve"
705+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332;"
706+ x="23.18244"
707+ y="233.68523"
708+ id="text985"><tspan
709+ sodipodi:role="line"
710+ id="tspan983"
711+ x="23.18244"
712+ y="233.68523"
713+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332;">module Text.Token</tspan></text>
714+ <rect
715+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
716+ id="rect987"
717+ width="39.011257"
718+ height="5.9464455"
719+ x="21.59494"
720+ y="229.18706"
721+ inkscape:export-xdpi="61.120499"
722+ inkscape:export-ydpi="61.120499" />
723+ <path
724+ sodipodi:nodetypes="cc"
725+ inkscape:export-ydpi="61.120499"
726+ inkscape:export-xdpi="61.120499"
727+ inkscape:connector-curvature="0"
728+ id="path993"
729+ d="M 62.998384,237.01083 62.846037,221.92147"
730+ style="fill:#ff0000;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker997)" />
731+ <path
732+ style="fill:#ff0000;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1003)"
733+ d="M 67.336659,246.29272 67.083422,221.71969"
734+ id="path999"
735+ inkscape:connector-curvature="0"
736+ inkscape:export-xdpi="61.120499"
737+ inkscape:export-ydpi="61.120499"
738+ sodipodi:nodetypes="cc" />
739+ <path
740+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1009)"
741+ d="M 73.937074,214.02206 94.72083,169.47102"
742+ id="path1005"
743+ inkscape:connector-curvature="0"
744+ inkscape:export-xdpi="61.120499"
745+ inkscape:export-ydpi="61.120499"
746+ sodipodi:nodetypes="cc" />
747+ <path
748+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1015)"
749+ d="M 108.0684,213.75748 108.0169,173.5408"
750+ id="path1011"
751+ inkscape:connector-curvature="0"
752+ inkscape:export-xdpi="61.120499"
753+ inkscape:export-ydpi="61.120499"
754+ sodipodi:nodetypes="cc" />
755+ <text
756+ inkscape:export-ydpi="61.120499"
757+ inkscape:export-xdpi="61.120499"
758+ id="text1019"
759+ y="218.94762"
760+ x="96.837494"
761+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332;"
762+ xml:space="preserve"><tspan
763+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332;"
764+ y="218.94762"
765+ x="96.837494"
766+ id="tspan1017"
767+ sodipodi:role="line">module Text.Parser</tspan></text>
768+ <path
769+ sodipodi:nodetypes="cc"
770+ inkscape:export-ydpi="61.120499"
771+ inkscape:export-xdpi="61.120499"
772+ inkscape:connector-curvature="0"
773+ id="path1023"
774+ d="m 113.62466,154.75539 0.0397,-25.06978"
775+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1027)" />
776+ <path
777+ sodipodi:nodetypes="cc"
778+ inkscape:export-ydpi="61.120499"
779+ inkscape:export-xdpi="61.120499"
780+ inkscape:connector-curvature="0"
781+ id="path1029"
782+ d="M 83.757032,147.15485 97.991855,129.77582"
783+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1033)" />
784+ <rect
785+ y="142.91107"
786+ x="118.15033"
787+ height="6.6968417"
788+ width="45.2328"
789+ id="rect1035"
790+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
791+ inkscape:export-xdpi="61.120499"
792+ inkscape:export-ydpi="61.120499" />
793+ <path
794+ sodipodi:nodetypes="cc"
795+ inkscape:export-ydpi="61.120499"
796+ inkscape:export-xdpi="61.120499"
797+ inkscape:connector-curvature="0"
798+ id="path1037"
799+ d="m 121.83513,142.5835 -0.0515,-12.72267"
800+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1057)" />
801+ <text
802+ xml:space="preserve"
803+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
804+ x="120.00241"
805+ y="147.67372"
806+ id="text1041"
807+ inkscape:export-xdpi="61.120499"
808+ inkscape:export-ydpi="61.120499"><tspan
809+ sodipodi:role="line"
810+ id="tspan1039"
811+ x="120.00241"
812+ y="147.67372"
813+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332">module TTImp.TTImp</tspan></text>
814+ <rect
815+ inkscape:export-ydpi="61.120499"
816+ inkscape:export-xdpi="61.120499"
817+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
818+ id="rect1047"
819+ width="42.862495"
820+ height="6.8791728"
821+ x="125.28364"
822+ y="133.0603" />
823+ <path
824+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1045)"
825+ d="m 145.18016,132.82376 -9.18434,-4.09859"
826+ id="path1049"
827+ inkscape:connector-curvature="0"
828+ inkscape:export-xdpi="61.120499"
829+ inkscape:export-ydpi="61.120499"
830+ sodipodi:nodetypes="cc" />
831+ <text
832+ inkscape:export-ydpi="61.120499"
833+ inkscape:export-xdpi="61.120499"
834+ id="text1053"
835+ y="137.82295"
836+ x="127.13572"
837+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
838+ xml:space="preserve"><tspan
839+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332"
840+ y="137.82295"
841+ x="127.13572"
842+ id="tspan1051"
843+ sodipodi:role="line">module Idris.Syntax</tspan></text>
844+ <rect
845+ inkscape:export-ydpi="61.120499"
846+ inkscape:export-xdpi="61.120499"
847+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#00871c;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
848+ id="rect1061"
849+ width="59.266659"
850+ height="16.13958"
851+ x="97.102074"
852+ y="186.93335" />
853+ <path
854+ inkscape:export-ydpi="61.120499"
855+ inkscape:export-xdpi="61.120499"
856+ inkscape:connector-curvature="0"
857+ id="path1063"
858+ d="m 76.993749,160.21044 18.785417,28.83958"
859+ style="fill:none;stroke:#00aa3f;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1105)"
860+ sodipodi:nodetypes="cc" />
861+ <text
862+ inkscape:export-ydpi="61.120499"
863+ inkscape:export-xdpi="61.120499"
864+ id="text1081"
865+ y="192.48962"
866+ x="157.95586"
867+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#008000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
868+ xml:space="preserve"><tspan
869+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#008000;stroke-width:0.26458332"
870+ y="192.48962"
871+ x="157.95586"
872+ id="tspan1079"
873+ sodipodi:role="line">SExp</tspan></text>
874+ <text
875+ inkscape:export-ydpi="61.120499"
876+ inkscape:export-xdpi="61.120499"
877+ id="text1089"
878+ y="192.75421"
879+ x="98.954155"
880+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#008000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
881+ xml:space="preserve"><tspan
882+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#008000;stroke-width:0.26458332"
883+ y="192.75421"
884+ x="98.954155"
885+ id="tspan1087"
886+ sodipodi:role="line">module Idris.IDEMode.Parser</tspan></text>
887+ <rect
888+ inkscape:export-ydpi="61.120499"
889+ inkscape:export-xdpi="61.120499"
890+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#7c007d;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
891+ id="rect1097"
892+ width="55.033333"
893+ height="14.287498"
894+ x="20.637447"
895+ y="52.524986" />
896+ <text
897+ inkscape:export-ydpi="61.120499"
898+ inkscape:export-xdpi="61.120499"
899+ id="text1101"
900+ y="58.610428"
901+ x="23.54781"
902+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#800080;fill-opacity:1;stroke:none;stroke-width:0.26458332;"
903+ xml:space="preserve"><tspan
904+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#800080;stroke-width:0.26458332;"
905+ y="58.610428"
906+ x="23.54781"
907+ id="tspan1099"
908+ sodipodi:role="line">module Idris.REPL</tspan></text>
909+ <path
910+ sodipodi:nodetypes="cc"
911+ style="fill:none;stroke:#00aa3f;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1111)"
912+ d="m 112.97708,174.23335 0,14.02292"
913+ id="path1107"
914+ inkscape:connector-curvature="0"
915+ inkscape:export-xdpi="61.120499"
916+ inkscape:export-ydpi="61.120499" />
917+ <path
918+ inkscape:export-ydpi="61.120499"
919+ inkscape:export-xdpi="61.120499"
920+ inkscape:connector-curvature="0"
921+ id="path1113"
922+ d="m 148.43125,150.15592 0.26458,35.71911"
923+ style="fill:none;stroke:#00aa3f;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1117)"
924+ sodipodi:nodetypes="cc" />
925+ <path
926+ inkscape:export-ydpi="61.120499"
927+ inkscape:export-xdpi="61.120499"
928+ inkscape:connector-curvature="0"
929+ id="path1119"
930+ d="m 156.56889,195.56696 13.16435,-0.41532"
931+ style="fill:none;stroke:#00aa3f;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1123)"
932+ sodipodi:nodetypes="cc" />
933+ <text
934+ id="text950"
935+ y="104.70191"
936+ x="22.426785"
937+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
938+ xml:space="preserve"
939+ inkscape:export-xdpi="61.120499"
940+ inkscape:export-ydpi="61.120499"><tspan
941+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332"
942+ y="104.70191"
943+ x="22.426785"
944+ id="tspan948"
945+ sodipodi:role="line">module Core.Core</tspan></text>
946+ <rect
947+ inkscape:export-ydpi="61.120499"
948+ inkscape:export-xdpi="61.120499"
949+ y="100.20374"
950+ x="20.839275"
951+ height="9.7895899"
952+ width="47.889587"
953+ id="rect952"
954+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
955+ <text
956+ inkscape:export-ydpi="61.120499"
957+ inkscape:export-xdpi="61.120499"
958+ xml:space="preserve"
959+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
960+ x="22.955944"
961+ y="108.40608"
962+ id="text956"><tspan
963+ sodipodi:role="line"
964+ id="tspan954"
965+ x="22.955944"
966+ y="108.40608"
967+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#000000;stroke-width:0.26458332">error messages</tspan></text>
968+ <text
969+ inkscape:export-ydpi="61.120499"
970+ inkscape:export-xdpi="61.120499"
971+ xml:space="preserve"
972+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
973+ x="79.312202"
974+ y="92.266502"
975+ id="text960"><tspan
976+ sodipodi:role="line"
977+ id="tspan958"
978+ x="79.312202"
979+ y="92.266502"
980+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332">module Core.CompileExpr</tspan></text>
981+ <rect
982+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
983+ id="rect962"
984+ width="61.912495"
985+ height="18.785419"
986+ x="77.724693"
987+ y="87.768333"
988+ inkscape:export-xdpi="61.120499"
989+ inkscape:export-ydpi="61.120499" />
990+ <text
991+ id="text966"
992+ y="95.970665"
993+ x="79.841362"
994+ style="font-style:normal;font-weight:normal;font-size:3.52777767px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
995+ xml:space="preserve"
996+ inkscape:export-xdpi="61.120499"
997+ inkscape:export-ydpi="61.120499"><tspan
998+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#000000;stroke-width:0.26458332"
999+ y="95.970665"
1000+ x="79.841362"
1001+ sodipodi:role="line"
1002+ id="tspan968">Representation of expressions ready</tspan><tspan
1003+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#000000;stroke-width:0.26458332"
1004+ y="100.38039"
1005+ x="79.841362"
1006+ sodipodi:role="line"
1007+ id="tspan974">for compiling: CExp</tspan><tspan
1008+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#000000;stroke-width:0.26458332"
1009+ y="104.79011"
1010+ x="79.841362"
1011+ sodipodi:role="line"
1012+ id="tspan972">Type erased, explicit case trees</tspan></text>
1013+ <text
1014+ inkscape:export-ydpi="61.120499"
1015+ inkscape:export-xdpi="61.120499"
1016+ xml:space="preserve"
1017+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
1018+ x="22.162193"
1019+ y="73.217979"
1020+ id="text978"><tspan
1021+ sodipodi:role="line"
1022+ id="tspan976"
1023+ x="22.162193"
1024+ y="73.217979"
1025+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332">module Idris.CommandLine</tspan></text>
1026+ <rect
1027+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1028+ id="rect980"
1029+ width="55.827087"
1030+ height="10.054173"
1031+ x="20.574694"
1032+ y="68.719742"
1033+ inkscape:export-xdpi="61.120499"
1034+ inkscape:export-ydpi="61.120499" />
1035+ <text
1036+ id="text984"
1037+ y="76.92215"
1038+ x="22.69136"
1039+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
1040+ xml:space="preserve"
1041+ inkscape:export-xdpi="61.120499"
1042+ inkscape:export-ydpi="61.120499"><tspan
1043+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#000000;stroke-width:0.26458332"
1044+ y="76.92215"
1045+ x="22.69136"
1046+ id="tspan982"
1047+ sodipodi:role="line">command line options</tspan></text>
1048+ <text
1049+ id="text988"
1050+ y="89.886726"
1051+ x="22.162193"
1052+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
1053+ xml:space="preserve"
1054+ inkscape:export-xdpi="61.120499"
1055+ inkscape:export-ydpi="61.120499"><tspan
1056+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332"
1057+ y="89.886726"
1058+ x="22.162193"
1059+ id="tspan986"
1060+ sodipodi:role="line">module Idris.Error</tspan></text>
1061+ <rect
1062+ inkscape:export-ydpi="61.120499"
1063+ inkscape:export-xdpi="61.120499"
1064+ y="85.388489"
1065+ x="20.574694"
1066+ height="9.5250101"
1067+ width="37.835419"
1068+ id="rect990"
1069+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
1070+ <text
1071+ inkscape:export-ydpi="61.120499"
1072+ inkscape:export-xdpi="61.120499"
1073+ xml:space="preserve"
1074+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
1075+ x="22.69136"
1076+ y="93.590897"
1077+ id="text994"><tspan
1078+ sodipodi:role="line"
1079+ id="tspan992"
1080+ x="22.69136"
1081+ y="93.590897"
1082+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#000000;stroke-width:0.26458332">perror</tspan></text>
1083+ <path
1084+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1000)"
1085+ d="m 66.876776,99.410007 c -0.17822,-10.50534 -0.880145,-7.9985 -7.143748,-8.99444"
1086+ id="path996"
1087+ inkscape:connector-curvature="0"
1088+ inkscape:export-xdpi="61.120499"
1089+ inkscape:export-ydpi="61.120499"
1090+ sodipodi:nodetypes="cc" />
1091+ <path
1092+ style="fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
1093+ d="M 15.081249,210.48125 H 200.02499"
1094+ id="path1201"
1095+ inkscape:connector-curvature="0"
1096+ sodipodi:nodetypes="cc"
1097+ inkscape:export-xdpi="61.120499"
1098+ inkscape:export-ydpi="61.120499" />
1099+ <path
1100+ style="fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend)"
1101+ d="m 154.78125,214.97917 -0.26459,40.21666"
1102+ id="path1203"
1103+ inkscape:connector-curvature="0"
1104+ inkscape:export-xdpi="61.120499"
1105+ inkscape:export-ydpi="61.120499" />
1106+ <text
1107+ xml:space="preserve"
1108+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:0.40000001;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332;"
1109+ x="158.75"
1110+ y="226.09137"
1111+ id="text1473"
1112+ inkscape:export-xdpi="61.120499"
1113+ inkscape:export-ydpi="61.120499"><tspan
1114+ sodipodi:role="line"
1115+ id="tspan1471"
1116+ x="158.75"
1117+ y="226.09137"
1118+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332;">'text' modules are</tspan><tspan
1119+ sodipodi:role="line"
1120+ x="158.75"
1121+ y="230.92491"
1122+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332;"
1123+ id="tspan1475">also in Idris 1</tspan><tspan
1124+ sodipodi:role="line"
1125+ x="158.75"
1126+ y="235.75845"
1127+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332;"
1128+ id="tspan1477">library.</tspan></text>
1129+ <path
1130+ inkscape:connector-curvature="0"
1131+ id="path957"
1132+ d="m 172.77292,166.03125 -0.26459,40.21666"
1133+ style="fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#marker969);marker-end:url(#marker973)"
1134+ inkscape:export-xdpi="61.120499"
1135+ inkscape:export-ydpi="61.120499" />
1136+ <text
1137+ inkscape:export-ydpi="61.120499"
1138+ inkscape:export-xdpi="61.120499"
1139+ id="text965"
1140+ y="177.14345"
1141+ x="176.74167"
1142+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:0.40000001;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#008000;fill-opacity:1;stroke:none;stroke-width:0.26458332;"
1143+ xml:space="preserve"><tspan
1144+ id="tspan963"
1145+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#008000;stroke-width:0.26458332;"
1146+ y="177.14345"
1147+ x="176.74167"
1148+ sodipodi:role="line">'IDEMode is for</tspan><tspan
1149+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#008000;stroke-width:0.26458332;"
1150+ y="181.97699"
1151+ x="176.74167"
1152+ sodipodi:role="line"
1153+ id="tspan981">communicating</tspan><tspan
1154+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#008000;stroke-width:0.26458332;"
1155+ y="186.81053"
1156+ x="176.74167"
1157+ sodipodi:role="line"
1158+ id="tspan984">with external</tspan><tspan
1159+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#008000;stroke-width:0.26458332;"
1160+ y="191.64406"
1161+ x="176.74167"
1162+ sodipodi:role="line"
1163+ id="tspan987">editors. It uses</tspan><tspan
1164+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#008000;stroke-width:0.26458332;"
1165+ y="196.4776"
1166+ x="176.74167"
1167+ sodipodi:role="line"
1168+ id="tspan989">SExp structure</tspan><tspan
1169+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#008000;stroke-width:0.26458332;"
1170+ y="201.31114"
1171+ x="176.74167"
1172+ sodipodi:role="line"
1173+ id="tspan991">which is Lisp-</tspan><tspan
1174+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#008000;stroke-width:0.26458332;"
1175+ y="206.14468"
1176+ x="176.74167"
1177+ sodipodi:role="line"
1178+ id="tspan993">like.</tspan></text>
1179+ <path
1180+ style="fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#marker1017);marker-end:url(#marker1021)"
1181+ d="m 172.77292,110.20417 -0.26459,40.21666"
1182+ id="path997"
1183+ inkscape:connector-curvature="0"
1184+ inkscape:export-xdpi="61.120499"
1185+ inkscape:export-ydpi="61.120499" />
1186+ <text
1187+ xml:space="preserve"
1188+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:0.40000001;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
1189+ x="176.21251"
1190+ y="115.76012"
1191+ id="text1013"
1192+ inkscape:export-xdpi="61.120499"
1193+ inkscape:export-ydpi="61.120499"><tspan
1194+ id="tspan1011"
1195+ sodipodi:role="line"
1196+ x="176.21251"
1197+ y="115.76012"
1198+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#000000;stroke-width:0.26458332">Idris.Parser</tspan><tspan
1199+ sodipodi:role="line"
1200+ x="176.21251"
1201+ y="120.59366"
1202+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#000000;stroke-width:0.26458332"
1203+ id="tspan1050">reads from a</tspan><tspan
1204+ sodipodi:role="line"
1205+ x="176.21251"
1206+ y="125.42719"
1207+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#000000;stroke-width:0.26458332"
1208+ id="tspan1052">file and outputs</tspan><tspan
1209+ sodipodi:role="line"
1210+ x="176.21251"
1211+ y="130.26073"
1212+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#000000;stroke-width:0.26458332"
1213+ id="tspan1054">to a PTerm</tspan><tspan
1214+ sodipodi:role="line"
1215+ x="176.21251"
1216+ y="135.09427"
1217+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#000000;stroke-width:0.26458332"
1218+ id="tspan1056">structure.</tspan></text>
1219+ <path
1220+ inkscape:connector-curvature="0"
1221+ id="path1058"
1222+ d="m 171.97917,51.731253 -0.26459,19.57916"
1223+ style="fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#marker1074);marker-end:url(#marker1078)"
1224+ sodipodi:nodetypes="cc"
1225+ inkscape:export-xdpi="61.120499"
1226+ inkscape:export-ydpi="61.120499" />
1227+ <text
1228+ inkscape:export-ydpi="61.120499"
1229+ inkscape:export-xdpi="61.120499"
1230+ id="text1070"
1231+ y="57.287201"
1232+ x="175.41876"
1233+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:0.40000001;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#800080;fill-opacity:1;stroke:none;stroke-width:0.26458332;"
1234+ xml:space="preserve"><tspan
1235+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#800080;stroke-width:0.26458332;"
1236+ y="57.287201"
1237+ x="175.41876"
1238+ sodipodi:role="line"
1239+ id="tspan1060">Idris.Parser</tspan><tspan
1240+ id="tspan1068"
1241+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#800080;stroke-width:0.26458332;"
1242+ y="62.120739"
1243+ x="175.41876"
1244+ sodipodi:role="line">reads from the</tspan><tspan
1245+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:0.40000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#800080;stroke-width:0.26458332;"
1246+ y="66.954277"
1247+ x="175.41876"
1248+ sodipodi:role="line"
1249+ id="tspan1089">command line.</tspan></text>
1250+ </g>
1251+</svg>
docs/image/parserTopLevel.pngnew file

Binary file not shown.

docs/image/parserTopLevel.svgnew file+294
@@ -0,0 +1,294 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3+
4+<svg
5+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6+ xmlns:cc="http://creativecommons.org/ns#"
7+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8+ xmlns:svg="http://www.w3.org/2000/svg"
9+ xmlns="http://www.w3.org/2000/svg"
10+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12+ width="210mm"
13+ height="297mm"
14+ viewBox="0 0 210 297"
15+ version="1.1"
16+ id="svg8"
17+ inkscape:version="0.92.2 5c3e80d, 2017-08-06"
18+ sodipodi:docname="topLevel.svg">
19+ <defs
20+ id="defs2">
21+ <marker
22+ inkscape:isstock="true"
23+ style="overflow:visible;"
24+ id="marker3617"
25+ refX="0.0"
26+ refY="0.0"
27+ orient="auto"
28+ inkscape:stockid="Arrow1Mend">
29+ <path
30+ transform="scale(0.4) rotate(180) translate(10,0)"
31+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
32+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
33+ id="path3615" />
34+ </marker>
35+ <marker
36+ inkscape:stockid="Arrow1Mend"
37+ orient="auto"
38+ refY="0.0"
39+ refX="0.0"
40+ id="marker2891"
41+ style="overflow:visible;"
42+ inkscape:isstock="true"
43+ inkscape:collect="always">
44+ <path
45+ id="path2889"
46+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
47+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
48+ transform="scale(0.4) rotate(180) translate(10,0)" />
49+ </marker>
50+ <marker
51+ inkscape:stockid="Arrow1Mend"
52+ orient="auto"
53+ refY="0.0"
54+ refX="0.0"
55+ id="marker2049"
56+ style="overflow:visible;"
57+ inkscape:isstock="true">
58+ <path
59+ id="path2047"
60+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
61+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
62+ transform="scale(0.4) rotate(180) translate(10,0)" />
63+ </marker>
64+ <marker
65+ inkscape:isstock="true"
66+ style="overflow:visible;"
67+ id="marker1539"
68+ refX="0.0"
69+ refY="0.0"
70+ orient="auto"
71+ inkscape:stockid="Arrow1Mend"
72+ inkscape:collect="always">
73+ <path
74+ transform="scale(0.4) rotate(180) translate(10,0)"
75+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
76+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
77+ id="path1537" />
78+ </marker>
79+ <marker
80+ inkscape:stockid="Arrow1Mend"
81+ orient="auto"
82+ refY="0.0"
83+ refX="0.0"
84+ id="Arrow1Mend"
85+ style="overflow:visible;"
86+ inkscape:isstock="true"
87+ inkscape:collect="always">
88+ <path
89+ id="path830"
90+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
91+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
92+ transform="scale(0.4) rotate(180) translate(10,0)" />
93+ </marker>
94+ </defs>
95+ <sodipodi:namedview
96+ id="base"
97+ pagecolor="#ffffff"
98+ bordercolor="#666666"
99+ borderopacity="1.0"
100+ inkscape:pageopacity="0.0"
101+ inkscape:pageshadow="2"
102+ inkscape:zoom="1"
103+ inkscape:cx="396.85039"
104+ inkscape:cy="560"
105+ inkscape:document-units="mm"
106+ inkscape:current-layer="layer1"
107+ showgrid="false"
108+ inkscape:window-width="1920"
109+ inkscape:window-height="1015"
110+ inkscape:window-x="0"
111+ inkscape:window-y="0"
112+ inkscape:window-maximized="1" />
113+ <metadata
114+ id="metadata5">
115+ <rdf:RDF>
116+ <cc:Work
117+ rdf:about="">
118+ <dc:format>image/svg+xml</dc:format>
119+ <dc:type
120+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
121+ <dc:title />
122+ </cc:Work>
123+ </rdf:RDF>
124+ </metadata>
125+ <g
126+ inkscape:label="Layer 1"
127+ inkscape:groupmode="layer"
128+ id="layer1">
129+ <rect
130+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
131+ id="rect815"
132+ width="35.983334"
133+ height="18.25625"
134+ x="37.306248"
135+ y="79.512497"
136+ inkscape:export-xdpi="61.120499"
137+ inkscape:export-ydpi="61.120499" />
138+ <rect
139+ y="79.512497"
140+ x="92.339577"
141+ height="18.25625"
142+ width="35.983334"
143+ id="rect817"
144+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
145+ inkscape:export-xdpi="61.120499"
146+ inkscape:export-ydpi="61.120499" />
147+ <path
148+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Mend)"
149+ d="m 73.554166,88.508337 16.66875,-0.26459"
150+ id="path819"
151+ inkscape:connector-curvature="0"
152+ inkscape:export-xdpi="61.120499"
153+ inkscape:export-ydpi="61.120499" />
154+ <path
155+ inkscape:connector-curvature="0"
156+ id="path1535"
157+ d="m 18.785416,88.77292 16.66875,-0.26459"
158+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1539)"
159+ inkscape:export-xdpi="61.120499"
160+ inkscape:export-ydpi="61.120499" />
161+ <path
162+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker2049)"
163+ d="m 128.32291,88.243753 16.66875,-0.26459"
164+ id="path2045"
165+ inkscape:connector-curvature="0"
166+ inkscape:export-xdpi="61.120499"
167+ inkscape:export-ydpi="61.120499" />
168+ <text
169+ xml:space="preserve"
170+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
171+ x="20.372915"
172+ y="85.597931"
173+ id="text2857"
174+ inkscape:export-xdpi="61.120499"
175+ inkscape:export-ydpi="61.120499"><tspan
176+ sodipodi:role="line"
177+ id="tspan2855"
178+ x="20.372915"
179+ y="85.597931"
180+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332">String</tspan></text>
181+ <text
182+ id="text2861"
183+ y="80.835434"
184+ x="76.199997"
185+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
186+ xml:space="preserve"
187+ inkscape:export-xdpi="61.120499"
188+ inkscape:export-ydpi="61.120499"><tspan
189+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
190+ y="80.835434"
191+ x="76.199997"
192+ sodipodi:role="line"
193+ id="tspan2867">List</tspan><tspan
194+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
195+ y="86.127098"
196+ x="76.199997"
197+ sodipodi:role="line"
198+ id="tspan2871">Token</tspan></text>
199+ <text
200+ xml:space="preserve"
201+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
202+ x="130.96875"
203+ y="85.068764"
204+ id="text2865"
205+ inkscape:export-xdpi="61.120499"
206+ inkscape:export-ydpi="61.120499"><tspan
207+ sodipodi:role="line"
208+ id="tspan2863"
209+ x="130.96875"
210+ y="85.068764"
211+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332">PTerm</tspan></text>
212+ <text
213+ id="text2875"
214+ y="89.302101"
215+ x="47.360416"
216+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332;"
217+ xml:space="preserve"
218+ inkscape:export-xdpi="61.120499"
219+ inkscape:export-ydpi="61.120499"><tspan
220+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332;fill:#0000ff;"
221+ y="89.302101"
222+ x="47.360416"
223+ id="tspan2873"
224+ sodipodi:role="line">Lexer</tspan></text>
225+ <text
226+ xml:space="preserve"
227+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
228+ x="100.27708"
229+ y="89.037521"
230+ id="text2879"
231+ inkscape:export-xdpi="61.120499"
232+ inkscape:export-ydpi="61.120499"><tspan
233+ sodipodi:role="line"
234+ id="tspan2877"
235+ x="100.27708"
236+ y="89.037521"
237+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332">Parser</tspan></text>
238+ <path
239+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker2891)"
240+ d="m 52.916666,71.575003 v 7.67291"
241+ id="path2887"
242+ inkscape:connector-curvature="0"
243+ sodipodi:nodetypes="cc"
244+ inkscape:export-xdpi="61.120499"
245+ inkscape:export-ydpi="61.120499" />
246+ <path
247+ sodipodi:nodetypes="cc"
248+ inkscape:connector-curvature="0"
249+ id="path3613"
250+ d="m 108.74375,71.575003 v 7.67291"
251+ style="fill:none;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker3617)"
252+ inkscape:export-xdpi="61.120499"
253+ inkscape:export-ydpi="61.120499" />
254+ <text
255+ id="text4173"
256+ y="69.987518"
257+ x="43.391666"
258+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
259+ xml:space="preserve"
260+ inkscape:export-xdpi="61.120499"
261+ inkscape:export-ydpi="61.120499"><tspan
262+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
263+ y="69.987518"
264+ x="43.391666"
265+ id="tspan4171"
266+ sodipodi:role="line">Recogniser</tspan></text>
267+ <text
268+ xml:space="preserve"
269+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
270+ x="97.102081"
271+ y="69.722939"
272+ id="text4177"
273+ inkscape:export-xdpi="61.120499"
274+ inkscape:export-ydpi="61.120499"><tspan
275+ sodipodi:role="line"
276+ id="tspan4175"
277+ x="97.102081"
278+ y="69.722939"
279+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332">Grammar</tspan></text>
280+ <text
281+ inkscape:export-ydpi="61.120499"
282+ inkscape:export-xdpi="61.120499"
283+ id="text854"
284+ y="93.800011"
285+ x="131.23334"
286+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
287+ xml:space="preserve"><tspan
288+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
289+ y="103.5316"
290+ x="131.23334"
291+ id="tspan852"
292+ sodipodi:role="line" /></text>
293+ </g>
294+</svg>
docs/image/recogniser.pngnew file

Binary file not shown.

docs/image/recogniser.svgnew file+477
@@ -0,0 +1,477 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3+
4+<svg
5+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6+ xmlns:cc="http://creativecommons.org/ns#"
7+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8+ xmlns:svg="http://www.w3.org/2000/svg"
9+ xmlns="http://www.w3.org/2000/svg"
10+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12+ width="210mm"
13+ height="297mm"
14+ viewBox="0 0 210 297"
15+ version="1.1"
16+ id="svg8"
17+ inkscape:version="0.92.2 5c3e80d, 2017-08-06"
18+ sodipodi:docname="recogniser.svg">
19+ <defs
20+ id="defs2" />
21+ <sodipodi:namedview
22+ id="base"
23+ pagecolor="#ffffff"
24+ bordercolor="#666666"
25+ borderopacity="1.0"
26+ inkscape:pageopacity="0.0"
27+ inkscape:pageshadow="2"
28+ inkscape:zoom="1"
29+ inkscape:cx="384.45994"
30+ inkscape:cy="560"
31+ inkscape:document-units="mm"
32+ inkscape:current-layer="layer1"
33+ showgrid="false"
34+ inkscape:window-width="1920"
35+ inkscape:window-height="1015"
36+ inkscape:window-x="0"
37+ inkscape:window-y="0"
38+ inkscape:window-maximized="1" />
39+ <metadata
40+ id="metadata5">
41+ <rdf:RDF>
42+ <cc:Work
43+ rdf:about="">
44+ <dc:format>image/svg+xml</dc:format>
45+ <dc:type
46+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
47+ <dc:title />
48+ </cc:Work>
49+ </rdf:RDF>
50+ </metadata>
51+ <g
52+ inkscape:label="Layer 1"
53+ inkscape:groupmode="layer"
54+ id="layer1">
55+ <rect
56+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70599997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
57+ id="rect815"
58+ width="112.44793"
59+ height="77.258354"
60+ x="6.3499999"
61+ y="63.108334"
62+ ry="3.96875"
63+ inkscape:export-xdpi="61.120499"
64+ inkscape:export-ydpi="61.120499" />
65+ <text
66+ xml:space="preserve"
67+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:5.64444447px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
68+ x="11.112496"
69+ y="68.399994"
70+ id="text819"
71+ inkscape:export-xdpi="61.120499"
72+ inkscape:export-ydpi="61.120499"><tspan
73+ sodipodi:role="line"
74+ id="tspan817"
75+ x="11.112496"
76+ y="68.399994"
77+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:5.64444447px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332">Text.Lexer.Core</tspan></text>
78+ <text
79+ id="text823"
80+ y="74.749992"
81+ x="8.7312441"
82+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
83+ xml:space="preserve"
84+ inkscape:export-xdpi="61.120499"
85+ inkscape:export-ydpi="61.120499"><tspan
86+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
87+ y="74.749992"
88+ x="8.7312441"
89+ id="tspan821"
90+ sodipodi:role="line">data Recognise : (consumes : Bool) -&gt; Type where</tspan><tspan
91+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
92+ y="80.041656"
93+ x="8.7312441"
94+ sodipodi:role="line"
95+ id="tspan825"> Empty : Recognise False</tspan><tspan
96+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
97+ y="85.333328"
98+ x="8.7312441"
99+ sodipodi:role="line"
100+ id="tspan827"> Fail : Recognise c</tspan><tspan
101+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
102+ y="90.624992"
103+ x="8.7312441"
104+ sodipodi:role="line"
105+ id="tspan829"> Lookahead : (positive : Bool) -&gt; Recognise c -&gt; Recognise False</tspan><tspan
106+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
107+ y="95.916656"
108+ x="8.7312441"
109+ sodipodi:role="line"
110+ id="tspan831"> Pred : (Char -&gt; Bool) -&gt; Recognise True</tspan><tspan
111+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
112+ y="101.20832"
113+ x="8.7312441"
114+ sodipodi:role="line"
115+ id="tspan835"> SeqEat : Recognise True -&gt; Inf (Recognise e) -&gt; Recognise True</tspan><tspan
116+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
117+ y="106.49999"
118+ x="8.7312441"
119+ sodipodi:role="line"
120+ id="tspan837"> SeqEmpty : Recognise e1 -&gt; Recognise e2 -&gt; Recognise (e1 || e2)</tspan><tspan
121+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
122+ y="111.79166"
123+ x="8.7312441"
124+ sodipodi:role="line"
125+ id="tspan839"> Alt : Recognise e1 -&gt; Recognise e2 -&gt; Recognise (e1 &amp;&amp; e2)</tspan><tspan
126+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
127+ y="117.08332"
128+ x="8.7312441"
129+ sodipodi:role="line"
130+ id="tspan841" /><tspan
131+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
132+ y="122.37499"
133+ x="8.7312441"
134+ sodipodi:role="line"
135+ id="tspan843">||| A token recogniser. Guaranteed to consume at least one character.</tspan><tspan
136+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
137+ y="127.66666"
138+ x="8.7312441"
139+ sodipodi:role="line"
140+ id="tspan845">public export</tspan><tspan
141+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
142+ y="132.95833"
143+ x="8.7312441"
144+ sodipodi:role="line"
145+ id="tspan847">Lexer : Type</tspan><tspan
146+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
147+ y="138.24998"
148+ x="8.7312441"
149+ sodipodi:role="line"
150+ id="tspan849">Lexer = Recognise True</tspan><tspan
151+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
152+ y="143.54166"
153+ x="8.7312441"
154+ sodipodi:role="line"
155+ id="tspan851" /></text>
156+ <rect
157+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
158+ id="rect850"
159+ width="111.65417"
160+ height="10.318749"
161+ x="9.7895756"
162+ y="97.504166"
163+ inkscape:export-xdpi="61.120499"
164+ inkscape:export-ydpi="61.120499" />
165+ <rect
166+ y="97.504166"
167+ x="9.7895756"
168+ height="15.610415"
169+ width="111.38958"
170+ id="rect852"
171+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
172+ inkscape:export-xdpi="61.120499"
173+ inkscape:export-ydpi="61.120499" />
174+ <text
175+ inkscape:export-ydpi="61.120499"
176+ inkscape:export-xdpi="61.120499"
177+ id="text870"
178+ y="98.297905"
179+ x="129.64584"
180+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
181+ xml:space="preserve"><tspan
182+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
183+ y="98.297905"
184+ x="129.64584"
185+ sodipodi:role="line"
186+ id="tspan908">(&lt;+&gt;) : Recognise c1 -&gt; inf c1 (Recognise c2) -&gt; </tspan><tspan
187+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
188+ y="103.58957"
189+ x="129.64584"
190+ sodipodi:role="line"
191+ id="tspan929"> Recognise (c1 || c2)</tspan><tspan
192+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
193+ y="108.88124"
194+ x="129.64584"
195+ sodipodi:role="line"
196+ id="tspan916">Sequence two recognisers. If either consumes a</tspan><tspan
197+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
198+ y="114.1729"
199+ x="129.64584"
200+ sodipodi:role="line"
201+ id="tspan918">character, the sequence is guaranteed to</tspan><tspan
202+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
203+ y="119.46457"
204+ x="129.64584"
205+ sodipodi:role="line"
206+ id="tspan935">consume a character</tspan><tspan
207+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
208+ y="124.75623"
209+ x="129.64584"
210+ sodipodi:role="line"
211+ id="tspan912" /><tspan
212+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
213+ y="130.04791"
214+ x="129.64584"
215+ sodipodi:role="line"
216+ id="tspan868" /></text>
217+ <path
218+ style="fill:none;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
219+ d="m 129.38124,100.41458 -7.9375,-2.910414"
220+ id="path937"
221+ inkscape:connector-curvature="0"
222+ sodipodi:nodetypes="cc"
223+ inkscape:export-xdpi="61.120499"
224+ inkscape:export-ydpi="61.120499" />
225+ <text
226+ xml:space="preserve"
227+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
228+ x="130.175"
229+ y="129.25418"
230+ id="text953"
231+ inkscape:export-xdpi="61.120499"
232+ inkscape:export-ydpi="61.120499"><tspan
233+ sodipodi:role="line"
234+ x="130.175"
235+ y="129.25418"
236+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
237+ id="tspan973">(&lt;|&gt;) : Recognise c1 -&gt; Recognise c2 -&gt;</tspan><tspan
238+ sodipodi:role="line"
239+ x="130.175"
240+ y="134.54584"
241+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
242+ id="tspan975"> Recognise (c1 &amp;&amp; c2)</tspan><tspan
243+ sodipodi:role="line"
244+ x="130.175"
245+ y="139.83751"
246+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
247+ id="tspan983">Alternative recognisers. If both consume, the</tspan><tspan
248+ sodipodi:role="line"
249+ x="130.175"
250+ y="145.12917"
251+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
252+ id="tspan985">combination is guaranteed to consumer a</tspan><tspan
253+ sodipodi:role="line"
254+ x="130.175"
255+ y="150.42084"
256+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
257+ id="tspan992">character.</tspan><tspan
258+ sodipodi:role="line"
259+ x="130.175"
260+ y="155.71251"
261+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
262+ id="tspan977" /><tspan
263+ id="tspan949"
264+ sodipodi:role="line"
265+ x="130.175"
266+ y="161.00417"
267+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332" /><tspan
268+ id="tspan951"
269+ sodipodi:role="line"
270+ x="130.175"
271+ y="166.29584"
272+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332" /></text>
273+ <path
274+ inkscape:connector-curvature="0"
275+ id="path996"
276+ d="M 128.05833,126.87292 110.33125,110.46875"
277+ style="fill:none;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
278+ sodipodi:nodetypes="cc"
279+ inkscape:export-xdpi="61.120499"
280+ inkscape:export-ydpi="61.120499" />
281+ <text
282+ xml:space="preserve"
283+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
284+ x="28.045837"
285+ y="51.731236"
286+ id="text1012"
287+ inkscape:export-xdpi="61.120499"
288+ inkscape:export-ydpi="61.120499"><tspan
289+ id="tspan1006"
290+ sodipodi:role="line"
291+ x="28.045837"
292+ y="51.731236"
293+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332">empty : Recognise False</tspan><tspan
294+ sodipodi:role="line"
295+ x="28.045837"
296+ y="57.022903"
297+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
298+ id="tspan1087">Recognise no input (doesn't consume any input)</tspan><tspan
299+ id="tspan1008"
300+ sodipodi:role="line"
301+ x="28.045837"
302+ y="62.314568"
303+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332" /><tspan
304+ id="tspan1010"
305+ sodipodi:role="line"
306+ x="28.045837"
307+ y="67.606232"
308+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332" /></text>
309+ <text
310+ inkscape:export-ydpi="61.120499"
311+ inkscape:export-xdpi="61.120499"
312+ id="text1031"
313+ y="49.614574"
314+ x="114.56458"
315+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
316+ xml:space="preserve"><tspan
317+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
318+ y="49.614574"
319+ x="114.56458"
320+ sodipodi:role="line"
321+ id="tspan1025">fail : Recognise c</tspan><tspan
322+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
323+ y="54.906242"
324+ x="114.56458"
325+ sodipodi:role="line"
326+ id="tspan1089">A recogniser that always fails.</tspan><tspan
327+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
328+ y="60.197906"
329+ x="114.56458"
330+ sodipodi:role="line"
331+ id="tspan1027" /><tspan
332+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
333+ y="65.489571"
334+ x="114.56458"
335+ sodipodi:role="line"
336+ id="tspan1029" /></text>
337+ <text
338+ inkscape:export-ydpi="61.120499"
339+ inkscape:export-xdpi="61.120499"
340+ id="text1039"
341+ y="61.785423"
342+ x="128.32292"
343+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
344+ xml:space="preserve"><tspan
345+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
346+ y="61.785423"
347+ x="128.32292"
348+ sodipodi:role="line"
349+ id="tspan1051">expect : Recognise c -&gt; Recognise False</tspan><tspan
350+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
351+ y="67.077087"
352+ x="128.32292"
353+ sodipodi:role="line"
354+ id="tspan1059">Positive lookahead. Never consumes input.</tspan><tspan
355+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
356+ y="72.368759"
357+ x="128.32292"
358+ sodipodi:role="line"
359+ id="tspan1035" /><tspan
360+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
361+ y="77.660423"
362+ x="128.32292"
363+ sodipodi:role="line"
364+ id="tspan1037" /></text>
365+ <text
366+ xml:space="preserve"
367+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
368+ x="125.14791"
369+ y="86.39167"
370+ id="text1047"
371+ inkscape:export-xdpi="61.120499"
372+ inkscape:export-ydpi="61.120499"><tspan
373+ id="tspan1041"
374+ sodipodi:role="line"
375+ x="125.14791"
376+ y="86.39167"
377+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332">pred : (Char -&gt; Bool) -&gt; Lexer</tspan><tspan
378+ sodipodi:role="line"
379+ x="125.14791"
380+ y="91.683334"
381+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
382+ id="tspan1085">Recognise a character that matches a predicate</tspan><tspan
383+ id="tspan1043"
384+ sodipodi:role="line"
385+ x="125.14791"
386+ y="96.975006"
387+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332" /><tspan
388+ id="tspan1045"
389+ sodipodi:role="line"
390+ x="125.14791"
391+ y="102.26667"
392+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332" /></text>
393+ <rect
394+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
395+ id="rect1053"
396+ width="79.904167"
397+ height="23.283327"
398+ x="121.70833"
399+ y="57.816666"
400+ inkscape:export-xdpi="61.120499"
401+ inkscape:export-ydpi="61.120499" />
402+ <text
403+ xml:space="preserve"
404+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
405+ x="128.32291"
406+ y="72.897926"
407+ id="text1069"
408+ inkscape:export-xdpi="61.120499"
409+ inkscape:export-ydpi="61.120499"><tspan
410+ id="tspan1063"
411+ sodipodi:role="line"
412+ x="128.32291"
413+ y="72.897926"
414+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332">reject : Recognise c -&gt; Recognise False</tspan><tspan
415+ sodipodi:role="line"
416+ x="128.32291"
417+ y="78.18959"
418+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
419+ id="tspan1073">Negative lookahead. Never consumes input.</tspan><tspan
420+ sodipodi:role="line"
421+ x="128.32291"
422+ y="83.481262"
423+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
424+ id="tspan1075" /><tspan
425+ id="tspan1065"
426+ sodipodi:role="line"
427+ x="128.32291"
428+ y="88.772926"
429+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.52777767px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332" /><tspan
430+ id="tspan1067"
431+ sodipodi:role="line"
432+ x="128.32291"
433+ y="94.06459"
434+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332" /></text>
435+ <path
436+ sodipodi:nodetypes="cc"
437+ inkscape:connector-curvature="0"
438+ id="path1081"
439+ d="M 124.35416,89.83125 76.99375,94.858333"
440+ style="fill:none;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
441+ inkscape:export-xdpi="61.120499"
442+ inkscape:export-ydpi="61.120499" />
443+ <path
444+ style="fill:none;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
445+ d="M 123.82499,66.01875 112.97708,86.391666"
446+ id="path1083"
447+ inkscape:connector-curvature="0"
448+ sodipodi:nodetypes="cc"
449+ inkscape:export-xdpi="61.120499"
450+ inkscape:export-ydpi="61.120499" />
451+ <path
452+ sodipodi:nodetypes="cc"
453+ inkscape:connector-curvature="0"
454+ id="path1091"
455+ d="M 33.33749,59.139583 20.90208,76.337499"
456+ style="fill:none;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
457+ inkscape:export-xdpi="61.120499"
458+ inkscape:export-ydpi="61.120499" />
459+ <path
460+ style="fill:none;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
461+ d="M 113.77082,51.73125 42.068747,83.481249"
462+ id="path1093"
463+ inkscape:connector-curvature="0"
464+ sodipodi:nodetypes="cc"
465+ inkscape:export-xdpi="61.120499"
466+ inkscape:export-ydpi="61.120499" />
467+ <rect
468+ y="94.064583"
469+ x="129.64583"
470+ height="27.51667"
471+ width="78.316658"
472+ id="rect899"
473+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
474+ inkscape:export-xdpi="61.120499"
475+ inkscape:export-ydpi="61.120499" />
476+ </g>
477+</svg>
docs/image/solve.pngnew file

Binary file not shown.

docs/image/solve.svgnew file+163
@@ -0,0 +1,163 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3+
4+<svg
5+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6+ xmlns:cc="http://creativecommons.org/ns#"
7+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8+ xmlns:svg="http://www.w3.org/2000/svg"
9+ xmlns="http://www.w3.org/2000/svg"
10+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12+ width="210mm"
13+ height="297mm"
14+ viewBox="0 0 210 297"
15+ version="1.1"
16+ id="svg8"
17+ inkscape:version="0.92.2 5c3e80d, 2017-08-06"
18+ sodipodi:docname="solve.svg">
19+ <defs
20+ id="defs2">
21+ <marker
22+ inkscape:isstock="true"
23+ style="overflow:visible;"
24+ id="marker838"
25+ refX="0.0"
26+ refY="0.0"
27+ orient="auto"
28+ inkscape:stockid="Arrow1Mend">
29+ <path
30+ transform="scale(0.4) rotate(180) translate(10,0)"
31+ style="fill-rule:evenodd;stroke:#0000ff;stroke-width:1pt;stroke-opacity:1;fill:#0000ff;fill-opacity:1"
32+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
33+ id="path836" />
34+ </marker>
35+ <marker
36+ inkscape:stockid="Arrow1Mend"
37+ orient="auto"
38+ refY="0.0"
39+ refX="0.0"
40+ id="Arrow1Mend"
41+ style="overflow:visible;"
42+ inkscape:isstock="true"
43+ inkscape:collect="always">
44+ <path
45+ id="path4529"
46+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
47+ style="fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1;fill:#ff0000;fill-opacity:1"
48+ transform="scale(0.4) rotate(180) translate(10,0)" />
49+ </marker>
50+ </defs>
51+ <sodipodi:namedview
52+ id="base"
53+ pagecolor="#ffffff"
54+ bordercolor="#666666"
55+ borderopacity="1.0"
56+ inkscape:pageopacity="0.0"
57+ inkscape:pageshadow="2"
58+ inkscape:zoom="1"
59+ inkscape:cx="313.5"
60+ inkscape:cy="696.5"
61+ inkscape:document-units="mm"
62+ inkscape:current-layer="layer1"
63+ showgrid="false"
64+ inkscape:window-width="1920"
65+ inkscape:window-height="1015"
66+ inkscape:window-x="0"
67+ inkscape:window-y="0"
68+ inkscape:window-maximized="1" />
69+ <metadata
70+ id="metadata5">
71+ <rdf:RDF>
72+ <cc:Work
73+ rdf:about="">
74+ <dc:format>image/svg+xml</dc:format>
75+ <dc:type
76+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
77+ <dc:title />
78+ </cc:Work>
79+ </rdf:RDF>
80+ </metadata>
81+ <g
82+ inkscape:label="Layer 1"
83+ inkscape:groupmode="layer"
84+ id="layer1">
85+ <rect
86+ style="fill:#ffff00;fill-opacity:1;stroke-width:0.26458332"
87+ id="rect22"
88+ width="31.75"
89+ height="5.5562501"
90+ x="70.114571"
91+ y="114.96667"
92+ inkscape:export-xdpi="61.120499"
93+ inkscape:export-ydpi="61.120499" />
94+ <text
95+ id="text16"
96+ y="118.67083"
97+ x="72.231262"
98+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
99+ xml:space="preserve"
100+ inkscape:export-xdpi="61.120499"
101+ inkscape:export-ydpi="61.120499"><tspan
102+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332"
103+ y="118.67083"
104+ x="72.231262"
105+ id="tspan14"
106+ sodipodi:role="line">Prelude.Nat.Z </tspan></text>
107+ <text
108+ id="text20"
109+ y="110.99791"
110+ x="82.814583"
111+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
112+ xml:space="preserve"
113+ inkscape:export-xdpi="61.120499"
114+ inkscape:export-ydpi="61.120499"><tspan
115+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ff0000;stroke-width:0.26458332"
116+ y="110.99791"
117+ x="82.814583"
118+ id="tspan18"
119+ sodipodi:role="line">solve</tspan></text>
120+ <path
121+ style="fill:none;stroke:#ff0000;stroke-width:0.5291667;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Mend)"
122+ d="m 80.668481,106.30075 -0.0032,7.57492"
123+ id="path4518"
124+ inkscape:connector-curvature="0"
125+ sodipodi:nodetypes="cc"
126+ inkscape:export-xdpi="61.120499"
127+ inkscape:export-ydpi="61.120499" />
128+ <text
129+ inkscape:export-ydpi="61.120499"
130+ inkscape:export-xdpi="61.120499"
131+ xml:space="preserve"
132+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
133+ x="56.620823"
134+ y="93.006248"
135+ id="text832"><tspan
136+ sodipodi:role="line"
137+ id="tspan830"
138+ x="56.620823"
139+ y="93.006248"
140+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#0000ff;stroke-width:0.26458332">focus</tspan></text>
141+ <path
142+ inkscape:export-ydpi="61.120499"
143+ inkscape:export-xdpi="61.120499"
144+ sodipodi:nodetypes="cc"
145+ inkscape:connector-curvature="0"
146+ id="path834"
147+ d="m 57.649725,94.659084 -0.0032,5.458256"
148+ style="fill:none;stroke:#0000ff;stroke-width:0.5291667;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker838)" />
149+ <text
150+ inkscape:export-ydpi="61.120499"
151+ inkscape:export-xdpi="61.120499"
152+ xml:space="preserve"
153+ style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
154+ x="56.356247"
155+ y="104.91254"
156+ id="text842"><tspan
157+ sodipodi:role="line"
158+ id="tspan840"
159+ x="56.356247"
160+ y="104.91254"
161+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.26458332">?{hole} ≈ Prelude.Nat.Z . {hole}</tspan></text>
162+ </g>
163+</svg>
docs/image/tokenise.pngnew file

Binary file not shown.

docs/image/tokenise.svgnew file+740
@@ -0,0 +1,740 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3+
4+<svg
5+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6+ xmlns:cc="http://creativecommons.org/ns#"
7+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8+ xmlns:svg="http://www.w3.org/2000/svg"
9+ xmlns="http://www.w3.org/2000/svg"
10+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12+ width="210mm"
13+ height="297mm"
14+ viewBox="0 0 210 297"
15+ version="1.1"
16+ id="svg8"
17+ inkscape:version="0.92.2 5c3e80d, 2017-08-06"
18+ sodipodi:docname="tokenise.svg">
19+ <defs
20+ id="defs2">
21+ <marker
22+ inkscape:isstock="true"
23+ style="overflow:visible;"
24+ id="marker7119"
25+ refX="0.0"
26+ refY="0.0"
27+ orient="auto"
28+ inkscape:stockid="Arrow1Mend">
29+ <path
30+ transform="scale(0.4) rotate(180) translate(10,0)"
31+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
32+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
33+ id="path7117" />
34+ </marker>
35+ <marker
36+ inkscape:stockid="Arrow1Mend"
37+ orient="auto"
38+ refY="0.0"
39+ refX="0.0"
40+ id="marker4031"
41+ style="overflow:visible;"
42+ inkscape:isstock="true"
43+ inkscape:collect="always">
44+ <path
45+ id="path4029"
46+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
47+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
48+ transform="scale(0.4) rotate(180) translate(10,0)" />
49+ </marker>
50+ <marker
51+ inkscape:isstock="true"
52+ style="overflow:visible;"
53+ id="marker1931"
54+ refX="0.0"
55+ refY="0.0"
56+ orient="auto"
57+ inkscape:stockid="Arrow1Mend"
58+ inkscape:collect="always">
59+ <path
60+ transform="scale(0.4) rotate(180) translate(10,0)"
61+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
62+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
63+ id="path1929" />
64+ </marker>
65+ <marker
66+ inkscape:stockid="Arrow1Mend"
67+ orient="auto"
68+ refY="0.0"
69+ refX="0.0"
70+ id="Arrow1Mend"
71+ style="overflow:visible;"
72+ inkscape:isstock="true"
73+ inkscape:collect="always">
74+ <path
75+ id="path1036"
76+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
77+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
78+ transform="scale(0.4) rotate(180) translate(10,0)" />
79+ </marker>
80+ </defs>
81+ <sodipodi:namedview
82+ id="base"
83+ pagecolor="#ffffff"
84+ bordercolor="#666666"
85+ borderopacity="1.0"
86+ inkscape:pageopacity="0.0"
87+ inkscape:pageshadow="2"
88+ inkscape:zoom="1"
89+ inkscape:cx="497.48698"
90+ inkscape:cy="885.5"
91+ inkscape:document-units="mm"
92+ inkscape:current-layer="layer1"
93+ showgrid="false"
94+ inkscape:window-width="1920"
95+ inkscape:window-height="1015"
96+ inkscape:window-x="0"
97+ inkscape:window-y="0"
98+ inkscape:window-maximized="1" />
99+ <metadata
100+ id="metadata5">
101+ <rdf:RDF>
102+ <cc:Work
103+ rdf:about="">
104+ <dc:format>image/svg+xml</dc:format>
105+ <dc:type
106+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
107+ <dc:title></dc:title>
108+ </cc:Work>
109+ </rdf:RDF>
110+ </metadata>
111+ <g
112+ inkscape:label="Layer 1"
113+ inkscape:groupmode="layer"
114+ id="layer1">
115+ <rect
116+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
117+ id="rect815"
118+ width="4.3310161"
119+ height="4.3471913"
120+ x="61.383358"
121+ y="51.995804"
122+ inkscape:export-xdpi="61.120499"
123+ inkscape:export-ydpi="61.120499" />
124+ <text
125+ xml:space="preserve"
126+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
127+ x="62.917812"
128+ y="55.649193"
129+ id="text819"
130+ inkscape:export-xdpi="61.120499"
131+ inkscape:export-ydpi="61.120499"><tspan
132+ sodipodi:role="line"
133+ id="tspan817"
134+ x="62.917812"
135+ y="55.649193"
136+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">i</tspan></text>
137+ <rect
138+ y="51.995804"
139+ x="65.714371"
140+ height="4.3471913"
141+ width="4.3310161"
142+ id="rect823"
143+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
144+ inkscape:export-xdpi="61.120499"
145+ inkscape:export-ydpi="61.120499" />
146+ <text
147+ id="text827"
148+ y="55.307304"
149+ x="66.760414"
150+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
151+ xml:space="preserve"
152+ inkscape:export-xdpi="61.120499"
153+ inkscape:export-ydpi="61.120499"><tspan
154+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
155+ y="55.307304"
156+ x="66.760414"
157+ id="tspan825"
158+ sodipodi:role="line">n</tspan></text>
159+ <rect
160+ y="51.995804"
161+ x="70.045387"
162+ height="4.3471913"
163+ width="4.3310161"
164+ id="rect829"
165+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
166+ inkscape:export-xdpi="61.120499"
167+ inkscape:export-ydpi="61.120499" />
168+ <text
169+ id="text833"
170+ y="55.063095"
171+ x="71.237953"
172+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
173+ xml:space="preserve"
174+ inkscape:export-xdpi="61.120499"
175+ inkscape:export-ydpi="61.120499"><tspan
176+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
177+ y="55.063095"
178+ x="71.237953"
179+ id="tspan831"
180+ sodipodi:role="line">p</tspan></text>
181+ <rect
182+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
183+ id="rect835"
184+ width="4.3310161"
185+ height="4.3471913"
186+ x="74.376404"
187+ y="51.995804"
188+ inkscape:export-xdpi="61.120499"
189+ inkscape:export-ydpi="61.120499" />
190+ <text
191+ xml:space="preserve"
192+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
193+ x="75.422447"
194+ y="55.356148"
195+ id="text839"
196+ inkscape:export-xdpi="61.120499"
197+ inkscape:export-ydpi="61.120499"><tspan
198+ sodipodi:role="line"
199+ id="tspan837"
200+ x="75.422447"
201+ y="55.356148"
202+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">u</tspan></text>
203+ <rect
204+ y="51.995804"
205+ x="78.70742"
206+ height="4.3471913"
207+ width="4.3310161"
208+ id="rect841"
209+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
210+ inkscape:export-xdpi="61.120499"
211+ inkscape:export-ydpi="61.120499" />
212+ <text
213+ id="text845"
214+ y="55.649193"
215+ x="80.241875"
216+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
217+ xml:space="preserve"
218+ inkscape:export-xdpi="61.120499"
219+ inkscape:export-ydpi="61.120499"><tspan
220+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
221+ y="55.649193"
222+ x="80.241875"
223+ id="tspan843"
224+ sodipodi:role="line">t</tspan></text>
225+ <rect
226+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
227+ id="rect847"
228+ width="4.3310161"
229+ height="4.3471913"
230+ x="83.038437"
231+ y="51.995804"
232+ inkscape:export-xdpi="61.120499"
233+ inkscape:export-ydpi="61.120499" />
234+ <text
235+ xml:space="preserve"
236+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
237+ x="59.172871"
238+ y="88.457558"
239+ id="text851"><tspan
240+ sodipodi:role="line"
241+ id="tspan849"
242+ x="59.172871"
243+ y="92.350197"
244+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none" /></text>
245+ <rect
246+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
247+ id="rect853"
248+ width="4.3310161"
249+ height="4.3471913"
250+ x="87.369453"
251+ y="51.995804"
252+ inkscape:export-xdpi="61.120499"
253+ inkscape:export-ydpi="61.120499" />
254+ <text
255+ xml:space="preserve"
256+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
257+ x="88.46434"
258+ y="55.453827"
259+ id="text857"
260+ inkscape:export-xdpi="61.120499"
261+ inkscape:export-ydpi="61.120499"><tspan
262+ sodipodi:role="line"
263+ id="tspan855"
264+ x="88.46434"
265+ y="55.453827"
266+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">s</tspan></text>
267+ <rect
268+ y="51.995804"
269+ x="91.70047"
270+ height="4.3471913"
271+ width="4.3310161"
272+ id="rect859"
273+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
274+ inkscape:export-xdpi="61.120499"
275+ inkscape:export-ydpi="61.120499" />
276+ <text
277+ id="text863"
278+ y="55.649193"
279+ x="93.234924"
280+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
281+ xml:space="preserve"
282+ inkscape:export-xdpi="61.120499"
283+ inkscape:export-ydpi="61.120499"><tspan
284+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
285+ y="55.649193"
286+ x="93.234924"
287+ id="tspan861"
288+ sodipodi:role="line">t</tspan></text>
289+ <rect
290+ y="51.995804"
291+ x="96.031487"
292+ height="4.3471913"
293+ width="4.3310161"
294+ id="rect865"
295+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
296+ inkscape:export-xdpi="61.120499"
297+ inkscape:export-ydpi="61.120499" />
298+ <text
299+ id="text869"
300+ y="55.649193"
301+ x="97.565941"
302+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
303+ xml:space="preserve"
304+ inkscape:export-xdpi="61.120499"
305+ inkscape:export-ydpi="61.120499"><tspan
306+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
307+ y="55.649193"
308+ x="97.565941"
309+ id="tspan867"
310+ sodipodi:role="line">r</tspan></text>
311+ <rect
312+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
313+ id="rect871"
314+ width="4.3310161"
315+ height="4.3471913"
316+ x="100.3625"
317+ y="51.995804"
318+ inkscape:export-xdpi="61.120499"
319+ inkscape:export-ydpi="61.120499" />
320+ <text
321+ xml:space="preserve"
322+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
323+ x="101.89697"
324+ y="55.649193"
325+ id="text875"
326+ inkscape:export-xdpi="61.120499"
327+ inkscape:export-ydpi="61.120499"><tspan
328+ sodipodi:role="line"
329+ id="tspan873"
330+ x="101.89697"
331+ y="55.649193"
332+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">i</tspan></text>
333+ <rect
334+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
335+ id="rect877"
336+ width="4.3310161"
337+ height="4.3471913"
338+ x="104.69353"
339+ y="51.995804"
340+ inkscape:export-xdpi="61.120499"
341+ inkscape:export-ydpi="61.120499" />
342+ <text
343+ xml:space="preserve"
344+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
345+ x="105.73955"
346+ y="55.50267"
347+ id="text881"
348+ inkscape:export-xdpi="61.120499"
349+ inkscape:export-ydpi="61.120499"><tspan
350+ sodipodi:role="line"
351+ id="tspan879"
352+ x="105.73955"
353+ y="55.50267"
354+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">n</tspan></text>
355+ <rect
356+ y="51.995804"
357+ x="109.0245"
358+ height="4.3471913"
359+ width="4.3310161"
360+ id="rect883"
361+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
362+ inkscape:export-xdpi="61.120499"
363+ inkscape:export-ydpi="61.120499" />
364+ <text
365+ id="text887"
366+ y="54.965416"
367+ x="110.21709"
368+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
369+ xml:space="preserve"
370+ inkscape:export-xdpi="61.120499"
371+ inkscape:export-ydpi="61.120499"><tspan
372+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
373+ y="54.965416"
374+ x="110.21709"
375+ id="tspan885"
376+ sodipodi:role="line">g</tspan></text>
377+ <text
378+ xml:space="preserve"
379+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
380+ x="125.67681"
381+ y="55.359386"
382+ id="text893"
383+ inkscape:export-xdpi="61.120499"
384+ inkscape:export-ydpi="61.120499"><tspan
385+ sodipodi:role="line"
386+ id="tspan891"
387+ x="125.67681"
388+ y="55.359386"
389+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">:String</tspan></text>
390+ <rect
391+ y="51.995804"
392+ x="113.35551"
393+ height="4.3471913"
394+ width="4.3310161"
395+ id="rect895"
396+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
397+ inkscape:export-xdpi="61.120499"
398+ inkscape:export-ydpi="61.120499" />
399+ <text
400+ id="text899"
401+ y="55.50267"
402+ x="114.40154"
403+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
404+ xml:space="preserve"><tspan
405+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
406+ y="59.395306"
407+ x="114.40154"
408+ id="tspan897"
409+ sodipodi:role="line" /></text>
410+ <rect
411+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#0000ff;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
412+ id="rect901"
413+ width="4.3310161"
414+ height="4.3471913"
415+ x="117.68649"
416+ y="51.995804"
417+ inkscape:export-xdpi="61.120499"
418+ inkscape:export-ydpi="61.120499" />
419+ <text
420+ xml:space="preserve"
421+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
422+ x="118.87907"
423+ y="55.494583"
424+ id="text905"
425+ inkscape:export-xdpi="61.120499"
426+ inkscape:export-ydpi="61.120499"><tspan
427+ sodipodi:role="line"
428+ id="tspan903"
429+ x="118.87907"
430+ y="55.494583"
431+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">1</tspan></text>
432+ <g
433+ id="g950"
434+ transform="translate(-15.319488,0.319156)"
435+ inkscape:export-xdpi="61.120499"
436+ inkscape:export-ydpi="61.120499">
437+ <rect
438+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
439+ id="rect907"
440+ width="11.990757"
441+ height="4.3471909"
442+ x="47.978806"
443+ y="69.310013" />
444+ <text
445+ xml:space="preserve"
446+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
447+ x="48.706326"
448+ y="72.963402"
449+ id="text911"><tspan
450+ sodipodi:role="line"
451+ id="tspan909"
452+ x="48.706326"
453+ y="72.963402"
454+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">token</tspan></text>
455+ <rect
456+ y="69.310013"
457+ x="59.969563"
458+ height="4.2674026"
459+ width="10.075821"
460+ id="rect913"
461+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
462+ <text
463+ id="text917"
464+ y="72.940666"
465+ x="61.015606"
466+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
467+ xml:space="preserve"><tspan
468+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
469+ y="72.940666"
470+ x="61.015606"
471+ id="tspan915"
472+ sodipodi:role="line">line</tspan></text>
473+ <rect
474+ y="69.389801"
475+ x="70.045387"
476+ height="4.1876144"
477+ width="7.5225825"
478+ id="rect919"
479+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
480+ <text
481+ id="text923"
482+ y="72.935829"
483+ x="70.998589"
484+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
485+ xml:space="preserve"><tspan
486+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
487+ y="72.935829"
488+ x="70.998589"
489+ id="tspan921"
490+ sodipodi:role="line">col</tspan></text>
491+ </g>
492+ <text
493+ id="text927"
494+ y="80.971657"
495+ x="40.541954"
496+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
497+ xml:space="preserve"
498+ inkscape:export-xdpi="61.120499"
499+ inkscape:export-ydpi="61.120499"><tspan
500+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.23333311px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
501+ y="80.971657"
502+ x="40.541954"
503+ sodipodi:role="line"
504+ id="tspan933">:(List (TokenData Token), Int, Int, String)</tspan></text>
505+ <g
506+ id="g970"
507+ transform="translate(16.596112,0.319156)"
508+ inkscape:export-xdpi="61.120499"
509+ inkscape:export-ydpi="61.120499">
510+ <rect
511+ y="69.310013"
512+ x="47.978806"
513+ height="4.3471909"
514+ width="11.990757"
515+ id="rect952"
516+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
517+ <text
518+ id="text956"
519+ y="72.963402"
520+ x="48.706326"
521+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
522+ xml:space="preserve"><tspan
523+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
524+ y="72.963402"
525+ x="48.706326"
526+ id="tspan954"
527+ sodipodi:role="line">token</tspan></text>
528+ <rect
529+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
530+ id="rect958"
531+ width="10.075821"
532+ height="4.2674026"
533+ x="59.969563"
534+ y="69.310013" />
535+ <text
536+ xml:space="preserve"
537+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
538+ x="61.015606"
539+ y="72.940666"
540+ id="text962"><tspan
541+ sodipodi:role="line"
542+ id="tspan960"
543+ x="61.015606"
544+ y="72.940666"
545+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">line</tspan></text>
546+ <rect
547+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
548+ id="rect964"
549+ width="7.5225825"
550+ height="4.1876144"
551+ x="70.045387"
552+ y="69.389801" />
553+ <text
554+ xml:space="preserve"
555+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
556+ x="70.998589"
557+ y="72.935829"
558+ id="text968"><tspan
559+ sodipodi:role="line"
560+ id="tspan966"
561+ x="70.998589"
562+ y="72.935829"
563+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">col</tspan></text>
564+ </g>
565+ <g
566+ transform="translate(48.591501,0.319156)"
567+ id="g990"
568+ inkscape:export-xdpi="61.120499"
569+ inkscape:export-ydpi="61.120499">
570+ <rect
571+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
572+ id="rect972"
573+ width="11.990757"
574+ height="4.3471909"
575+ x="47.978806"
576+ y="69.310013" />
577+ <text
578+ xml:space="preserve"
579+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
580+ x="48.706326"
581+ y="72.963402"
582+ id="text976"><tspan
583+ sodipodi:role="line"
584+ id="tspan974"
585+ x="48.706326"
586+ y="72.963402"
587+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">token</tspan></text>
588+ <rect
589+ y="69.310013"
590+ x="59.969563"
591+ height="4.2674026"
592+ width="10.075821"
593+ id="rect978"
594+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
595+ <text
596+ id="text982"
597+ y="72.940666"
598+ x="61.015606"
599+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
600+ xml:space="preserve"><tspan
601+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
602+ y="72.940666"
603+ x="61.015606"
604+ id="tspan980"
605+ sodipodi:role="line">line</tspan></text>
606+ <rect
607+ y="69.389801"
608+ x="70.045387"
609+ height="4.1876144"
610+ width="7.5225825"
611+ id="rect984"
612+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
613+ <text
614+ id="text988"
615+ y="72.935829"
616+ x="70.998589"
617+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
618+ xml:space="preserve"><tspan
619+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
620+ y="72.935829"
621+ x="70.998589"
622+ id="tspan986"
623+ sodipodi:role="line">col</tspan></text>
624+ </g>
625+ <path
626+ style="fill:none;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
627+ d="m 125.97308,68.549658 1.30238,0.0089 -0.0153,6.481345 h -1.30803"
628+ id="path992"
629+ inkscape:connector-curvature="0"
630+ sodipodi:nodetypes="cccc"
631+ inkscape:export-xdpi="61.120499"
632+ inkscape:export-ydpi="61.120499" />
633+ <path
634+ sodipodi:nodetypes="cccc"
635+ inkscape:connector-curvature="0"
636+ id="path994"
637+ d="m 32.561899,68.619523 -1.30238,0.0089 0.0153,6.481345 h 1.30803"
638+ style="fill:none;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
639+ inkscape:export-xdpi="61.120499"
640+ inkscape:export-ydpi="61.120499" />
641+ <rect
642+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
643+ id="rect996"
644+ width="11.990757"
645+ height="4.3471909"
646+ x="155.60759"
647+ y="69.899559"
648+ inkscape:export-xdpi="61.120499"
649+ inkscape:export-ydpi="61.120499" />
650+ <text
651+ xml:space="preserve"
652+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
653+ x="156.33508"
654+ y="73.552948"
655+ id="text1000"
656+ inkscape:export-xdpi="61.120499"
657+ inkscape:export-ydpi="61.120499"><tspan
658+ sodipodi:role="line"
659+ id="tspan998"
660+ x="156.33508"
661+ y="73.552948"
662+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none">string</tspan></text>
663+ <rect
664+ y="69.750786"
665+ x="130.3979"
666+ height="4.2674026"
667+ width="10.075821"
668+ id="rect1002"
669+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
670+ inkscape:export-xdpi="61.120499"
671+ inkscape:export-ydpi="61.120499" />
672+ <text
673+ id="text1006"
674+ y="73.381439"
675+ x="131.44394"
676+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
677+ xml:space="preserve"
678+ inkscape:export-xdpi="61.120499"
679+ inkscape:export-ydpi="61.120499"><tspan
680+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
681+ y="73.381439"
682+ x="131.44394"
683+ id="tspan1004"
684+ sodipodi:role="line">line</tspan></text>
685+ <rect
686+ y="69.830574"
687+ x="143.64868"
688+ height="4.1876144"
689+ width="7.5225825"
690+ id="rect1008"
691+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:0.97596154;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
692+ inkscape:export-xdpi="61.120499"
693+ inkscape:export-ydpi="61.120499" />
694+ <text
695+ id="text1012"
696+ y="73.376602"
697+ x="144.60188"
698+ style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
699+ xml:space="preserve"
700+ inkscape:export-xdpi="61.120499"
701+ inkscape:export-ydpi="61.120499"><tspan
702+ style="font-size:4.23333311px;stroke-width:0.70555556;stroke-miterlimit:4;stroke-dasharray:none"
703+ y="73.376602"
704+ x="144.60188"
705+ id="tspan1010"
706+ sodipodi:role="line">col</tspan></text>
707+ <path
708+ style="fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow1Mend)"
709+ d="m 58.415342,69.700595 -0.143613,-5.887785 4.912582,-0.06048 0.03784,-6.371998"
710+ id="path1025"
711+ inkscape:connector-curvature="0"
712+ sodipodi:nodetypes="cccc"
713+ inkscape:export-xdpi="61.120499"
714+ inkscape:export-ydpi="61.120499" />
715+ <path
716+ inkscape:connector-curvature="0"
717+ id="path1927"
718+ d="m 89.918872,69.996556 -0.02264,-12.07186"
719+ style="fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1931)"
720+ sodipodi:nodetypes="cc"
721+ inkscape:export-xdpi="61.120499"
722+ inkscape:export-ydpi="61.120499" />
723+ <path
724+ sodipodi:nodetypes="cccc"
725+ style="fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker4031)"
726+ d="m 122.08751,69.519138 -0.0832,-5.464386 -2.3456,-0.06048 -0.20406,-6.674425"
727+ id="path4027"
728+ inkscape:connector-curvature="0"
729+ inkscape:export-xdpi="61.120499"
730+ inkscape:export-ydpi="61.120499" />
731+ <path
732+ inkscape:connector-curvature="0"
733+ id="path7115"
734+ d="m 147.18896,69.882051 -0.0832,-5.827299 -22.72919,0 -0.446,-6.251027"
735+ style="fill:none;stroke:#000000;stroke-width:0.70555556;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker7119)"
736+ sodipodi:nodetypes="cccc"
737+ inkscape:export-xdpi="61.120499"
738+ inkscape:export-ydpi="61.120499" />
739+ </g>
740+</svg>
docs/index.rst+3−1
@@ -13,7 +13,7 @@ Documentation for the Idris Language
13 Idris Community* has waived all copyright and related or neighboring
13 Idris Community* has waived all copyright and related or neighboring
14 rights to Documentation for Idris.
14 rights to Documentation for Idris.
15
15
16− More information concerning the CC0 can be found online at: http://creativecommons.org/publicdomain/zero/1.0/
16+ More information concerning the CC0 can be found online at: https://creativecommons.org/publicdomain/zero/1.0/
17
17
18
18
19.. toctree::
19.. toctree::
@@ -24,5 +24,7 @@ Documentation for the Idris Language
24 st/index
24 st/index
25 effects/index
25 effects/index
26 proofs/index
26 proofs/index
27+ elaboratorReflection/index
28+ parserLibrary/index
27 reference/index
29 reference/index
28 guides/index
30 guides/index
docs/listing/idris-prompt-helloworld.txt+2−2
@@ -1,8 +1,8 @@
1$ idris hello.idr
1$ idris hello.idr
2 ____ __ _
2 ____ __ _
3 / _/___/ /____(_)____
3 / _/___/ /____(_)____
4− / // __ / ___/ / ___/ Version 1.3.1
4+ / // __ / ___/ / ___/ Version 1.3.2
5− _/ // /_/ / / / (__ ) http://www.idris-lang.org/
5+ _/ // /_/ / / / (__ ) https://www.idris-lang.org/
6 /___/\__,_/_/ /_/____/ Type :? for help
6 /___/\__,_/_/ /_/____/ Type :? for help
7
7
8Type checking ./hello.idr
8Type checking ./hello.idr
docs/listing/idris-prompt-interp.txt+2−2
@@ -1,8 +1,8 @@
1$ idris interp.idr
1$ idris interp.idr
2 ____ __ _
2 ____ __ _
3 / _/___/ /____(_)____
3 / _/___/ /____(_)____
4− / // __ / ___/ / ___/ Version 1.3.1
4+ / // __ / ___/ / ___/ Version 1.3.2
5− _/ // /_/ / / / (__ ) http://www.idris-lang.org/
5+ _/ // /_/ / / / (__ ) https://www.idris-lang.org/
6 /___/\__,_/_/ /_/____/ Type :? for help
6 /___/\__,_/_/ /_/____/ Type :? for help
7
7
8Type checking ./interp.idr
8Type checking ./interp.idr
docs/listing/idris-prompt-start.txt+2−2
@@ -1,8 +1,8 @@
1$ idris
1$ idris
2 ____ __ _
2 ____ __ _
3 / _/___/ /____(_)____
3 / _/___/ /____(_)____
4− / // __ / ___/ / ___/ Version 1.3.1
4+ / // __ / ___/ / ___/ Version 1.3.2
5− _/ // /_/ / / / (__ ) http://www.idris-lang.org/
5+ _/ // /_/ / / / (__ ) https://www.idris-lang.org/
6/___/\__,_/_/ /_/____/ Type :? for help
6/___/\__,_/_/ /_/____/ Type :? for help
7
7
8Idris>
8Idris>
docs/make.bat+1−1
@@ -65,7 +65,7 @@ if errorlevel 9009 (
65 echo.may add the Sphinx directory to PATH.
65 echo.may add the Sphinx directory to PATH.
66 echo.
66 echo.
67 echo.If you don't have Sphinx installed, grab it from
67 echo.If you don't have Sphinx installed, grab it from
68− echo.http://sphinx-doc.org/
68+ echo.https://www.sphinx-doc.org/
69 exit /b 1
69 exit /b 1
70)
70)
71
71
docs/parserLibrary/index.rstnew file+24
@@ -0,0 +1,24 @@
1+.. _parserLibrary:
2+
3+########################
4+Lexer and Parser Library
5+########################
6+
7+A tutorial on the lexer and parser library in Idris.
8+
9+.. note::
10+
11+ The documentation for Idris has been published under the Creative
12+ Commons CC0 License. As such to the extent possible under law, *The
13+ Idris Community* has waived all copyright and related or neighboring
14+ rights to Documentation for Idris.
15+
16+ More information concerning the CC0 can be found online at: http://creativecommons.org/publicdomain/zero/1.0/
17+
18+.. toctree::
19+ :maxdepth: 1
20+
21+ introduction
22+ lexer
23+ parser
24+ whitespace
docs/parserLibrary/introduction.rstnew file+76
@@ -0,0 +1,76 @@
1+.. _parserLibraryIntro:
2+
3+***************************
4+Parser Library Introduction
5+***************************
6+
7+The parser library can be used to build Idris structures from text. It involves a
8+certain amount of complexity and so it would typically be used for big projects.
9+An example might be a compiler for another language, written in Idris.
10+
11+Of course the parser library can also be used to compile to Idris, this is what
12+is done in Idris 2 and that is what the this library appears to have been
13+written for.
14+
15+So a secondary use for this tutorial would be to help understanding the internal
16+workings of Idris 2.
17+
18+The parser library is used in a similar way to Parsec which is a library for
19+writing parsers in Haskell. It is based on higher-order parser combinators, so a
20+complicated parser can be made out of many smaller ones.
21+
22+.. list-table::
23+
24+ * - This is a two stage process:
25+ - Lexer - This takes the input string and turns it into a list of Tokens.
26+ - Parser - This takes the list of tokens and outputs the code.
27+
28+ - .. image:: ../image/parserTopLevel.png
29+ :width: 307px
30+ :height: 76px
31+ :alt: diagram illustrating these stages of lexer and parser
32+
33+The advantage of using two stages, like this, is that things like whitespace and
34+comments don't need to be considered in every parser rule.
35+
36+The Idris parser library differs from Parsec in that you need to say, in the
37+Recogniser, whether a rule is guaranteed to consume input. This means that the
38+Idris type system prevents the construction of recognisers/rules that can't
39+consume the input.
40+
41+The Lexer is similar but works at the level of characters rather than tokens, and
42+you need to provide a TokenMap which defines how to build a token from
43+a string when a rule is matched.
44+
45+The following pages contain a tutorial for the :ref:`parserLibraryLexer` and a
46+tutorial for the :ref:`parserLibraryParser`. These tutorials have a running
47+example of a parser for integer expressions. This is a very simple example, there
48+may be easier ways to do something so simple, but it illustrates some of the
49+principles.
50+
51+Parser Library and Idris 2
52+--------------------------
53+
54+The parser library, in Idris 1, is almost the same as the code that the Idris 2
55+parser is built on. Even if you only want to use the Idris 1 parser library it
56+is useful to look at the code in the Idris 2 compilers to see how the library
57+can be used.
58+
59+Idris 2 has at least 3 compilers:
60+
61+- IDEMode - complies to SExp which is a Lisp-like structure used to communicate
62+ with external editors like Emacs and Vim.
63+- Idris.Parser - This is the main compiler which compiles from a file to
64+ PTerm (and eventually TT structure).
65+- REPL - compiles input from the command line.
66+
67+The following diagram is my first attempt to work out how some of the modules in
68+Idris 2 fit together (with a few of the dependencies between them shown). The
69+Idris 1 library is based on the modules at the bottom of the diagram (shown
70+in red).
71+
72+.. image:: ../image/parserModules.png
73+ :width: 460px
74+ :height: 496px
75+ :alt: diagram illustrating these stages of lexer and parser
76+
docs/parserLibrary/lexer.rstnew file+288
@@ -0,0 +1,288 @@
1+.. _parserLibraryLexer:
2+
3+Lexer
4+=====
5+
6+The lexer is run by calling the 'lex' function in the Text.Lexer.Core
7+module:
8+
9+.. code-block:: idris
10+
11+ lex : TokenMap a -> String -> (List (TokenData a), (Int, Int, String))
12+
13+.. list-table::
14+
15+ * - This function takes a String and returns a list of tokens. With the
16+ tokens we have indexes back to the original string which can be used
17+ in error messages:
18+
19+ - .. image:: ../image/tokenise.png
20+ :width: 330px
21+ :height: 73px
22+ :alt: diagram illustrating these stages of lexer
23+
24+TokenMap
25+--------
26+
27+In order to construct this list of tokens we need:
28+
29+- A way to recognise the tokens in the input string.
30+- A way to construct these individual tokens.
31+
32+This is given by the TokenMap which is a list of pairs containing
33+this information:
34+
35+.. code-block:: idris
36+
37+ (Lexer, String -> tokenType)
38+
39+So for each Lexer in the list, if a substring in the input matches, run
40+the associated function to produce a token of type ``tokenType``
41+
42+.. list-table::
43+
44+ * - from Text.Lexer.Core
45+ : https://github.com/idris-lang/Idris-dev/blob/master/libs/contrib/Text/Lexer/Core.idr
46+
47+ - .. code-block:: idris
48+
49+ TokenMap : (tokenType : Type) -> Type
50+ TokenMap tokenType = List (Lexer, String -> tokenType)
51+
52+ * - We can create a tokenMap by using a function like this:
53+
54+ - .. code-block:: idris
55+
56+ myTokenMap : TokenMap Token
57+ myTokenMap = [(is 'a',CharLit)]
58+
59+Once we have a TokenMap we can use it to lex many strings.
60+
61+Recognisers
62+-----------
63+
64+The first part of each entry in the TokenMap is the recogniser.
65+
66+A simple recogniser is 'Pred' which uses a predicate (Char -> Bool) to
67+test whether to accept the character. It can be constructed using the
68+'is' function:
69+
70+.. code-block:: idris
71+
72+ *parserEx> is 'a'
73+ Pred (\ARG =>
74+ intToBool (prim__eqChar ARG 'a'))
75+ : Recognise True
76+
77+More complicated structures can be recognised as tokens, this is done using
78+the combinator structure of recognisers. This allows recognisers to be
79+combined, for example,
80+
81+.. list-table::
82+
83+ * - ``<+>`` means sequence two recognisers. If either consumes a character,
84+ the sequence is guaranteed to consume a character.
85+
86+ - .. code-block:: idris
87+
88+ *parserEx> is 'a' <+> is 'b'
89+ SeqEat (Pred (\ARG => intToBool (prim__eqChar ARG 'a')))
90+ (Delay (is 'b')) : Recognise True
91+
92+ * - ``<|>`` means if both consume, the combination is guaranteed
93+ to consumer a character:
94+
95+ - .. code-block:: idris
96+
97+ *parserEx> is 'a' <|> is 'b'
98+ Alt (Pred (\ARG => intToBool (prim__eqChar ARG 'a')))
99+ (Pred (\ARG => intToBool (prim__eqChar ARG 'b')))
100+ : Recognise True
101+
102+This diagram shows the recogniser combinator with some of its constructors:
103+
104+.. image:: ../image/recogniser.png
105+ :width: 487px
106+ :height: 249px
107+ :alt: recogniser data structure
108+
109+A recogniser consumes its input, that is it advances the index to its input
110+string, as it generates the token list. In some cases we don't want this to
111+happen, for instance, we may need to lookahead before consuming the input
112+string.
113+
114+If a recogniser does not consume input there is a danger of an infinite loop.
115+To prevent this the recogniser is dependent on a boolean called 'consumes' which
116+is true if the recogniser is guaranteed to consume at least one character.
117+
118+The constructors of Recognise allow us to ensure that, even though parts of
119+the recogniser may not consume, overall the recogniser will consume.
120+
121+Since 'Recognise True' is more common than 'Recognise False' it is convenient to
122+use 'Lexer' as a type synonym for 'Recognise True'.
123+
124+Whitespace and Comments
125+-----------------------
126+
127+An important reason to have a lexer is to simplify the parser when whitespace
128+or comments are required. Without this the parser would require a match for
129+every combination, with and without, whitespace and comments.
130+
131+In some languages the lexer needs to remove whitespace and comments so that
132+they don't appear in the token list. In some cases whitespace is significant
133+but a single whitespace token can stand for any number of spaces, tabs,
134+carriage returns and so on.
135+
136+In some cases, such as when parsing the Idris language itself, whitespace
137+is important to indicate blocks. In this case we might want to output a
138+start-of-block token when the indent increases and an end-of-block token
139+when the indent decreases.
140+
141+This topic will be discussed more fully on this page
142+:ref:`parserLibraryWhitespace`.
143+
144+Simple Expression Example for Lexer
145+-----------------------------------
146+
147+On this page we will implement a lexer to 'lex' a very simple expression as
148+a running example, on the next page, we will go on to implement a parser for it.
149+
150+First import the lexer and parser code:
151+
152+.. code-block:: idris
153+
154+ module ParserExample
155+
156+ import Text.Lexer
157+ import public Text.Parser.Core
158+ import public Text.Parser
159+
160+Then decide on the tokens that are needed. For this example the idea is to be
161+able to parse simple arithmetic expressions, like this:
162+
163+.. code-block:: idris
164+
165+ 1+(2*3)
166+
167+so we need:
168+
169+- Numbers (for now integer literals are good enough).
170+- Some operators (for now ``+``, ``-`` and ``*`` will do.
171+- Opening and closing Parentheses.
172+
173+We can define these, as tokens, like this:
174+
175+.. code-block:: idris
176+
177+ %default total
178+
179+ public export
180+ data ExpressionToken = Number Integer
181+ | Operator String
182+ | OParen
183+ | CParen
184+ | EndInput
185+
186+It may help with debugging and to implement error messages to
187+implement ``show`` for these tokens:
188+
189+.. code-block:: idris
190+
191+ export
192+ Show ExpressionToken where
193+ show (Number x) = "number " ++ show x
194+ show (Operator x) = "operator " ++ x
195+ show OParen = "("
196+ show CParen = ")"
197+ show EndInput = "end of input"
198+
199+ export
200+ Show (TokenData ExpressionToken) where
201+ show (MkToken l c t) = "line=" ++ show l ++ " col=" ++ show c ++ "tok=" ++ show t
202+
203+The following defines the 'TokenMap' for this example:
204+
205+.. code-block:: idris
206+
207+ ||| integer arithmetic operators plus, minus and multiply.
208+ export
209+ opChars : String
210+ opChars = "+-*"
211+
212+ operator : Lexer
213+ operator = some (oneOf opChars)
214+
215+ toInt' : String -> Integer
216+ toInt' = cast
217+
218+ expressionTokens : TokenMap ExpressionToken
219+ expressionTokens =
220+ [(digits, \x => Number (toInt' x)),
221+ (operator, \x => Operator x),
222+ (is '(' ,\x => OParen),
223+ (is ')' ,\x => CParen)]
224+
225+This specifies the lexer. It gives, for each token, a function to recognise
226+the token type and a function to construct the token.
227+
228+The library module 'Text.Lexer' contains useful functions to help with this.
229+For example, the digits function used above, which reads one or more
230+numeric characters.
231+
232+We can now run the code with various strings to see what output the lexer
233+produces. This is done by calling the 'lex' function with the TokenMap and
234+input string as parameters:
235+
236+.. code-block:: idris
237+
238+ cd Idris-dev/libs/contrib
239+ idris -p contrib parserEx.idr
240+ ____ __ _
241+ / _/___/ /____(_)____
242+ / // __ / ___/ / ___/ Version 1.3.2
243+ _/ // /_/ / / / (__ ) http://www.idris-lang.org/
244+ /___/\__,_/_/ /_/____/ Type :? for help
245+
246+ Idris is free software with ABSOLUTELY NO WARRANTY.
247+ For details type :warranty.
248+ Type checking ./Text/Token.idr
249+ Type checking ./Text/Quantity.idr
250+ Type checking ./Control/Delayed.idr
251+ Type checking ./Data/Bool/Extra.idr
252+ Type checking ./Text/Lexer/Core.idr
253+ Type checking ./Text/Lexer.idr
254+ Type checking ./parserEx.idr
255+
256+ *parserEx> lex expressionTokens "1+2"
257+ ([MkToken 0 0 (Number 1),
258+ MkToken 0
259+ (case fspan (\ARG => not (intToBool (prim__eqChar ARG '\n'))) "1" of
260+ (incol, "") => c + cast (length incol)
261+ (incol, b) => cast (length incol))
262+ (Operator "+"),
263+ MkToken 0
264+ (case fspan (\ARG => not (intToBool (prim__eqChar ARG '\n'))) "+" of
265+ (incol, "") => c + cast (length incol)
266+ (incol, b) => cast (length incol))
267+ (Number 2)],
268+ 0,
269+ case fspan (\ARG => not (intToBool (prim__eqChar ARG '\n'))) "2" of
270+ (incol, "") => c + cast (length incol)
271+ (incol, b) => cast (length incol),
272+ getString (MkStrLen "" 0)) : (List (TokenData ExpressionToken),
273+ Int,
274+ Int,
275+ String)
276+
277+The lexer uses potentially infinite data structures. It has recursive
278+arguments (codata type) so code is lazy. In the output above the indexes
279+have not been computed but we can pick out the tokens:
280+
281+- (Number 1)
282+- (Operator "+")
283+- (Number 2)
284+
285+So the code is working.
286+
287+We can now go ahead and parse this token list. A parser for this example will
288+be constructed on the next page.
docs/parserLibrary/parser.rstnew file+700
@@ -0,0 +1,700 @@
1+.. _parserLibraryParser:
2+
3+Parser
4+======
5+
6+To run the parser we call ``parse``. This requires a grammar and the output
7+from the lexer (which is a list of tokens).
8+
9+.. code-block:: idris
10+
11+ parse : (act : Grammar tok c ty) -> (xs : List tok) ->
12+ Either (ParseError tok) (ty, List tok)
13+
14+If successful this returns 'Right' with a pair of
15+
16+- the parse result.
17+- the unparsed tokens (the remaining input).
18+
19+otherwise it returns 'Left' with the error message.
20+
21+So we need to define the grammar for our parser, this is done using the following
22+'Grammar' data structure. This is a combinator structure, similar in principle
23+to the recogniser combinator for the lexer, which was discussed on the
24+previous page.
25+
26+As with the Recogniser the ``Grammar`` type is dependent on a boolean 'consumes'
27+value which allows us to ensure that complicated ``Grammar`` structures will always
28+consume input.
29+
30+.. code-block:: idris
31+
32+ ||| Description of a language's grammar. The `tok` parameter is the type
33+ ||| of tokens, and the `consumes` flag is True if the language is guaranteed
34+ ||| to be non-empty - that is, successfully parsing the language is guaranteed
35+ ||| to consume some input.
36+ public export
37+ data Grammar : (tok : Type) -> (consumes : Bool) -> Type -> Type where
38+ Empty : (val : ty) -> Grammar tok False ty
39+ Terminal : String -> (tok -> Maybe a) -> Grammar tok True a
40+ NextIs : String -> (tok -> Bool) -> Grammar tok False tok
41+ EOF : Grammar tok False ()
42+
43+ Fail : Bool -> String -> Grammar tok c ty
44+ Commit : Grammar tok False ()
45+ MustWork : Grammar tok c a -> Grammar tok c a
46+
47+ SeqEat : Grammar tok True a -> Inf (a -> Grammar tok c2 b) ->
48+ Grammar tok True b
49+ SeqEmpty : {c1, c2 : Bool} ->
50+ Grammar tok c1 a -> (a -> Grammar tok c2 b) ->
51+ Grammar tok (c1 || c2) b
52+ Alt : {c1, c2 : Bool} ->
53+ Grammar tok c1 ty -> Grammar tok c2 ty ->
54+ Grammar tok (c1 && c2) ty
55+
56+So an example of a grammer type may look something like this:
57+``Grammar (TokenData ExpressionToken) True Integer``.
58+This is a complicated type name and a given parser will need to use it a lot.
59+So to reduce the amount of typing we can use the following type synonym (similar
60+to what is done in Idris 2
61+: https://github.com/edwinb/Idris2/blob/master/src/Parser/Support.idr
62+)
63+
64+.. code-block:: idris
65+
66+ public export
67+ Rule : Type -> Type
68+ Rule ty = Grammar (TokenData ExpressionToken) True ty
69+
70+Parser Example
71+--------------
72+
73+On the previous page we implemented a lexer to 'lex' a very simple expression, on
74+this page we will go on to add a parser for this running example.
75+
76+.. list-table::
77+
78+ * - The syntax we are aiming at is something
79+ like this (expressed in Backus–Naur form (BNF)):
80+ - .. code-block:: idris
81+
82+ <expr> ::= <integer literal>
83+ | <expr>'+'<expr>
84+ | <expr>'-'<expr>
85+ | <expr>'*'<expr>
86+ | '('<expr>')'
87+
88+ <integer literal> ::= <digit>|<integer literal><digit>
89+
90+.. list-table::
91+
92+ * - To start, here is a grammar to parse an integer literal (that is, a
93+ sequence of numeric characters).
94+
95+ - .. code-block:: idris
96+
97+ export
98+ intLiteral : Rule Integer
99+ intLiteral
100+ = terminal (\x => case tok x of
101+ Number i => Just i
102+ _ => Nothing)
103+
104+In order to try this out, here is a temporary function, this calls
105+parse which takes two parameters:
106+
107+- The grammar (in this case intLiteral)
108+- The token list from the lexer.
109+
110+.. code-block:: idris
111+
112+ test1 : String -> Either (ParseError (TokenData ExpressionToken))
113+ (Integer, List (TokenData ExpressionToken))
114+ test1 s = parse intLiteral (fst (lex expressionTokens s))
115+
116+As required, if we pass it a string which is a number literal then it will
117+return the number in the 'Right' option.
118+
119+.. code-block:: idris
120+
121+ *parserEx> test1 "123"
122+ Right (123, []) : Either (ParseError (TokenData ExpressionToken))
123+ (Integer, List (TokenData ExpressionToken))
124+
125+If we pass it a string which is not a number literal then it will return an
126+error message.
127+
128+.. code-block:: idris
129+
130+ *parserEx> test1 "a"
131+ Left (Error "End of input"
132+ []) : Either (ParseError (TokenData ExpressionToken))
133+ (Integer, List (TokenData ExpressionToken))
134+
135+If we pass it a number followed by something else, then it will still be
136+successful, this is because we are not specifically checking for end-of-file.
137+
138+.. code-block:: idris
139+
140+ *parserEx> test1 "123a"
141+ Right (123, []) : Either (ParseError (TokenData ExpressionToken))
142+ (Integer, List (TokenData ExpressionToken))
143+ *parserEx>
144+
145+.. list-table::
146+
147+ * - The ``intLiteral`` function above uses the ``terminal`` function to
148+ construct the grammar
149+ - .. code-block:: idris
150+
151+ ||| Succeeds if running the predicate on the
152+ ||| next token returns Just x, returning x.
153+ ||| Otherwise fails.
154+ export
155+ terminal : (tok -> Maybe a) -> Grammar tok True a
156+ terminal = Terminal
157+
158+This is defined here
159+: https://github.com/idris-lang/Idris-dev/blob/master/libs/contrib/Text/Parser/Core.idr
160+Idris 2 uses a slightly different version which stores an error message like
161+"Expected integer literal" which can be output if the rule fails
162+: https://github.com/edwinb/Idris2/blob/master/src/Text/Parser/Core.idr
163+
164+.. list-table::
165+
166+ * - The 'terminal' function is also used to construct the other
167+ elements of the grammar that we require, for instance,
168+ opening parenthesis:
169+
170+ - .. code-block:: idris
171+
172+ openParen : Rule Integer
173+ openParen = terminal (\x => case tok x of
174+ OParen => Just 0
175+ _ => Nothing)
176+
177+Integer value is not really relevant for parenthesis so ``0`` (zero) is used as
178+a default value.
179+
180+As before, this can be tested with a function like this:
181+
182+.. code-block:: idris
183+
184+ test2 : String -> Either (ParseError (TokenData ExpressionToken))
185+ (Integer, List (TokenData ExpressionToken))
186+ test2 s = parse openParen (fst (lex expressionTokens s))
187+
188+We can see below that it correctly parses an open parenthesis and gives an
189+error for anything else:
190+
191+.. code-block:: idris
192+
193+ *parserEx> test2 "("
194+ Right (0, []) : Either (ParseError (TokenData ExpressionToken))
195+ (Integer, List (TokenData ExpressionToken))
196+ *parserEx> test2 "123"
197+ Left (Error "Unrecognised token"
198+ [MkToken 0
199+ 0
200+ (Number 123)]) : Either (ParseError (TokenData ExpressionToken))
201+ (Integer,
202+ List (TokenData ExpressionToken))
203+
204+Now we have two Grammars we can try combining them. The following test looks
205+for ``openParen`` followed by ``intLiteral``, the two Grammars are combined using
206+``<*>``. The ``map const`` part uses the integer value from the first.
207+
208+The following test is looking for ``(`` followed by a number:
209+
210+.. code-block:: idris
211+
212+ test3 : String -> Either (ParseError (TokenData ExpressionToken))
213+ (Integer, List (TokenData ExpressionToken))
214+ test3 s = parse (map const openParen <*> intLiteral) (fst (lex expressionTokens s))
215+
216+We can see below that ``(`` followed by a number is successfully parsed but, as
217+required, other token lists are not:
218+
219+.. code-block:: idris
220+
221+ *parserEx> test3 "(123"
222+ Right (0, []) : Either (ParseError (TokenData ExpressionToken))
223+ (Integer, List (TokenData ExpressionToken))
224+ *parserEx> test3 "(("
225+ Left (Error "Unrecognised token"
226+ [MkToken 0
227+ (case fspan (\ARG => not (intToBool (prim__eqChar ARG '\n')))
228+ "(" of
229+ (incol, "") => c + cast (length incol)
230+ (incol, b) => cast (length incol))
231+ OParen]) : Either (ParseError (TokenData ExpressionToken))
232+ (Integer, List (TokenData ExpressionToken))
233+
234+ *parserEx> test3 "123"
235+ Left (Error "Unrecognised token"
236+ [MkToken 0
237+ 0
238+ (Number 123)]) : Either (ParseError (TokenData ExpressionToken))
239+ (Integer,
240+ List (TokenData ExpressionToken))
241+ *parserEx> test3 "123("
242+ Left (Error "Unrecognised token"
243+ [MkToken 0 0 (Number 123),
244+ MkToken 0
245+ (case fspan (\ARG => not (intToBool (prim__eqChar ARG '\n')))
246+ "321" of
247+ (incol, "") => c + cast (length incol)
248+ (incol, b) => cast (length incol))
249+ OParen]) : Either (ParseError (TokenData ExpressionToken))
250+ (Integer, List (TokenData ExpressionToken))
251+
252+.. list-table::
253+
254+ * - The closing parenthesis is constructed in the same way.
255+
256+ - .. code-block:: idris
257+
258+ closeParen : Rule Integer
259+ closeParen = terminal (\x => case tok x of
260+ CParen => Just 0
261+ _ => Nothing)
262+
263+.. list-table::
264+
265+ * - Now we can generate a Grammar for an expression inside parenthesis
266+ like this.
267+
268+ - .. code-block:: idris
269+
270+ paren : Rule Integer -> Rule Integer
271+ paren exp = openParen *> exp <* closeParen
272+
273+The use of ``*>`` and ``<*`` instead of ``<*>`` is an easy way to use the integer
274+value from the inner expression.
275+
276+So lets try to use this to define a grammar which recognises either:
277+
278+- An integer literal
279+- An integer literal inside parenthesis
280+- An integer literal inside parenthesis inside parenthesis
281+- ... and so on.
282+
283+.. list-table::
284+
285+ * - This requires a recursively defined structure like this:
286+
287+ - .. code-block:: idris
288+
289+ partial
290+ expr : Rule Integer
291+ expr = intLiteral <|> (paren expr)
292+
293+This is a valid grammar because every time it is called it is guaranteed to
294+consume a token. However, as an Idris structure, it is problematic due to
295+the recursion. Defining it as partial allows it to compile but at runtime
296+we are likely to get a crash with an (unhelpful) error message like
297+``killed by signal 11``.
298+
299+So a better method is to use ``do`` notation as described in the following
300+section.
301+
302+Monadic Combinator
303+------------------
304+
305+In addition to ``<|>`` and ``<*>`` there is a ``>>=`` combinator, which is
306+defined like this:
307+
308+.. code-block:: idris
309+
310+ ||| Sequence two grammars. If either consumes some input, the sequence is
311+ ||| guaranteed to consume some input. If the first one consumes input, the
312+ ||| second is allowed to be recursive (because it means some input has been
313+ ||| consumed and therefore the input is smaller)
314+ export %inline
315+ (>>=) : {c1 : Bool} ->
316+ Grammar tok c1 a ->
317+ inf c1 (a -> Grammar tok c2 b) ->
318+ Grammar tok (c1 || c2) b
319+ (>>=) {c1 = False} = SeqEmpty
320+ (>>=) {c1 = True} = SeqEat
321+
322+.. list-table::
323+
324+ * - This allows us to use ``do`` notation for the previous parenthesis example:
325+
326+ - .. code-block:: idris
327+
328+ expr = intLiteral <|> do
329+ openParen
330+ r <- expr
331+ closeParen
332+ pure r
333+
334+This can be more flexible than using the ``<*>`` operator. Also it is defined
335+using ``Inf`` so we can implement recursively defined grammars as above.
336+
337+Implementing the Arithmetic Operators
338+-------------------------------------
339+
340+.. list-table::
341+
342+ * - Now for the operations, in this case: ``+``, ``-`` and ``*``.
343+ The syntax we require for these infix operators
344+ would require recursive grammars like this:
345+
346+ - .. code-block:: idris
347+
348+ expr = expr (op "+") expr
349+
350+As already explained, ``do`` notation can allow us to use recursive
351+definitions but not necessarily left-recursion like this.
352+
353+In order to work up to this gradually lets start with prefix operators
354+(sometimes known as Polish notation) then modify later for infix operators.
355+
356+.. list-table::
357+
358+ * - So prefix operators would have this sort of form:
359+
360+ - .. code-block:: idris
361+
362+ expr = (add (op "+") expr expr)
363+
364+where ``op`` is defined like this:
365+
366+.. code-block:: idris
367+
368+ ||| Matches if this is an operator token and string matches, that is,
369+ ||| it is the required type of operator.
370+ op : String -> Rule Integer
371+ op s = terminal (\x => case tok x of
372+ (Operator s1) => if s==s1 then Just 0 else Nothing
373+ _ => Nothing)
374+
375+.. list-table::
376+
377+ * - and ``add`` is defined like this:
378+
379+ Where:
380+
381+ - x is the add operator.
382+ - y is the first operand.
383+ - z is the second operand.
384+
385+ - .. code-block:: idris
386+
387+ addInt : Integer -> Integer -> Integer
388+ addInt a b = a+b
389+
390+ export
391+ add : Grammar tok c1 Integer ->
392+ Grammar tok c2 Integer ->
393+ Grammar tok c3 Integer ->
394+ Grammar tok ((c1 || c2) || c3) Integer
395+ add x y z = map addInt (x *> y) <*> z
396+
397+
398+
399+The resulting integer will be the sum of the two operands.
400+
401+.. list-table::
402+
403+ * - The other operators are defined in a similar way:
404+
405+ - .. code-block:: idris
406+
407+ subInt : Integer -> Integer -> Integer
408+ subInt a b = a-b
409+
410+ export
411+ sub : Grammar tok c1 Integer ->
412+ Grammar tok c2 Integer ->
413+ Grammar tok c3 Integer ->
414+ Grammar tok ((c1 || c2) || c3) Integer
415+ sub x y z = map subInt (x *> y) <*> z
416+
417+ multInt : Integer -> Integer -> Integer
418+ multInt a b = a*b
419+
420+ export
421+ mult : Grammar tok c1 Integer ->
422+ Grammar tok c2 Integer ->
423+ Grammar tok c3 Integer ->
424+ Grammar tok ((c1 || c2) || c3) Integer
425+ mult x y z = map multInt (x *> y) <*> z
426+
427+So the top level ``Grammar`` can now be defined as follows. Note that this is
428+partial as it is a potentially infinite structure and so not total.
429+
430+.. code-block:: idris
431+
432+ partial
433+ expr : Rule Integer
434+ expr = (add (op "+") expr expr)
435+ <|> (sub (op "-") expr expr)
436+ <|> (mult (op "*") expr expr)
437+ <|> intLiteral <|> (paren expr)
438+
439+.. list-table::
440+
441+ * - To make the testing easier we can use this function:
442+
443+ - .. code-block:: idris
444+
445+ partial
446+ test : String -> Either (ParseError (TokenData ExpressionToken))
447+ (Integer, List (TokenData ExpressionToken))
448+ test s = parse expr (fst (lex expressionTokens s))
449+
450+.. list-table::
451+
452+ * - First test a valid (prefix) expression:
453+
454+ - .. code-block:: idris
455+
456+ *parserEx> test "+1*6(4)"
457+ Right (25,
458+ []) : Either (ParseError (TokenData ExpressionToken))
459+ (Integer, List (TokenData ExpressionToken))
460+
461+Then an invalid syntax:
462+
463+.. code-block:: idris
464+
465+ *parserEx> test "))"
466+ Left (Error "Unrecognised token"
467+ [MkToken 0 0 CParen,
468+ MkToken 0
469+ (case fspan (\ARG =>
470+ not (intToBool (prim__eqChar ARG
471+ '\n')))
472+ ")" of
473+ (incol, "") => c + cast (length incol)
474+ (incol, b) => cast (length incol))
475+ CParen]) : Either (ParseError (TokenData ExpressionToken))
476+ (Integer,
477+ List (TokenData ExpressionToken))
478+
479+However if we try something that is invalid, but starts with a valid token,
480+then it will return ``Right`` (to indicate success)
481+
482+.. code-block:: idris
483+
484+ *parserEx> test "1))"
485+ Right (1,
486+ [MkToken 0
487+ (case fspan (\ARG =>
488+ not (intToBool (prim__eqChar ARG '\n')))
489+ "1" of
490+ (incol, "") => c + cast (length incol)
491+ (incol, b) => cast (length incol))
492+ CParen,
493+ MkToken 0
494+ (case fspan (\ARG =>
495+ not (intToBool (prim__eqChar ARG '\n')))
496+ ")" of
497+ (incol, "") => c + cast (length incol)
498+ (incol, b) => cast (length incol))
499+ CParen]) : Either (ParseError (TokenData ExpressionToken))
500+ (Integer,
501+ List (TokenData ExpressionToken))
502+
503+Infix Notation
504+--------------
505+
506+So far we have implemented a prefix notation for operators (like this:
507+``+ expr expr``) but the aim is to implemented an infix notation (like this:
508+``expr + expr``). To do this we must be able to deal with potentially
509+infinite data structures (see Codata Types here :ref:`sect-typefuns`).
510+
511+First alter the grammar to have infix operations:
512+
513+.. code-block:: idris
514+
515+ addInt : Integer -> Integer -> Integer
516+ addInt a b = a+b
517+
518+ export
519+ add : Grammar tok c1 Integer ->
520+ Grammar tok c2 Integer ->
521+ Grammar tok c3 Integer ->
522+ Grammar tok ((c1 || c2) || c3) Integer
523+ add x y z = map addInt (x <* y) <*> z
524+
525+ subInt : Integer -> Integer -> Integer
526+ subInt a b = a-b
527+
528+ export
529+ sub : Grammar tok c1 Integer ->
530+ Grammar tok c2 Integer ->
531+ Grammar tok c3 Integer ->
532+ Grammar tok ((c1 || c2) || c3) Integer
533+ sub x y z = map subInt (x <* y) <*> z
534+
535+
536+ multInt : Integer -> Integer -> Integer
537+ multInt a b = a*b
538+
539+ export
540+ mult : Grammar tok c1 Integer ->
541+ Grammar tok c2 Integer ->
542+ Grammar tok c3 Integer ->
543+ Grammar tok ((c1 || c2) || c3) Integer
544+ mult x y z = map multInt (x <* y) <*> z
545+
546+ partial
547+ expr : Rule Integer
548+ expr = (add expr (op "+") expr)
549+ <|> (sub expr (op "-") expr)
550+ <|> (mult expr (op "*") expr)
551+ <|> intLiteral <|> (paren expr)
552+
553+However, if this was run, the code would not terminate.
554+
555+Implement Left Recursion Elimination
556+------------------------------------
557+
558+Left factoring, like this, is a general problem.
559+
560+If we have a rule like this:
561+
562+.. code-block:: idris
563+
564+ A -> (x<*>y) <|> (x<*>z)
565+
566+If ``x<*>y`` fails but ``x<*>z`` would succeed a problem is that, ``x<*>y`` has
567+already consumed ``x``, so now ``x<*>z`` will fail.
568+
569+so we could write code to backtrack. That is ``try`` ``x<*>y`` without consuming
570+so that, if the first token succeeds but the following tokens fail, then the
571+first tokens would not be consumed.
572+
573+Another approach is left factoring:
574+
575+Left Factoring
576+--------------
577+
578+Replace the rule with two rules (that is we add a non-terminal symbol) so
579+for example, instead of:
580+
581+.. code-block:: idris
582+
583+ A -> (x<*>y) <|> (x<*>z)
584+
585+we add an extra rule to give:
586+
587+.. code-block:: idris
588+
589+ A -> x<*>N
590+ N -> y <|> z
591+
592+That is we convert a general context-free grammar to a LL(1) grammar. Although
593+not every context-free grammar can be converted to a LL(1) grammar.
594+
595+This still does not solve the infinite recursion issue and there is another
596+problem: the precedence of the operators ``+``, ``-`` and ``*`` is not explicit.
597+
598+.. list-table::
599+
600+ * - To resolve this we can alter the example to have a BNF like this:
601+ Where braces ``{ ... }`` mean the contents can occur 1 or more times.
602+
603+ - .. code-block:: idris
604+
605+ 'expression' ::= ('+'|'-') 'term' {('+'|'-') 'term'}
606+
607+ 'term' ::= 'factor' {'*' 'factor'}
608+
609+ 'factor' ::=
610+ number
611+ | '(' 'expression' ')'
612+
613+
614+.. code-block:: idris
615+
616+ expr : Rule Integer
617+
618+ factor : Rule Integer
619+ factor = intLiteral <|> do
620+ openParen
621+ r <- expr
622+ closeParen
623+ pure r
624+
625+ term : Rule Integer
626+ term = map multInt factor <*> (
627+ (op "*")
628+ *> factor)
629+ <|> factor
630+
631+ expr = map addInt term <*> (
632+ (op "+")
633+ *> term)
634+ <|> map subInt term <*> (
635+ (op "-")
636+ *> term)
637+ <|> term
638+
639+ calc : String -> Either (ParseError (TokenData ExpressionToken))
640+ (Integer, List (TokenData ExpressionToken))
641+ calc s = parse expr (fst (lex expressionTokens s))
642+
643+ lft : (ParseError (TokenData ExpressionToken)) -> IO ()
644+ lft (Error s lst) = putStrLn ("error:"++s)
645+
646+ rht : (Integer, List (TokenData ExpressionToken)) -> IO ()
647+ rht i = putStrLn ("right " ++ (show i))
648+
649+ main : IO ()
650+ main = do
651+ putStr "alg>"
652+ x <- getLine
653+ either lft rht (calc x) -- eliminator for Either
654+
655+As the following tests show, this now handles infix operators and precedence.
656+
657+.. list-table::
658+
659+ * - For example '*' is an infix operator:
660+
661+ - .. code-block:: idris
662+
663+ *algebraREPL> :exec
664+ alg>2*3
665+ right (6, [])
666+
667+ * - Check that atomic number literals work:
668+
669+ - .. code-block:: idris
670+
671+ *algebraREPL> :exec
672+ alg>2
673+ right (2, [])
674+
675+ * - Check that '*' has a higher precedence than '+'.
676+
677+ - .. code-block:: idris
678+
679+ *algebraREPL> :exec
680+ alg>2+3*4
681+ right (14, [])
682+
683+ * - Also '*' has a higher precedence than '+' when the order is reversed.
684+
685+ - .. code-block:: idris
686+
687+ *algebraREPL> :exec
688+ alg>3*4+2
689+ right (14, [])
690+
691+ * - Also precedence can be overridden by parenthesis.
692+
693+ - .. code-block:: idris
694+
695+ *algebraREPL> :exec
696+ alg>(2+3)*4
697+ right (20, [])
698+
699+This is still not correct because it does not correctly parse multiple sums or terms
700+like ``1+2+3`` or ``1*2*3``.
docs/parserLibrary/whitespace.rstnew file+250
@@ -0,0 +1,250 @@
1+.. _parserLibraryWhitespace:
2+
3+Whitespace and Comments
4+=======================
5+
6+The previous two pages introduced the lexer and parser but have not yet
7+discussed how to handle whitespace and comments.
8+
9+In some grammars whitespace and comments would not be considered significant and
10+so we might be tempted not to generate any tokens for them. However, in the
11+running example, we may want to make spaces significant in the future. For
12+example, we might want to implement function application expressed by
13+juxtaposition as in Haskell and Idris like this: ``f x``.
14+
15+So, on this page, we will add a token for whitespace and comments. We will
16+then consider two ways to process this:
17+
18+- Filter all whitespace tokens from the lexer results before passing to
19+ the parser.
20+- Process the whitespace tokens in the parser.
21+
22+Whitespace and Comments in Lexer
23+--------------------------------
24+
25+To start with we can use the same token for both whitespace and comments. Here
26+it is called ``Comment`` and added to the ``ExpressionToken`` data structure
27+like this:
28+
29+.. code-block:: idris
30+
31+ public export
32+ data ExpressionToken = Number Integer
33+ | Operator String
34+ | OParen
35+ | CParen
36+ | Comment String
37+ | EndInput
38+
39+This is added to the ``TokenMap`` like this:
40+
41+.. code-block:: idris
42+
43+ ||| from https://github.com/edwinb/Idris2/blob/master/src/Parser/Lexer.idr
44+ comment : Lexer
45+ comment = is '-' <+> is '-' <+> many (isNot '\n')
46+
47+ expressionTokens : TokenMap ExpressionToken
48+ expressionTokens =
49+ [(digits, \x => Number (toInt' x)),
50+ (operator, \x => Operator x),
51+ (is '(' ,\x => OParen),
52+ (is ')' ,\x => CParen),
53+ (spaces, Comment),
54+ (comment, Comment)]
55+
56+As you can see, the comment is defined like a single line Idris comment,
57+it starts with ``--`` and continues for the remainder of the line.
58+
59+We don't need to define ``spaces`` because it is already defined in
60+: https://github.com/idris-lang/Idris-dev/blob/master/libs/contrib/Text/Lexer.idr
61+like this:
62+
63+.. code-block:: idris
64+
65+ ||| Recognise a single whitespace character
66+ ||| /\\s/
67+ space : Lexer
68+ space = pred isSpace
69+
70+ ||| Recognise one or more whitespace characters
71+ ||| /\\s+/
72+ spaces : Lexer
73+ spaces = some space
74+
75+If these whitespace tokens are not significant, that is, they can appear
76+anywhere and they are optional then we can filter them out before the parser
77+gets them like this:
78+
79+.. code-block:: idris
80+
81+ processWhitespace : (List (TokenData ExpressionToken), Int, Int, String)
82+ -> (List (TokenData ExpressionToken), Int, Int, String)
83+ processWhitespace (x,l,c,s) = ((filter notComment x),l,c,s) where
84+ notComment : TokenData ExpressionToken -> Bool
85+ notComment t = case tok t of
86+ Comment _ => False
87+ _ => True
88+
89+ calc : String -> Either (ParseError (TokenData ExpressionToken))
90+ (Integer, List (TokenData ExpressionToken))
91+ calc s = parse expr (fst (processWhitespace (lex expressionTokens s)))
92+
93+
94+Whitespace and Comments in Parser
95+---------------------------------
96+
97+If we sometimes require whitespace to be significant then we can't filter
98+them out as above. In this case the ``Comment`` tokens are sent to the parser
99+which now needs to be able to handle them.
100+
101+.. code-block:: idris
102+
103+ commentSpace : Rule Integer
104+ commentSpace = terminal (\x => case tok x of
105+ Comment s => Just 0
106+ _ => Nothing)
107+
108+So far we don't have any syntax that requires spaces to be significant so we
109+need to define the grammar so that it will parse with, or without, spaces.
110+This needs to be done in a systematic way, here I have defined the grammar so
111+that there is an optional space to the right of every atom or operator.
112+First add versions of ``intLiteral`` , ``openParen`` , ``closeParen``
113+and ``op`` that allow optional spaces/comments to the right of them:
114+
115+.. code-block:: idris
116+
117+ intLiteralC : Rule Integer
118+ intLiteralC = (intLiteral <* commentSpace) <|> intLiteral
119+
120+ openParenC : Rule Integer
121+ openParenC = (openParen <* commentSpace) <|> openParen
122+
123+ closeParenC : Rule Integer
124+ closeParenC = (closeParen <* commentSpace) <|> closeParen
125+
126+ ||| like op but followed by optional comment or space
127+ opC : String -> Rule Integer
128+ opC s = ((op s) <* commentSpace) <|> (op s)
129+
130+Then just use these functions instead of the original functions:
131+
132+.. code-block:: idris
133+
134+ expr : Rule Integer
135+
136+ factor : Rule Integer
137+ factor = intLiteralC <|> do
138+ openParenC
139+ r <- expr
140+ closeParenC
141+ pure r
142+
143+ term : Rule Integer
144+ term = map multInt factor <*> (
145+ (opC "*")
146+ *> factor)
147+ <|> factor
148+
149+ expr = map addInt term <*> (
150+ (opC "+")
151+ *> term)
152+ <|> map subInt term <*> (
153+ (opC "-")
154+ *> term)
155+ <|> term
156+
157+ calc : String -> Either (ParseError (TokenData ExpressionToken))
158+ (Integer, List (TokenData ExpressionToken))
159+ calc s = parse expr (fst (lex expressionTokens s))
160+
161+ lft : (ParseError (TokenData ExpressionToken)) -> IO ()
162+ lft (Error s lst) = putStrLn ("error:"++s)
163+
164+ rht : (Integer, List (TokenData ExpressionToken)) -> IO ()
165+ rht i = putStrLn ("right " ++ (show i))
166+
167+ main : IO ()
168+ main = do
169+ putStr "alg>"
170+ x <- getLine
171+ either lft rht (calc x) -- eliminator for Either
172+
173+
174+Defining Block Structure using Indents
175+--------------------------------------
176+
177+Many languages such as Python, Haskell and Idris use indents to delimit
178+the block structure of the language.
179+
180+We can see how Idris2 does it here
181+: https://github.com/edwinb/Idris2/blob/master/src/Parser/Support.idr
182+
183+.. code-block:: idris
184+
185+ export
186+ IndentInfo : Type
187+ IndentInfo = Int
188+
189+ export
190+ init : IndentInfo
191+ init = 0
192+
193+EndInput Token
194+--------------
195+
196+So far, the parser will return a successful result even if the full input
197+is not consumed. To ensure that the top level syntax is fully matched we
198+add a ``EndInput`` token to indicate the last token.
199+
200+``EndInput`` is added to the other tokens like this:
201+
202+.. code-block:: idris
203+
204+ data ExpressionToken = Number Integer
205+ | Operator String
206+ | OParen
207+ | CParen
208+ | Comment String
209+ | EndInput
210+
211+A rule to consume this token is added:
212+
213+.. code-block:: idris
214+
215+ eoi : Rule Integer
216+ eoi = terminal (\x => case tok x of
217+ EndInput => Just 0
218+ _ => Nothing)
219+
220+Instead of using ``expr`` at the top level of the syntax we can now define
221+``exprFull`` as shown here. This will make sure that only when ``EndInput``
222+is consumed will the parse be successful:
223+
224+.. code-block:: idris
225+
226+ exprFull : Rule Integer
227+ exprFull = expr <* eoi
228+
229+The following code makes sure ``EndInput`` is added to the end of the token
230+list:
231+
232+.. code-block:: idris
233+
234+ processWhitespace : (List (TokenData ExpressionToken), Int, Int, String)
235+ -> (List (TokenData ExpressionToken), Int, Int, String)
236+ processWhitespace (x,l,c,s) = ((filter notComment x)++
237+ [MkToken l c EndInput],l,c,s) where
238+ notComment : TokenData ExpressionToken -> Bool
239+ notComment t = case tok t of
240+ Comment _ => False
241+ _ => True
242+
243+All we have to do now is use ``exprFull`` instead of ``expr``:
244+
245+.. code-block:: idris
246+
247+ calc : String -> Either (ParseError (TokenData ExpressionToken))
248+ (Integer, List (TokenData ExpressionToken))
249+ calc s = parse exprFull (fst (processWhitespace (lex expressionTokens s)))
250+
docs/proofs/definitional.rst+17−13
@@ -1,3 +1,7 @@
1+*******************
2+Background Material
3+*******************
4+
1In order to understand how to write proofs in Idris I think its worth clarifying some fundamentals, such as,
5In order to understand how to write proofs in Idris I think its worth clarifying some fundamentals, such as,
2
6
3- Propositions and judgments
7- Propositions and judgments
@@ -65,14 +69,14 @@ is a proposition and it is also a type. This is built into Idris so when an '='
65 2 = 3 : Type
69 2 = 3 : Type
66
70
67Both of these are valid propositions so both are valid equality types. But how do we represent true judgment, that is, how do we denote 1+1=2 is true but not 1+1=3.
71Both of these are valid propositions so both are valid equality types. But how do we represent true judgment, that is, how do we denote 1+1=2 is true but not 1+1=3.
68−A type that is true is inhabited, that is, it can be constructed. An equality type has only on constructor 'Refl' so a proof of 1+1=2 is
72+A type that is true is inhabited, that is, it can be constructed. An equality type has only one constructor 'Refl' so a proof of 1+1=2 is
69
73
70.. code-block:: idris
74.. code-block:: idris
71
75
72 onePlusOne : 1+1=2
76 onePlusOne : 1+1=2
73 onePlusOne = Refl
77 onePlusOne = Refl
74
78
75−So how can Refl, which is a constructor without any parameters, construct and equality type? If we type it on its own then it can't:
79+So how can Refl, which is a constructor without any parameters, construct an equality type? If we type it on its own then it can't:
76
80
77.. code-block:: idris
81.. code-block:: idris
78
82
@@ -95,11 +99,11 @@ So now that we can represent propositions as types other aspects of propositiona
95+----------+-------------------+--------------------------+
99+----------+-------------------+--------------------------+
96| B | y=z | |
100| B | y=z | |
97+----------+-------------------+--------------------------+
101+----------+-------------------+--------------------------+
98−| and | A /\ B | Pair(x=y,y=z) |
102+| and | A /\\ B | ``Pair(x=y,y=z)`` |
99+----------+-------------------+--------------------------+
103+----------+-------------------+--------------------------+
100−| or | A \/ B | Either(x=y,y=z) |
104+| or | A \\/ B | ``Either(x=y,y=z)`` |
101+----------+-------------------+--------------------------+
105+----------+-------------------+--------------------------+
102−| implies | A -> B | (x=y) -> (y=x) |
106+| implies | A -> B | ``(x=y) -> (y=x)`` |
103+----------+-------------------+--------------------------+
107+----------+-------------------+--------------------------+
104| for all | y=z | |
108| for all | y=z | |
105+----------+-------------------+--------------------------+
109+----------+-------------------+--------------------------+
@@ -125,9 +129,9 @@ We can have a type which corresponds to disjunction:
125
129
126.. code-block:: idris
130.. code-block:: idris
127
131
128− data Or : Type -&gt; Type -&gt; Type where
132+ data Or : Type -> Type -> Type where
129− OrIntroLeft : a -&gt; A a b
133+ OrIntroLeft : a -> A a b
130− OrIntroRight : b -&gt; A a b
134+ OrIntroRight : b -> A a b
131
135
132There is a built in type called 'Either'.
136There is a built in type called 'Either'.
133
137
@@ -157,10 +161,10 @@ Especially when working with equalities containing variable terms (inside functi
157
161
158.. code-block:: idris
162.. code-block:: idris
159
163
160− plusReducesL : (n:Nat) -&gt; plus Z n = n
164+ plusReducesL : (n:Nat) -> plus Z n = n
161 plusReducesL n = Refl
165 plusReducesL n = Refl
162
166
163− plusReducesR : (n:Nat) -&gt; plus n Z = n
167+ plusReducesR : (n:Nat) -> plus n Z = n
164 plusReducesR n = Refl
168 plusReducesR n = Refl
165
169
166plusReducesR gives the following error:
170plusReducesR gives the following error:
@@ -202,7 +206,7 @@ In the following pages we discuss how to resolve propositionaly equalies.
202Axiomatic and Constructive Approaches
206Axiomatic and Constructive Approaches
203=====================================
207=====================================
204
208
205−How should we define types so that we can do proofs on them? In the natural numbers with plus example we could have started by treating it as a group based on the plus operator. So we have axioms:
209+How should we define types so that we can do proofs on them? In the natural numbers with the plus example we could have started by treating it as a group based on the plus operator. So we have axioms:
206
210
207- for all x,y : ``x+y=y+x``
211- for all x,y : ``x+y=y+x``
208- for all x: ``x + 0 = x = 0 + x``
212- for all x: ``x + 0 = x = 0 + x``
@@ -215,13 +219,13 @@ These are axioms, that is a propositions/types that are asserted to be true with
215
219
216.. code-block:: idris
220.. code-block:: idris
217
221
218− commutePlus ``postulate``: x -> y -> plus x y = plus y x
222+ postulate commutePlus: (x:Nat) -> (y:Nat) -> plus x y = plus y x
219
223
220Alternatively we could define the natural numbers based on Zero and Successor. The axioms above then become derived rules and we also gain the ability to do inductive proofs.
224Alternatively we could define the natural numbers based on Zero and Successor. The axioms above then become derived rules and we also gain the ability to do inductive proofs.
221
225
222As we know, Idris uses both of these approaches with automatic coercion between them which gives the best of both worlds.
226As we know, Idris uses both of these approaches with automatic coercion between them which gives the best of both worlds.
223
227
224−So what can we learn from this to implement out own types:
228+So what can we learn from this to implement our own types:
225
229
226- Should we try to implement both approaches?
230- Should we try to implement both approaches?
227- Should we define our types by constructing up from primitive types?
231- Should we define our types by constructing up from primitive types?
docs/proofs/index.rst+5−10
@@ -1,8 +1,8 @@
1.. _proofs-index:
1.. _proofs-index:
2
2
3−#########################################
3+###############
4−Theorem Proving and Elaborator Reflection
4+Theorem Proving
5−#########################################
5+###############
6
6
7A tutorial on theorem proving in Idris.
7A tutorial on theorem proving in Idris.
8
8
@@ -13,7 +13,7 @@ A tutorial on theorem proving in Idris.
13 Idris Community* has waived all copyright and related or neighboring
13 Idris Community* has waived all copyright and related or neighboring
14 rights to Documentation for Idris.
14 rights to Documentation for Idris.
15
15
16− More information concerning the CC0 can be found online at: http://creativecommons.org/publicdomain/zero/1.0/
16+ More information concerning the CC0 can be found online at: https://creativecommons.org/publicdomain/zero/1.0/
17
17
18.. toctree::
18.. toctree::
19 :maxdepth: 1
19 :maxdepth: 1
@@ -25,9 +25,4 @@ A tutorial on theorem proving in Idris.
25 propositional
25 propositional
26 interactive
26 interactive
27 interactiveOld
27 interactiveOld
28− elabReflection
28+
29− tactics
30− holes
31− example1
32− primitive
33− generatingData
docs/proofs/interactive.rst+71−20
@@ -4,7 +4,7 @@ Interactive Theorem Proving
4
4
5Idris supports interactive theorem proving via elaborator reflection.
5Idris supports interactive theorem proving via elaborator reflection.
6
6
7−:ref:'elaborator-reflection' is also used to convert high-level Idris code into
7+:ref:`elaborator-reflection` is also used to convert high-level Idris code into
8the core language and for customising the language. Here we show how to use it
8the core language and for customising the language. Here we show how to use it
9to interactively construct proofs.
9to interactively construct proofs.
10
10
@@ -15,15 +15,15 @@ construct proofs as described on this page.
15Elab and Pruviloj Libraries
15Elab and Pruviloj Libraries
16===========================
16===========================
17
17
18−Elaborator reflection is defined in prelude/Language/Reflection/Elab.idr
18+Elaborator reflection is defined in ``prelude/Language/Reflection/Elab.idr``
19−and pruviloj is defined in Idris-dev/libs/pruviloj/
19+and ``pruviloj`` is defined in ``Idris-dev/libs/pruviloj/``.
20
20
21−``Elab`` defines the basics such as: solve, attack, intro, compute,
21+``Elab`` defines the basics such as: ``solve``, ``attack``, ``intro``, ``compute``,
22−rewriteWith and others.
22+``rewriteWith`` and others.
23``pruviloj`` defines some more advanced derived commands such as:
23``pruviloj`` defines some more advanced derived commands such as:
24−reflexivity and others.
24+``reflexivity`` and others.
25
25
26−To use ``pruviloj`` call Idris with the "-p pruviloj" option and add:
26+To use ``pruviloj`` call Idris with the ``-p pruviloj`` option and add:
27
27
28.. code-block:: idris
28.. code-block:: idris
29
29
@@ -34,7 +34,7 @@ to the top of your file.
34
34
35It is useful to get the docs at the REPL by using the ``:doc`` command, and
35It is useful to get the docs at the REPL by using the ``:doc`` command, and
36search the docstrings using ``:apropos``. So to introduce the functions from
36search the docstrings using ``:apropos``. So to introduce the functions from
37−Elab and Pruviloj, that we will need for the following example, here are
37+``Elab`` and ``Pruviloj``, that we will need for the following example, here are
38their docstrings:
38their docstrings:
39
39
40.. code-block:: idris
40.. code-block:: idris
@@ -84,7 +84,7 @@ their docstrings:
84 that the hole be immediately under its binder (use attack if it might
84 that the hole be immediately under its binder (use attack if it might
85 not be).
85 not be).
86
86
87−Here is the command from pruviloj that we will need for the example on
87+Here is the command from ``pruviloj`` that we will need for the example on
88this page:
88this page:
89
89
90.. code-block:: idris
90.. code-block:: idris
@@ -129,18 +129,18 @@ On running , two global names are created, ``plusredZ_Z`` and
129
129
130 . / _/___/ /____(_)____
130 . / _/___/ /____(_)____
131 / // __ / ___/ / ___/ Version 1.2.0
131 / // __ / ___/ / ___/ Version 1.2.0
132− _/ // /_/ / / / (__ ) http://www.idris-lang.org/
132+ _/ // /_/ / / / (__ ) https://www.idris-lang.org/
133 /___/\__,_/_/ /_/____/ Type :? for help
133 /___/\__,_/_/ /_/____/ Type :? for help
134
134
135 Idris is free software with ABSOLUTELY NO WARRANTY.
135 Idris is free software with ABSOLUTELY NO WARRANTY.
136 For details type :warranty.
136 For details type :warranty.
137 Holes: Main.plusredZ_S, Main.plusredZ_Z
137 Holes: Main.plusredZ_S, Main.plusredZ_Z
138
138
139−This tells us that we have two holes Main.plusredZ_S and Main.plusredZ_Z. We can solve
139+This tells us that we have two holes ``Main.plusredZ_S`` and ``Main.plusredZ_Z``. We can solve
140these separately, ``plusredZ_Z`` is the simplest so we will do that first.
140these separately, ``plusredZ_Z`` is the simplest so we will do that first.
141
141
142The ``:elab plusredZ_Z`` command enters interactive elaboration mode, which can be used to
142The ``:elab plusredZ_Z`` command enters interactive elaboration mode, which can be used to
143−complete the missing definition for plusredZ_Z.
143+complete the missing definition for ``plusredZ_Z``.
144
144
145.. code-block:: idris
145.. code-block:: idris
146
146
@@ -150,9 +150,10 @@ complete the missing definition for plusredZ_Z.
150 {hole_0} : 0 = 0
150 {hole_0} : 0 = 0
151
151
152This has been normalised to ``0 = 0`` so now we have to prove that ``0`` equals ``0``, which
152This has been normalised to ``0 = 0`` so now we have to prove that ``0`` equals ``0``, which
153−is easy to prove by reflexivity from the pruviloj library:
153+is easy to prove by ``reflexivity`` from the ``pruviloj`` library:
154
154
155.. code-block:: idris
155.. code-block:: idris
156+
156 -Main.plusredZ_Z> reflexivity
157 -Main.plusredZ_Z> reflexivity
157 plusredZ_Z: No more goals.
158 plusredZ_Z: No more goals.
158
159
@@ -189,7 +190,7 @@ accessible by pattern matching) and ``ih`` — the local variable
189containing the result of the recursive call. We can introduce these as
190containing the result of the recursive call. We can introduce these as
190assumptions using the ``intro`` tactic twice. The parameter is entered as
191assumptions using the ``intro`` tactic twice. The parameter is entered as
191a constant of type ``TTName`` which is entered as a backtick with double
192a constant of type ``TTName`` which is entered as a backtick with double
192−braces `{{ih}}. This gives:
193+braces ```{{ih}}``. This gives:
193
194
194.. code-block:: idris
195.. code-block:: idris
195
196
@@ -222,11 +223,11 @@ like to use this knowledge to replace ``plus k 0`` in the goal with
222 {hole_0} : S k = S k
223 {hole_0} : S k = S k
223
224
224The ``rewriteWith`` tactic takes an equality proof as an argument, and tries
225The ``rewriteWith`` tactic takes an equality proof as an argument, and tries
225−to rewrite the goal using that proof. The ih value is entered as a constant
226+to rewrite the goal using that proof. The ``ih`` value is entered as a constant
226−of type ``TTName`` which is entered as a backtick with double braces `{{ih}} but
227+of type ``TTName`` which is entered as a backtick with double braces ```{{ih}}`` but
227``rewriteWith`` requires an expression of type ``Raw``, rather than just a name,
228``rewriteWith`` requires an expression of type ``Raw``, rather than just a name,
228−so the Var constructor is used to make a variable. Here, it results in an equality
229+so the ``Var`` constructor is used to make a variable. Here, it results in an equality
229−which is trivially provable using reflexivity:
230+which is trivially provable using ``reflexivity``:
230
231
231.. code-block:: idris
232.. code-block:: idris
232
233
@@ -236,10 +237,60 @@ which is trivially provable using reflexivity:
236 Proof completed!
237 Proof completed!
237 Main.plusredZ_S = %runElab (do intro `{{k}}
238 Main.plusredZ_S = %runElab (do intro `{{k}}
238 intro `{{ih}}
239 intro `{{ih}}
239− compute
240 rewriteWith (Var `{{ih}})
240 rewriteWith (Var `{{ih}})
241 reflexivity)
241 reflexivity)
242
242
243−Again, we can cut & paste this into the hole in the original file.
243+We can't just cut & paste this into the hole in the original file like this:
244+
245+.. code-block:: idris
246+
247+ import Pruviloj
248+ import Pruviloj.Induction
249+
250+ %language ElabReflection
251+
252+ plusReducesZ' : (n:Nat) -> n = plus n Z
253+ plusReducesZ' Z = %runElab (do reflexivity)
254+ plusReducesZ' (S k) = let ih = plusReducesZ' k in
255+ (%runElab (do intro `{{k}}
256+ intro `{{ih}}
257+ rewriteWith (Var `{{ih}})
258+ reflexivity)
259+ )
260+
261+because this gives the following error:
262+
263+.. code-block:: idris
264+
265+ Idris> :load elabInteractiveEx2.idr
266+ elabInteractiveEx2.idr:10:32:
267+ |
268+ 10 | intro `{{ih}}
269+ | ^
270+ unexpected "in"
271+ expecting dependent type signature
272+
273+However if we put the proof into a separate function like this:
274+
275+.. code-block:: idris
276+
277+ import Pruviloj
278+ import Pruviloj.Induction
279+
280+ %language ElabReflection
281+
282+ plusredZ_S : (k : Nat) -> (ih:(k = plus k Z)) -> (S k = S (plus k Z))
283+ plusredZ_S = %runElab (do intro `{{k}}
284+ intro `{{ih}}
285+ rewriteWith (Var `{{ih}})
286+ reflexivity)
287+
288+ plusReducesZ' : (n:Nat) -> n = plus n Z
289+ plusReducesZ' Z = %runElab (do reflexivity)
290+ plusReducesZ' (S k) = let ih = plusReducesZ' k in plusredZ_S k ih
291+
292+This then loads [#f1]_ .
293+
294+.. [#f1] https://github.com/idris-lang/Idris-dev/issues/4556
244
295
245.. |image| image:: ../image/plusReducesProof.png
296.. |image| image:: ../image/plusReducesProof.png
docs/proofs/pluscomm.rst+1−1
@@ -182,7 +182,7 @@ interface rather than using ``plus`` directly. They have the names
182
182
183In the remainder of this tutorial, we will explore several different
183In the remainder of this tutorial, we will explore several different
184ways of proving ``plus_commutes`` (or, to put it another way, writing
184ways of proving ``plus_commutes`` (or, to put it another way, writing
185−the function.) We will also discuss how to use such equality proofs, and
185+the function). We will also discuss how to use such equality proofs, and
186see where the need for them arises in practice.
186see where the need for them arises in practice.
187
187
188.. [1]
188.. [1]
docs/proofs/propositional.rst+27−22
@@ -1,19 +1,22 @@
1−This page attempts to explain some of the techniques used in Idris to prove propositional equalities.
1+******************************
2−
3Proving Propositional Equality
2Proving Propositional Equality
4−==============================
3+******************************
4+
5+This page attempts to explain some of the techniques used in Idris to prove propositional equalities.
5
6
6−We have seen that definitional equalities can be proved using Refl since they always normalise to unique values that can be compared directly.
7+We have seen that definitional equalities can be proved using ``Refl`` since they always normalise to unique values that can be compared directly.
7
8
8−However with propositional equalities we are using symbolic variables they do not always normalse.
9+However with propositional equalities we are using symbolic variables they do not always normalise.
9
10
10So to take the previous example:
11So to take the previous example:
11
12
13+.. code-block:: idris
14+
12−plusReducesR : (n:Nat) -> plus n Z = n
15+ plusReducesR : (n:Nat) -> plus n Z = n
13
16
14−In this case 'plus n Z' does not normalise to n. Even though both sides are equal we cannot pattern match Refl.
17+In this case ``plus n Z`` does not normalise to ``n``. Even though both sides are equal we cannot pattern match ``Refl``.
15
18
16−If the pattern match cannot match for all 'n' then the way around this is to separately match all possible values of 'n'. In the case of natural numbers we do this by induction.
19+If the pattern match cannot match for all ``n`` then the way around this is to separately match all possible values of ``n``. In the case of natural numbers we do this by induction.
17
20
18So here:
21So here:
19
22
@@ -24,19 +27,21 @@ So here:
24 plusReducesR {n = (S k)} = let rec = plus_commutes_Z {n=k} in
27 plusReducesR {n = (S k)} = let rec = plus_commutes_Z {n=k} in
25 rewrite rec in Refl
28 rewrite rec in Refl
26
29
27−we don't call Refl to match on 'n = plus n 0' forall 'n' we call it for every number separately. So, in the second line, the pattern matcher knows to substitute Z for n in the type being matched. This uses 'rewrite' which is explained below.
30+we don't call ``Refl`` to match on ``n = plus n 0`` forall ``n`` we call it for every number separately. So, in the second line, the pattern matcher knows to substitute ``Z`` for ``n`` in the type being matched. This uses ``rewrite`` which is explained below.
28
31
29Replace
32Replace
30=======
33=======
31
34
32−This implements the 'indiscernability of identicals' principle, if two terms are equal then they have the same properties. In other words, if x=y, then we can substitute y for x in any expression. In our proofs we can express this as:
35+This implements the *indiscernability of identicals* principle, if two terms are equal then they have the same properties. In other words, if ``x=y``, then we can substitute ``y`` for ``x`` in any expression. In our proofs we can express this as:
36+
37+.. code-block:: idris
33
38
34 if x=y
39 if x=y
35 then P x = P y
40 then P x = P y
36
41
37−where P is a pure function representing the property. In the examples below P is an expression in some variable with a type like this: P: n -> Type
42+where ``P`` is a pure function representing the property. In the examples below ``P`` is an expression in some variable with a type like this: ``P: n -> Type``.
38
43
39−So if n is a natural number variable then P could be something like 2*n + 3.
44+So if ``n`` is a natural number variable then ``P`` could be something like ``2*n + 3``.
40
45
41To use this in our proofs there is the following function in the prelude:
46To use this in our proofs there is the following function in the prelude:
42
47
@@ -46,14 +51,14 @@ To use this in our proofs there is the following function in the prelude:
46 replace : {a:_} -> {x:_} -> {y:_} -> {P : a -> Type} -> x = y -> P x -> P y
51 replace : {a:_} -> {x:_} -> {y:_} -> {P : a -> Type} -> x = y -> P x -> P y
47 replace Refl prf = prf
52 replace Refl prf = prf
48
53
49−Removing the implicits, if we supply an equality (x=y) and a proof of a property of x (P x) then we get a proof of a property of y (P y)
54+Removing the implicits, if we supply an equality ``x=y`` and a proof of a property of ``x`` (i.e. ``P x``) then we get a proof of a property of ``y`` (i.e. ``P y``)
50
55
51.. code-block:: idris
56.. code-block:: idris
52
57
53 > :t replace
58 > :t replace
54 replace : (x = y) -> P x -> P y
59 replace : (x = y) -> P x -> P y
55
60
56−So, in the following example, if we supply p1 x which is a proof that x=2 and the equality x=y then we get a proof that y=2.
61+So, in the following example, if we supply ``p1 x`` which is a proof that ``x=2`` and the equality ``x=y`` then we get a proof that ``y=2``.
57
62
58.. code-block:: idris
63.. code-block:: idris
59
64
@@ -66,16 +71,16 @@ So, in the following example, if we supply p1 x which is a proof that x=2 and th
66Rewrite
71Rewrite
67=======
72=======
68
73
69−Similar to 'replace' above but Idris provides a nicer syntax which makes 'rewrite' easier to use in examples like plusReducesR above.
74+Similar to ``replace`` above but Idris provides a nicer syntax which makes ``rewrite`` easier to use in examples like ``plusReducesR`` above.
70
75
71.. code-block:: idris
76.. code-block:: idris
72
77
73 rewrite__impl : (P : a -> Type) -> x = y -> P y -> P x
78 rewrite__impl : (P : a -> Type) -> x = y -> P y -> P x
74 rewrite__impl p Refl prf = prf
79 rewrite__impl p Refl prf = prf
75
80
76−The difference from 'replace' above is nicer syntax and the property p1 is explicitly supplied and it goes in the opposite direction (input and output reversed).
81+The difference from ``replace`` above is nicer syntax and the property ``p1`` is explicitly supplied and it goes in the opposite direction (input and output reversed).
77
82
78−Example: again we supply p1 which is a proof that x=2 and the equality x=y then we get a proof that y=2.
83+Example: again we supply ``p1`` which is a proof that ``x=2`` and the equality ``x=y`` then we get a proof that ``y=2``.
79
84
80.. code-block:: idris
85.. code-block:: idris
81
86
@@ -87,16 +92,16 @@ Example: again we supply p1 which is a proof that x=2 and the equality x=y then
87
92
88We can think of rewrite doing this:
93We can think of rewrite doing this:
89
94
90− * Start with a equation x=y and a property P: x -> Type
95+ * start with a equation ``x=y`` and a property ``P: x -> Type``;
91− * Searches y in P
96+ * search ``y`` in ``P``;
92− * Replaces all occurrences of y with x in P.
97+ * replace all occurrences of ``y`` with ``x`` in ``P``.
93
98
94That is, we are doing a substitution.
99That is, we are doing a substitution.
95
100
96Symmetry and Transitivity
101Symmetry and Transitivity
97=========================
102=========================
98
103
99−In addition to 'reflexivity' equality also obeys 'symmetry' and 'transitivity' and these are also included in the prelude:
104+In addition to *reflexivity* equality also obeys *symmetry* and *transitivity* and these are also included in the prelude:
100
105
101.. code-block:: idris
106.. code-block:: idris
102
107
@@ -111,7 +116,7 @@ In addition to 'reflexivity' equality also obeys 'symmetry' and 'transitivity' a
111Heterogeneous Equality
116Heterogeneous Equality
112======================
117======================
113
118
114−Also included in the prelude:
119+Also included in the prelude:
115
120
116.. code-block:: idris
121.. code-block:: idris
117
122
docs/reference/codegen.rst+13−4
@@ -1,3 +1,5 @@
1+.. _code-generation-targets:
2+
1************************
3************************
2Code Generation Targets
4Code Generation Targets
3************************
5************************
@@ -16,6 +18,13 @@ Official Backends
16C Language
18C Language
17----------
19----------
18
20
21+The default target of Idris is C. In order to view the generated C code, compile via:
22+
23+::
24+
25+ $ idris hello.idr -S -o hello.c
26+
27+
19Javascript
28Javascript
20----------
29----------
21
30
@@ -27,10 +36,10 @@ issue the following command:
27 $ idris --codegen javascript hello.idr -o hello.js
36 $ idris --codegen javascript hello.idr -o hello.js
28
37
29
38
30−Idris can produce very big chunks of JavaScript code (hello world
39+Idris can produce big chunks of JavaScript code (hello world weighs in at about
31−weighs in at 1500 lines). However, the generated code can be minified
40+60 lines). However, the generated code can be minified using the
32−using the `closure-compiler
33−<https://developers.google.com/closure/compiler/>`__ from Google.
41+`closure-compiler <https://developers.google.com/closure/compiler/>`__ from
42+Google.
34
43
35::
44::
36
45
docs/reference/compilation.rst+15−15
@@ -54,7 +54,7 @@ by setting a verbosity level.
54 Checking, and the individual steps prior to code generation.
54 Checking, and the individual steps prior to code generation.
55
55
56
56
57−By default Idris' progress reporting is set to quiet-``-q``, or ``--quiet``.
57+By default Idris' progress reporting is set to quiet: ``-q``, or ``--quiet``.
58
58
59Logging Internal Operation
59Logging Internal Operation
60===========================
60===========================
@@ -100,32 +100,32 @@ Environment Variables
100Several paths set by default within the Idris compiler can be
100Several paths set by default within the Idris compiler can be
101overridden through environment variables. The provided variables are:
101overridden through environment variables. The provided variables are:
102
102
103−* `IDRIS_CC` Change the `C` compiler used by the `C` backend.
103+* ``IDRIS_CC`` Change the *C compiler* used by the *C backend*.
104−* `IDRIS_CFLAGS` Change the `C` flags passed to the `C` compiler.
104+* ``IDRIS_CFLAGS`` Change the *C flags* passed to the *C compiler*.
105−* `TARGET` Change the target directory i.e. `data dir` where Idris installs files when installing using Cabal/Stack.
105+* ``TARGET`` Change the target directory i.e. *data dir* where Idris installs files when installing using Cabal/Stack.
106−* `IDRIS_LIBRARY_PATH` Change the location of where installed packages are found/installed.
106+* ``IDRIS_LIBRARY_PATH`` Change the location of where installed packages are found/installed.
107−* `IDRIS_DOC_PATH` Change the location of where generated idrisdoc for packages are installed.
107+* ``IDRIS_DOC_PATH`` Change the location of where generated idrisdoc for packages are installed.
108
108
109.. note::
109.. note::
110
110
111 In versions of Idris prior to 0.12.3 the environment variables
111 In versions of Idris prior to 0.12.3 the environment variables
112− `IDRIS_LIBRARY_PATH` and `TARGET` were both used to affect the
112+ ``IDRIS_LIBRARY_PATH`` and ``TARGET`` were both used to affect the
113 installation of single packages and direct where Idris installed
113 installation of single packages and direct where Idris installed
114 its data. The meaning of these variables has changed, and command
114 its data. The meaning of these variables has changed, and command
115 line options are preferred when changing where individual packages
115 line options are preferred when changing where individual packages
116 are installed.
116 are installed.
117
117
118−The CLI option `--ibcsubdir` can be used to direct where generated IBC
118+The CLI option ``--ibcsubdir`` can be used to direct where generated IBC
119files are placed. However, this means Idris will install files in a
119files are placed. However, this means Idris will install files in a
120non-standard location separate from the rest of the installed
120non-standard location separate from the rest of the installed
121−packages. The CLI option `--idrispath <dir>` allows you to add a
121+packages. The CLI option ``--idrispath <dir>`` allows you to add a
122directory to the library search path; this option can be used multiple
122directory to the library search path; this option can be used multiple
123−times and can be shortened to `-i <dir>`. Similary, the `--sourcepath
123+times and can be shortened to ``-i <dir>``. Similary, the ``--sourcepath
124−<dir>` option can be used to add directories to the source search
124+<dir>`` option can be used to add directories to the source search
125−path. There is no shortened version for this option as `-s` is a
125+path. There is no shortened version for this option as ``-s`` is a
126reserved flag.
126reserved flag.
127
127
128Further, Idris also supports options to augment the paths used, and
128Further, Idris also supports options to augment the paths used, and
129−pass options to the code generator backend. The option `--cg-opt
129+pass options to the code generator backend. The option ``--cg-opt
130−<ARG>` can be used to pass options to the code generator. The format
130+<ARG>`` can be used to pass options to the code generator. The format
131−of `<ARG>` is dependent on the selected backend.
131+of ``<ARG>`` is dependent on the selected backend.
docs/reference/erasure.rst+3−3
@@ -254,7 +254,7 @@ Benchmarks
254==========
254==========
255
255
256- source: https://github.com/ziman/idris-benchmarks
256- source: https://github.com/ziman/idris-benchmarks
257−- results: http://ziman.functor.sk/erasure-bm/
257+- results: https://ziman.functor.sk/erasure-bm/
258
258
259It can be clearly seen that asymptotics are improved by erasure.
259It can be clearly seen that asymptotics are improved by erasure.
260
260
@@ -269,7 +269,7 @@ Usage warnings are quite bad and unhelpful at the moment. We should
269include more information and at least translate argument numbers to
269include more information and at least translate argument numbers to
270their names.
270their names.
271
271
272−There is no decent documentation yet. This wiki page is the first one.
272+There is no decent documentation yet. This page is the first one.
273
273
274There is no generally accepted terminology. We switch between
274There is no generally accepted terminology. We switch between
275"dotted", "unused", "erased", "irrelevant", "inaccessible", while each
275"dotted", "unused", "erased", "irrelevant", "inaccessible", while each
@@ -499,4 +499,4 @@ References
499
499
500.. [BMM04] Edwin Brady, Conor McBride, James McKinna: `Inductive
500.. [BMM04] Edwin Brady, Conor McBride, James McKinna: `Inductive
501 families need not store their indices
501 families need not store their indices
502− <http://citeseerx.ist.psu.edu/viewdoc/summary;jsessionid=1F796FCF0F2C4C535FC70F62BE2FB821?doi=10.1.1.62.3849>`__
502+ <https://citeseerx.ist.psu.edu/viewdoc/summary;jsessionid=1F796FCF0F2C4C535FC70F62BE2FB821?doi=10.1.1.62.3849>`__
docs/reference/ffi.rst+10−7
@@ -121,12 +121,14 @@ Linking foreign code
121This is the example of linking C code.
121This is the example of linking C code.
122
122
123.. code-block:: idris
123.. code-block:: idris
124+
124 %include C "mylib.h"
125 %include C "mylib.h"
125 %link C "mylib.o"
126 %link C "mylib.o"
126
127
127Example Makefile
128Example Makefile
128
129
129.. code-block:: shell
130.. code-block:: shell
131+
130 DEFAULT: mylib.o main.idr
132 DEFAULT: mylib.o main.idr
131 idris main.idr -o executableFile
133 idris main.idr -o executableFile
132
134
@@ -202,9 +204,10 @@ unable to pass the closed-over values through C. If we want to pass Idris values
202to the callback we have to pass them through C explicitly. Non-primitive Idris
204to the callback we have to pass them through C explicitly. Non-primitive Idris
203values can be passed to C via the ``Raw`` type.
205values can be passed to C via the ``Raw`` type.
204
206
205−The other big limitation is that it doesn't support IO functions. Use
207+The other big limitation is that it doesn't support ``IO`` functions. Use
206−``unsafePerformIO`` to wrap them (i.e. to make an IO function usable as a callback, change the return type
208+``unsafePerformIO`` to wrap them (i.e. to make an ``IO`` function usable as a
209+callback, change the return type from ``IO r`` to ``r``, and change the ``= do``
207−from IOr to r, and change the = do to = unsafePerformIO $ do).
210+to ``= unsafePerformIO $ do``).
208
211
209There are two special function names:
212There are two special function names:
210``%wrapper`` returns the function pointer that wraps an Idris function. This
213``%wrapper`` returns the function pointer that wraps an Idris function. This
@@ -256,7 +259,7 @@ useful to access constants that are preprocessor definitions (like ``INT_MAX``).
256 main = print !intMax
259 main = print !intMax
257
260
258For more complicated interactions with C (such as reading and setting fields
261For more complicated interactions with C (such as reading and setting fields
259−of a C struct), there is a module CFFI available in the contrib package.
262+of a C ``struct``), there is a module C FFI available in the contrib package.
260
263
261C heap
264C heap
262------
265------
@@ -369,7 +372,7 @@ Usage from C code
369The ``Raw`` type constructor allows you to access or return a runtime
372The ``Raw`` type constructor allows you to access or return a runtime
370representation of the value. For instance, if you want to copy a string
373representation of the value. For instance, if you want to copy a string
371generated from C code into an Idris value, you may want to return a
374generated from C code into an Idris value, you may want to return a
372−``Raw String``instead of a ``String`` and use ``MKSTR`` or ``MKSTRlen`` to
375+``Raw String`` instead of a ``String`` and use ``MKSTR`` or ``MKSTRlen`` to
373copy it over.
376copy it over.
374
377
375.. code-block:: idris
378.. code-block:: idris
@@ -382,7 +385,7 @@ copy it over.
382 const VAL get_string ()
385 const VAL get_string ()
383 {
386 {
384 char * c_string = get_string_allocated_with_malloc()
387 char * c_string = get_string_allocated_with_malloc()
385− const VAL idris_string = MKSTR(c_string);
388+ const VAL idris_string = MKSTR(get_vm(), c_string);
386 free(c_string);
389 free(c_string);
387 return idris_string
390 return idris_string
388 }
391 }
@@ -391,7 +394,7 @@ FFI implementation
391------------------
394------------------
392
395
393In order to write bindings to external libraries, the details of how
396In order to write bindings to external libraries, the details of how
394−``foreign`` works are unnecessary --- you simply need to know that
397+``foreign`` works are unnecessary: you simply need to know that
395``foreign`` takes an FFI descriptor, the function name, and its
398``foreign`` takes an FFI descriptor, the function name, and its
396type. It is instructive to look a little deeper, however:
399type. It is instructive to look a little deeper, however:
397
400
docs/reference/index.rst+1−2
@@ -14,7 +14,7 @@ This will tell you how Idris works, for using it you should read the Idris Tutor
14 Idris Community* has waived all copyright and related or neighboring
14 Idris Community* has waived all copyright and related or neighboring
15 rights to Documentation for Idris.
15 rights to Documentation for Idris.
16
16
17− More information concerning the CC0 can be found online at: http://creativecommons.org/publicdomain/zero/1.0/
17+ More information concerning the CC0 can be found online at: https://creativecommons.org/publicdomain/zero/1.0/
18
18
19
19
20.. toctree::
20.. toctree::
@@ -36,7 +36,6 @@ This will tell you how Idris works, for using it you should read the Idris Tutor
36 internals
36 internals
37 language-features
37 language-features
38 language-extensions
38 language-extensions
39− elaborator-reflection
40 type-directed-search
39 type-directed-search
41 partial-evaluation
40 partial-evaluation
42 misc
41 misc
docs/reference/internals.rst+31−28
@@ -10,8 +10,8 @@ free to contribute.
10This document assumes that you are already familiar with Idris. It is
10This document assumes that you are already familiar with Idris. It is
11intended for those who want to work on the internals.
11intended for those who want to work on the internals.
12
12
13−People looking to develop new back ends may want to look at [[Idris back
13+People looking to develop new back ends may want to look at
14−end IRs\|Idris-back-end-IRs]]
14+:ref:`code-generation-targets`
15
15
16Core/TT.hs
16Core/TT.hs
17==========
17==========
@@ -53,7 +53,7 @@ with ``SC`` and ``CaseAlt`` to get GHC to generate a function for
53mapping over contained terms.
53mapping over contained terms.
54
54
55Constructor cases (``ConCase`` in ``CaseAlt``) refer to numbered
55Constructor cases (``ConCase`` in ``CaseAlt``) refer to numbered
56−constructors. Every constructor is numbered 0,1,2,…. At this stage in
56+constructors. Every constructor is numbered *0,1,2,…*. At this stage in
57the compiler, the tags are datatype-local. After defunctionalization,
57the compiler, the tags are datatype-local. After defunctionalization,
58however, they are made globally unique.
58however, they are made globally unique.
59
59
@@ -91,12 +91,12 @@ dictionary which makes totality checking easier.
91The ``normalise*`` functions give different behaviors - but
91The ``normalise*`` functions give different behaviors - but
92``normalise`` is the most common.
92``normalise`` is the most common.
93
93
94−``normaliseC`` - "resolved" means with names converted to de Bruijn
94+- ``normaliseC`` - "resolved" means with names converted to de Bruijn
95−indices as appropriate.
95+ indices as appropriate;
96
96
97−``normaliseAll`` - reduce everything, even if it's non-total
97+- ``normaliseAll`` - reduce everything, even if it's non-total;
98
98
99−``normaliseTrace`` - special-purpose for debugging
99+- ``normaliseTrace`` - special-purpose for debugging.
100
100
101``simplify`` - reduce the things that are small - the list argument is
101``simplify`` - reduce the things that are small - the list argument is
102the things to not reduce.
102the things to not reduce.
@@ -110,8 +110,8 @@ Core/Elaborate.hs
110=================
110=================
111
111
112Idris definitions are elaborated one by one and turned into the
112Idris definitions are elaborated one by one and turned into the
113−corresponding TT. This is done with a tactic language as an EDSL in the
113+corresponding ``TT``. This is done with a tactic language as an EDSL in the
114−Elab monad (or Elab' when there's a custom state).
114+``Elab`` monad (or ``Elab'`` when there's a custom state).
115
115
116Lots of plumbing for errors.
116Lots of plumbing for errors.
117
117
@@ -122,17 +122,17 @@ The string in the pair returned by elaborate is log information.
122See JFP paper, but the names don't necessarily map to each other. The
122See JFP paper, but the names don't necessarily map to each other. The
123paper is the "idealized version" without logging, additional state, etc.
123paper is the "idealized version" without logging, additional state, etc.
124
124
125−All the tactics take Raws, typechecking happens there.
125+All the tactics take ``Raw`` s, typechecking happens there.
126
126
127−claim (x : t) assumes a new x : t.
127+``claim (x : t)`` assumes a new ``x : t``.
128
128
129PLEASE TIDY THINGS UP!
129PLEASE TIDY THINGS UP!
130
130
131−proofSearch flag to try' is whether the failure came from a human (so
131+``proofSearch`` flag is to try whether the failure came from a human (so
132fail) or from a machine (so continue)
132fail) or from a machine (so continue)
133
133
134−Idris-level syntax for providing alternatives explicitly: (\| x, y, z
134+Idris-level syntax for providing alternatives explicitly: ``(| x, y, z
135−\|) try x, y, z in order, and take the first that succeeds.
135+|)`` try ``x``, ``y``, ``z`` in order, and take the first that succeeds.
136
136
137Core/ProofState.hs
137Core/ProofState.hs
138==================
138==================
@@ -140,37 +140,40 @@ Core/ProofState.hs
140Core/Unify.hs
140Core/Unify.hs
141=============
141=============
142
142
143−Deals with unification. Unification can reply with: - this works - this
143+Deals with unification. Unification can reply with:
144−can never work - this will work if these other unification problems work
145−out (eg unifying f x with 1)
146
144
145+- this works
146+- this can never work
147+- this will work if these other unification problems work out (e.g.
148+ unifying ``f x`` with ``1``)
149+
147−match\_unify: same thing as unification except it's just matching name
150+``match_unify``: same thing as unification except it's just matching name
148−against name, term against term. x + y matches to 0 + y with x = 0. Used
151+against name, term against term. ``x + y`` matches to ``0 + y`` with
149−for <== syntax as well as type class resolution.
152+``x = 0``. Used for ``<==`` syntax as well as type class resolution.
150
153
151Idris/AbsSyntaxTree.hs
154Idris/AbsSyntaxTree.hs
152======================
155======================
153
156
154−PTerm is the datatype of Idris syntax. P is for Program. Each PTerm
157+``PTerm`` is the datatype of Idris syntax. ``P`` is for *Program*.
155−turns into a TT term by applying a series of tactics.
158+Each ``PTerm`` turns into a TT term by applying a series of tactics.
156
159
157−IState is the major interpreter state. The global context is the
160+``IState`` is the major interpreter state. The global context is the
158−tt\_ctxt field.
161+``tt_ctxt`` field.
159
162
160−Ctxt maps possibly ambiguous names to their referents.
163+``Ctxt`` maps possibly ambiguous names to their referents.
161
164
162Idris/ElabDecls.hs
165Idris/ElabDecls.hs
163==================
166==================
164
167
165−This is where the actual elaboration from PTerm to TT happens.
168+This is where the actual elaboration from ``PTerm`` to ``TT`` happens.
166
169
167Idris/ElabTerm.hs
170Idris/ElabTerm.hs
168=================
171=================
169
172
170−build is the function that creates a Raw. All the "junk" is to deal with
173+``build`` is the function that creates a ``Raw``. All the "junk" is to deal with
171things like metavars and so forth. It has to remember what names are
174things like metavars and so forth. It has to remember what names are
172still to be defined, and it doesn't yet know the type (filled in by
175still to be defined, and it doesn't yet know the type (filled in by
173unificaiton later). Also case expressions have to turn into top-level
176unificaiton later). Also case expressions have to turn into top-level
174functions.
177functions.
175
178
176−resolveTC is type class resolution.
179+``resolveTC`` is type class resolution.
docs/reference/language-extensions.rst+8−3
@@ -3,13 +3,12 @@ Language Extensions
3*******************
3*******************
4
4
5
5
6−
7Type Providers
6Type Providers
8===============
7===============
9
8
10Idris type providers are a way to get the type system to reflect
9Idris type providers are a way to get the type system to reflect
11observations about the world outside of Idris. Similarly to `F# type
10observations about the world outside of Idris. Similarly to `F# type
12−providers <http://msdn.microsoft.com/en-us/library/vstudio/hh156509.aspx>`__,
11+providers <https://msdn.microsoft.com/en-us/library/vstudio/hh156509.aspx>`__,
13they cause effectful computations to run during type checking, returning
12they cause effectful computations to run during type checking, returning
14information that the type checker can use when checking the rest of the
13information that the type checker can use when checking the rest of the
15program. While F# type providers are based on code generation, Idris
14program. While F# type providers are based on code generation, Idris
@@ -32,5 +31,11 @@ to the user.
32Example Idris type providers can be seen at `this
31Example Idris type providers can be seen at `this
33repository <https://github.com/david-christiansen/idris-type-providers>`__.
32repository <https://github.com/david-christiansen/idris-type-providers>`__.
34More detailed descriptions are available in David Christiansen's `WGP
33More detailed descriptions are available in David Christiansen's `WGP
35−'13 paper <http://dx.doi.org/10.1145/2502488.2502495>`__ and `M.Sc.
34+'13 paper <https://dx.doi.org/10.1145/2502488.2502495>`__ and `M.Sc.
36thesis <http://itu.dk/people/drc/david-christiansen-thesis.pdf>`__.
35thesis <http://itu.dk/people/drc/david-christiansen-thesis.pdf>`__.
36+
37+Elaborator Reflection
38+=====================
39+
40+Another way to extend the language is elaborator reflection which is described
41+in the :ref:`elaborator-index` section.
docs/reference/misc.rst+5−5
@@ -115,11 +115,11 @@ Here is an example:
115 import Syntax.PreorderReasoning
115 import Syntax.PreorderReasoning
116 multThree : (a, b, c : Nat) -> a * b * c = c * a * b
116 multThree : (a, b, c : Nat) -> a * b * c = c * a * b
117 multThree a b c =
117 multThree a b c =
118− (a * b * c) ={ sym (multAssociative a b c) }=
118+ (a * b * c) ={ sym (multAssociative a b c) }=
119− (a * (b * c)) ={ cong (multCommutative b c) }=
119+ (a * (b * c)) ={ cong (multCommutative b c) }=
120− (a * (c * b)) ={ multAssociative a c b }=
120+ (a * (c * b)) ={ multAssociative a c b }=
121− (a * c * b) ={ cong {f = (* b)} (multCommutative a c) }=
121+ (a * c * b) ={ cong {f = (* b)} (multCommutative a c) }=
122− (c * a * b) QED
122+ (c * a * b) QED
123
123
124Note that the parentheses are required -- only a simple expression can
124Note that the parentheses are required -- only a simple expression can
125be on the left of ``={ }=`` or ``QED``. Also, when using preorder
125be on the left of ``={ }=`` or ``QED``. Also, when using preorder
docs/reference/packages.rst+1−1
@@ -24,7 +24,7 @@ comma separated list of modules. For example, a library test which
24has two modules ``foo.idr`` and ``bar.idr`` as source files would be
24has two modules ``foo.idr`` and ``bar.idr`` as source files would be
25written as follows::
25written as follows::
26
26
27− package foo
27+ package test
28
28
29 modules = foo, bar
29 modules = foo, bar
30
30
docs/reference/partial-evaluation.rst+2−2
@@ -8,7 +8,7 @@ of functions with arguments annotated as ``%static``.
8
8
9(This is an implementation of the partial evaluator described in `this
9(This is an implementation of the partial evaluator described in `this
10ICFP 2010
10ICFP 2010
11−paper <http://eb.host.cs.st-andrews.ac.uk/writings/icfp10.pdf>`__.
11+paper <https://eb.host.cs.st-andrews.ac.uk/writings/icfp10.pdf>`__.
12Please refer to this for more precise definitions of what follows.)
12Please refer to this for more precise definitions of what follows.)
13
13
14Partial evaluation is switched off by default since Idris 1.0. It can
14Partial evaluation is switched off by default since Idris 1.0. It can
@@ -207,7 +207,7 @@ Specialising Interpreters
207A particularly useful situation where partial evaluation becomes
207A particularly useful situation where partial evaluation becomes
208effective is in defining an interpreter for a well-typed expression
208effective is in defining an interpreter for a well-typed expression
209language, defined as follows (see the `Idris tutorial, section
209language, defined as follows (see the `Idris tutorial, section
210−4 <http://eb.host.cs.st-andrews.ac.uk/writings/idris-tutorial.pdf>`__
210+4 <https://eb.host.cs.st-andrews.ac.uk/writings/idris-tutorial.pdf>`__
211for more details on how this works):
211for more details on how this works):
212
212
213::
213::
docs/reference/type-directed-search.rst+1−1
@@ -4,7 +4,7 @@ Type Directed Search ``:search``
4
4
5Idris' ``:search`` command searches for terms according to their
5Idris' ``:search`` command searches for terms according to their
6approximate type signature (much like
6approximate type signature (much like
7−`Hoogle <http://www.haskell.org/hoogle/>`__ for Haskell). For
7+`Hoogle <https://www.haskell.org/hoogle/>`__ for Haskell). For
8example::
8example::
9
9
10 Idris> :search e -> List e -> List e
10 Idris> :search e -> List e -> List e
docs/reference/uniqueness-types.rst+2−2
@@ -13,7 +13,7 @@ ideally while giving up as little high level conveniences as possible.
13
13
14They are inspired by linear types, `Uniqueness Types
14They are inspired by linear types, `Uniqueness Types
15<https://en.wikipedia.org/wiki/Uniqueness_type>`__ in the `Clean
15<https://en.wikipedia.org/wiki/Uniqueness_type>`__ in the `Clean
16−<http://wiki.clean.cs.ru.nl/Clean>`__ programming language, and
16+<https://wiki.clean.cs.ru.nl/Clean>`__ programming language, and
17ownership types and borrowed pointers in the `Rust
17ownership types and borrowed pointers in the `Rust
18<https://www.rust-lang.org/>`__ programming language.
18<https://www.rust-lang.org/>`__ programming language.
19
19
@@ -199,7 +199,7 @@ return it in exactly the condition in which it was received!
199The restriction is that when a ``Borrowed`` type is matched, any
199The restriction is that when a ``Borrowed`` type is matched, any
200pattern variables under the ``Read`` which have a unique type may not
200pattern variables under the ``Read`` which have a unique type may not
201be referred to at all on the right hand side (unless they are
201be referred to at all on the right hand side (unless they are
202−themselves ``lent`` to another function).
202+themselves lent to another function).
203
203
204Uniqueness information is stored in the type, and in particular in
204Uniqueness information is stored in the type, and in particular in
205function types. Once we're in a unique context, any new function which
205function types. Once we're in a unique context, any new function which
docs/st/index.rst+1−1
@@ -14,7 +14,7 @@ the `Control.ST` library in `Idris`.
14 Idris Community* has waived all copyright and related or neighbouring
14 Idris Community* has waived all copyright and related or neighbouring
15 rights to Documentation for Idris.
15 rights to Documentation for Idris.
16
16
17− More information concerning the CC0 can be found online at: http://creativecommons.org/publicdomain/zero/1.0/
17+ More information concerning the CC0 can be found online at: https://creativecommons.org/publicdomain/zero/1.0/
18
18
19.. toctree::
19.. toctree::
20 :maxdepth: 1
20 :maxdepth: 1
docs/st/introduction.rst+1−1
@@ -3,7 +3,7 @@ Overview
3********
3********
4
4
5Pure functional languages with dependent types such as `Idris
5Pure functional languages with dependent types such as `Idris
6−<http://www.idris-lang.org/>`_ support reasoning about programs directly
6+<https://www.idris-lang.org/>`_ support reasoning about programs directly
7in the type system, promising that we can *know* a program will run
7in the type system, promising that we can *know* a program will run
8correctly (i.e. according to the specification in its type) simply
8correctly (i.e. according to the specification in its type) simply
9because it compiles.
9because it compiles.
docs/tutorial/conclusions.rst+5−5
@@ -7,7 +7,7 @@ Further Reading
7Further information about Idris programming, and programming with
7Further information about Idris programming, and programming with
8dependent types in general, can be obtained from various sources:
8dependent types in general, can be obtained from various sources:
9
9
10−- The Idris web site (http://www.idris-lang.org/) and by asking
10+- The Idris web site (https://www.idris-lang.org/) and by asking
11 questions on the mailing list.
11 questions on the mailing list.
12
12
13- The IRC channel ``#idris``, on
13- The IRC channel ``#idris``, on
@@ -25,7 +25,7 @@ dependent types in general, can be obtained from various sources:
25 https://github.com/idris-lang/Idris-dev.
25 https://github.com/idris-lang/Idris-dev.
26
26
27- Existing projects on the ``Idris Hackers`` web space:
27- Existing projects on the ``Idris Hackers`` web space:
28− http://idris-hackers.github.io.
28+ https://idris-hackers.github.io.
29
29
30- Various papers (e.g. [1]_, [2]_, and [3]_). Although these mostly
30- Various papers (e.g. [1]_, [2]_, and [3]_). Although these mostly
31 describe older versions of Idris.
31 describe older versions of Idris.
@@ -36,14 +36,14 @@ dependent types in general, can be obtained from various sources:
36 Aspects of Declarative Languages (PADL'12), Claudio Russo and
36 Aspects of Declarative Languages (PADL'12), Claudio Russo and
37 Neng-Fa Zhou (Eds.). Springer-Verlag, Berlin, Heidelberg,
37 Neng-Fa Zhou (Eds.). Springer-Verlag, Berlin, Heidelberg,
38 242-257. DOI=10.1007/978-3-642-27694-1_18
38 242-257. DOI=10.1007/978-3-642-27694-1_18
39− http://dx.doi.org/10.1007/978-3-642-27694-1_18
39+ https://dx.doi.org/10.1007/978-3-642-27694-1_18
40
40
41.. [2] Edwin C. Brady. 2011. IDRIS ---: systems programming meets full
41.. [2] Edwin C. Brady. 2011. IDRIS ---: systems programming meets full
42 dependent types. In Proceedings of the 5th ACM workshop on
42 dependent types. In Proceedings of the 5th ACM workshop on
43 Programming languages meets program verification (PLPV
43 Programming languages meets program verification (PLPV
44 '11). ACM, New York, NY, USA,
44 '11). ACM, New York, NY, USA,
45 43-54. DOI=10.1145/1929529.1929536
45 43-54. DOI=10.1145/1929529.1929536
46− http://doi.acm.org/10.1145/1929529.1929536
46+ https://doi.acm.org/10.1145/1929529.1929536
47
47
48.. [3] Edwin C. Brady and Kevin Hammond. 2010. Scrapping your
48.. [3] Edwin C. Brady and Kevin Hammond. 2010. Scrapping your
49 inefficient engine: using partial evaluation to improve
49 inefficient engine: using partial evaluation to improve
@@ -51,4 +51,4 @@ dependent types in general, can be obtained from various sources:
51 15th ACM SIGPLAN international conference on Functional
51 15th ACM SIGPLAN international conference on Functional
52 programming (ICFP '10). ACM, New York, NY, USA,
52 programming (ICFP '10). ACM, New York, NY, USA,
53 297-308. DOI=10.1145/1863543.1863587
53 297-308. DOI=10.1145/1863543.1863587
54− http://doi.acm.org/10.1145/1863543.1863587
54+ https://doi.acm.org/10.1145/1863543.1863587
docs/tutorial/index.rst+1−1
@@ -15,7 +15,7 @@ existing functional programming language such as Haskell or OCaml.
15 Idris Community* has waived all copyright and related or neighboring
15 Idris Community* has waived all copyright and related or neighboring
16 rights to Documentation for Idris.
16 rights to Documentation for Idris.
17
17
18− More information concerning the CC0 can be found online at: http://creativecommons.org/publicdomain/zero/1.0/
18+ More information concerning the CC0 can be found online at: https://creativecommons.org/publicdomain/zero/1.0/
19
19
20
20
21.. toctree::
21.. toctree::
docs/tutorial/introduction.rst+2−2
@@ -6,7 +6,7 @@ Introduction
6
6
7In conventional programming languages, there is a clear distinction
7In conventional programming languages, there is a clear distinction
8between *types* and *values*. For example, in `Haskell
8between *types* and *values*. For example, in `Haskell
9−<http://www.haskell.org>`_, the following are types, representing
9+<https://www.haskell.org>`_, the following are types, representing
10integers, characters, lists of characters, and lists of any value
10integers, characters, lists of characters, and lists of any value
11respectively:
11respectively:
12
12
@@ -49,7 +49,7 @@ Intended Audience
49
49
50This tutorial is intended as a brief introduction to the language, and
50This tutorial is intended as a brief introduction to the language, and
51is aimed at readers already familiar with a functional language such
51is aimed at readers already familiar with a functional language such
52−as `Haskell <http://www.haskell.org>`_ or `OCaml <http://ocaml.org>`_.
52+as `Haskell <https://www.haskell.org>`_ or `OCaml <https://ocaml.org>`_.
53In particular, a certain amount of familiarity with Haskell syntax is
53In particular, a certain amount of familiarity with Haskell syntax is
54assumed, although most concepts will at least be explained
54assumed, although most concepts will at least be explained
55briefly. The reader is also assumed to have some interest in using
55briefly. The reader is also assumed to have some interest in using
docs/tutorial/miscellany.rst+3−3
@@ -131,7 +131,7 @@ an extension of ``.lidr`` then it is assumed to be a literate file. In
131literate programs, everything is assumed to be a comment unless the line
131literate programs, everything is assumed to be a comment unless the line
132begins with a greater than sign ``>``, for example:
132begins with a greater than sign ``>``, for example:
133
133
134−.. code-block:: idris
134+.. code-block:: literate-idris
135
135
136 > module literate
136 > module literate
137
137
@@ -242,7 +242,7 @@ through the following directives:
242Testing foreign function calls
242Testing foreign function calls
243------------------------------
243------------------------------
244
244
245−Normally, the Idris interpreter (used for typechecking and at the REPL)
245+Normally, the Idris interpreter (used for typechecking and as the REPL)
246will not perform IO actions. Additionally, as it neither generates C
246will not perform IO actions. Additionally, as it neither generates C
247code nor compiles to machine code, the ``%lib``, ``%include`` and
247code nor compiles to machine code, the ``%lib``, ``%include`` and
248``%link`` directives have no effect. IO actions and FFI calls can be
248``%link`` directives have no effect. IO actions and FFI calls can be
@@ -560,7 +560,7 @@ But what about the type of ``Type``? If we ask Idris it reports:
560 Type : Type 1
560 Type : Type 1
561
561
562If ``Type`` were its own type, it would lead to an inconsistency due to
562If ``Type`` were its own type, it would lead to an inconsistency due to
563−`Girard’s paradox <http://www.cs.cmu.edu/afs/cs.cmu.edu/user/kw/www/scans/girard72thesis.pdf>`_,
563+`Girard’s paradox <https://www.cs.cmu.edu/afs/cs.cmu.edu/user/kw/www/scans/girard72thesis.pdf>`_,
564so internally there is a *hierarchy* of types (or *universes*):
564so internally there is a *hierarchy* of types (or *universes*):
565
565
566.. code-block:: idris
566.. code-block:: idris
docs/tutorial/packages.rst+1−1
@@ -6,7 +6,7 @@ Packages
6
6
7Idris includes a simple build system for building packages and executables
7Idris includes a simple build system for building packages and executables
8from a named package description file. These files can be used with the
8from a named package description file. These files can be used with the
9−Idris compiler to manage the development process .
9+Idris compiler to manage the development process.
10
10
11Package Descriptions
11Package Descriptions
12====================
12====================
docs/tutorial/syntax.rst+3−3
@@ -196,16 +196,16 @@ syntax rule, we can even go as far as:
196 Aspects of Declarative Languages (PADL'12), Claudio Russo and
196 Aspects of Declarative Languages (PADL'12), Claudio Russo and
197 Neng-Fa Zhou (Eds.). Springer-Verlag, Berlin, Heidelberg,
197 Neng-Fa Zhou (Eds.). Springer-Verlag, Berlin, Heidelberg,
198 242-257. DOI=10.1007/978-3-642-27694-1_18
198 242-257. DOI=10.1007/978-3-642-27694-1_18
199− http://dx.doi.org/10.1007/978-3-642-27694-1_18
199+ https://dx.doi.org/10.1007/978-3-642-27694-1_18
200
200
201.. [2] Edwin C. Brady. 2011. IDRIS ---: systems programming meets full
201.. [2] Edwin C. Brady. 2011. IDRIS ---: systems programming meets full
202 dependent types. In Proceedings of the 5th ACM workshop on
202 dependent types. In Proceedings of the 5th ACM workshop on
203 Programming languages meets program verification (PLPV
203 Programming languages meets program verification (PLPV
204 '11). ACM, New York, NY, USA,
204 '11). ACM, New York, NY, USA,
205 43-54. DOI=10.1145/1929529.1929536
205 43-54. DOI=10.1145/1929529.1929536
206− http://doi.acm.org/10.1145/1929529.1929536
206+ https://doi.acm.org/10.1145/1929529.1929536
207
207
208.. [3] Edwin Brady and Kevin Hammond. 2010. Correct-by-Construction
208.. [3] Edwin Brady and Kevin Hammond. 2010. Correct-by-Construction
209 Concurrency: Using Dependent Types to Verify Implementations of
209 Concurrency: Using Dependent Types to Verify Implementations of
210 Effectful Resource Usage Protocols. Fundam. Inf. 102, 2 (April
210 Effectful Resource Usage Protocols. Fundam. Inf. 102, 2 (April
211− 2010), 145-176. http://dl.acm.org/citation.cfm?id=1883636
211+ 2010), 145-176. https://dl.acm.org/citation.cfm?id=1883636
docs/tutorial/typesfuns.rst+1−1
@@ -1190,7 +1190,7 @@ name. For example, a pair type could be defined as follows:
1190 fst : a
1190 fst : a
1191 snd : b
1191 snd : b
1192
1192
1193−Using the ``class`` record from earlier, the size of the class can be
1193+Using the ``Class`` record from earlier, the size of the class can be
1194restricted using a ``Vect`` and the size included in the type by parameterising
1194restricted using a ``Vect`` and the size included in the type by parameterising
1195the record with the size. For example:
1195the record with the size. For example:
1196
1196
idris-tutorial.pdf

Binary file not shown.

idris.cabal+104−50
@@ -1,10 +1,11 @@
1+Cabal-Version: 2.4
1Name: idris
2Name: idris
2−Version: 1.3.1
3+Version: 1.3.2
3−License: BSD3
4+License: BSD-3-Clause
4License-file: LICENSE
5License-file: LICENSE
5Author: Edwin Brady
6Author: Edwin Brady
6Maintainer: Edwin Brady <eb@cs.st-andrews.ac.uk>
7Maintainer: Edwin Brady <eb@cs.st-andrews.ac.uk>
7−Homepage: http://www.idris-lang.org/
8+Homepage: https://www.idris-lang.org/
8Bug-reports: https://github.com/idris-lang/Idris-dev/issues
9Bug-reports: https://github.com/idris-lang/Idris-dev/issues
9
10
10Stability: Beta
11Stability: Beta
@@ -16,7 +17,7 @@ Description: Idris is a general purpose language with full dependent types.
16 meaning that some aspects of a program's behaviour can be
17 meaning that some aspects of a program's behaviour can be
17 specified precisely in the type. The language is closely
18 specified precisely in the type. The language is closely
18 related to Epigram and Agda. There is a tutorial at
19 related to Epigram and Agda. There is a tutorial at
19− <http://www.idris-lang.org/documentation>.
20+ <https://www.idris-lang.org/documentation>.
20 Features include:
21 Features include:
21 .
22 .
22 * Full, first class, dependent types with dependent pattern matching
23 * Full, first class, dependent types with dependent pattern matching
@@ -41,42 +42,25 @@ Description: Idris is a general purpose language with full dependent types.
41 .
42 .
42 * Hugs style interactive environment
43 * Hugs style interactive environment
43
44
44−Cabal-Version: >= 1.22
45−
46Build-type: Custom
45Build-type: Custom
47
46
48Tested-With: GHC == 7.10.3, GHC == 8.0.1
47Tested-With: GHC == 7.10.3, GHC == 8.0.1
49
48
49+-- NOTE: due to https://github.com/haskell/cabal/issues/6125 the use of ** is
50+-- heavily discouraged.
50Data-files: idrisdoc/styles.css
51Data-files: idrisdoc/styles.css
51− jsrts/jsbn/jsbn-browser.js
52+ jsrts/jsbn/*.js
52− jsrts/jsbn/jsbn-node.js
53− jsrts/Runtime-common.js
54− jsrts/Runtime-javascript.js
55− jsrts/Runtime-node.js
53+ jsrts/*.js
56 jsrts/jsbn/LICENSE
54 jsrts/jsbn/LICENSE
55+ rts/Makefile
56+ rts/*.c
57+ rts/seL4/*.c
57− rts/arduino/idris_main.c
58+ rts/arduino/*.c
58− rts/idris_bitstring.c
59+ rts/windows/*.c
59− rts/idris_bitstring.h
60+ rts/windows/*.h
60− rts/idris_gc.c
61+ rts/*.h
61− rts/idris_gc.h
62+ rts/seL4/CMakeLists.txt
62− rts/idris_gmp.c
63+ rts/seL4/README.md
63− rts/idris_gmp.h
64− rts/idris_heap.c
65− rts/idris_heap.h
66− rts/idris_main.c
67− rts/idris_net.c
68− rts/idris_net.h
69− rts/idris_opts.c
70− rts/idris_opts.h
71− rts/idris_rts.c
72− rts/idris_rts.h
73− rts/idris_stats.c
74− rts/idris_stats.h
75− rts/idris_stdfgn.c
76− rts/idris_stdfgn.h
77− rts/mini-gmp.c
78− rts/mini-gmp.h
79− rts/libtest.c
80
64
81Extra-doc-files:
65Extra-doc-files:
82 CHANGELOG.md
66 CHANGELOG.md
@@ -86,13 +70,75 @@ Extra-doc-files:
86 README.md
70 README.md
87 RELEASE-CHECKS.md
71 RELEASE-CHECKS.md
88 idris-tutorial.pdf
72 idris-tutorial.pdf
73+ man/idris.1
89 samples/effects/*.idr
74 samples/effects/*.idr
90 samples/misc/*.idr
75 samples/misc/*.idr
91− samples/misc/*.lidr
92 samples/tutorial/*.idr
76 samples/tutorial/*.idr
77+ samples/ST/*.idr
78+ samples/ST/Graphics/*.idr
79+ samples/ST/Net/*.idr
80+ samples/misc/*.lidr
93
81
94-- extra-source-files is generated by Setup.hs using `git --ls-files`.
82-- extra-source-files is generated by Setup.hs using `git --ls-files`.
95Extra-source-files:
83Extra-source-files:
84+ Makefile
85+ config.mk
86+ custom.mk-alldeps
87+ mkpkg.sh
88+ stack-shell.nix
89+ stack.yaml
90+ stylize.sh
91+ win-release.sh
92+
93+ benchmarks/*.pl
94+ benchmarks/fasta/*.idr
95+ benchmarks/fasta/*.ipkg
96+ benchmarks/pidigits/*.idr
97+ benchmarks/pidigits/*.ipkg
98+ benchmarks/quasigroups/*.idr
99+ benchmarks/quasigroups/*.ipkg
100+ benchmarks/trivial/*.idr
101+ benchmarks/trivial/*.ipkg
102+ benchmarks/quasigroups/board
103+
104+ icons/*.png
105+ icons/*.ico
106+ icons/*.rc
107+ icons/*.svg
108+ icons/*.xml
109+
110+ libs/**/*.idr
111+ libs/**/*.ipkg
112+ libs/**/*.txt
113+ libs/Makefile
114+ libs/base/Makefile
115+ libs/contrib/Makefile
116+ libs/effects/Makefile
117+ libs/prelude/Makefile
118+ libs/pruviloj/Makefile
119+
120+ scripts/generate-multi-ghc-travis-template
121+ scripts/runidris
122+ scripts/runidris-node
123+
124+ src/.ghci
125+
126+ test/*.md
127+ test/*.hs
128+ test/**/*.idr
129+ test/**/*.lidr
130+ test/**/*.ipkg
131+ test/**/*.out
132+ test/**/*.sh
133+ test/**/*.c
134+ test/**/*.h
135+ test/**/*.in
136+ test/**/*.txt
137+ test/**/*.js
138+ test/base001/Makefile
139+ test/ffi004/theOtherType
140+ test/ffi004/theType
141+ test/scripts/timeout
96
142
97source-repository head
143source-repository head
98 type: git
144 type: git
@@ -100,7 +146,7 @@ source-repository head
100
146
101custom-setup
147custom-setup
102 setup-depends:
148 setup-depends:
103− Cabal >= 1.10 && <2.5,
149+ Cabal >= 2.4 && < 3.1,
104 base >= 4 && <5,
150 base >= 4 && <5,
105 directory,
151 directory,
106 filepath,
152 filepath,
@@ -261,26 +307,29 @@ Library
261 Util.Pretty
307 Util.Pretty
262 , Util.Net
308 , Util.Net
263
309
264−
265−
266− -- Auto Generated
267 , Paths_idris
310 , Paths_idris
268 , Version_idris
311 , Version_idris
269 , Tools_idris
312 , Tools_idris
270 , BuildFlags_idris
313 , BuildFlags_idris
271
314
315+ -- Auto Generated
316+ Autogen-modules: Paths_idris
317+ , Version_idris
318+ , Tools_idris
319+ , BuildFlags_idris
320+
272 Build-depends: base >=4 && <5
321 Build-depends: base >=4 && <5
273 , aeson >= 0.6 && < 1.5
322 , aeson >= 0.6 && < 1.5
274 , annotated-wl-pprint >= 0.7 && < 0.8
323 , annotated-wl-pprint >= 0.7 && < 0.8
275− , ansi-terminal < 0.9
324+ , ansi-terminal < 0.11
276 , ansi-wl-pprint < 0.7
325 , ansi-wl-pprint < 0.7
277 , array >= 0.4.0.1 && < 0.6
326 , array >= 0.4.0.1 && < 0.6
278 , base64-bytestring < 1.1
327 , base64-bytestring < 1.1
279 , binary >= 0.8.4.1 && < 0.9
328 , binary >= 0.8.4.1 && < 0.9
280 , blaze-html >= 0.6.1.3 && < 0.10
329 , blaze-html >= 0.6.1.3 && < 0.10
281− , blaze-markup >= 0.5.2.1 && < 0.9
330+ , blaze-markup >= 0.5.2.1 && < 0.10
282 , bytestring < 0.11
331 , bytestring < 0.11
283− , cheapskate >= 0.1.1 && < 0.2
332+ , cheapskate >= 0.1.1.2 && < 0.2
284 , code-page >= 0.1 && < 0.3
333 , code-page >= 0.1 && < 0.3
285 , containers >= 0.5 && < 0.7
334 , containers >= 0.5 && < 0.7
286 , deepseq < 1.5
335 , deepseq < 1.5
@@ -289,10 +338,10 @@ Library
289 , fingertree >= 0.1.4.1 && < 0.2
338 , fingertree >= 0.1.4.1 && < 0.2
290 , haskeline >= 0.7 && < 0.8
339 , haskeline >= 0.7 && < 0.8
291 , ieee754 >= 0.7 && < 0.9
340 , ieee754 >= 0.7 && < 0.9
292− , megaparsec >= 7.0.4 && < 8
341+ , megaparsec >= 7.0.4 && < 9
293 , mtl >= 2.1 && < 2.3
342 , mtl >= 2.1 && < 2.3
294− , network >= 2.7 && < 2.9
343+ , network >= 2.7 && < 3.1.2
295− , optparse-applicative >= 0.13 && < 0.15
344+ , optparse-applicative >= 0.13 && < 0.16
296 , parser-combinators >= 1.0.0
345 , parser-combinators >= 1.0.0
297 , pretty < 1.2
346 , pretty < 1.2
298 , process < 1.7
347 , process < 1.7
@@ -300,8 +349,8 @@ Library
300 , safe >= 0.3.9
349 , safe >= 0.3.9
301 , split < 0.3
350 , split < 0.3
302 , terminal-size < 0.4
351 , terminal-size < 0.4
303− , text >=1.2.1.0 && < 1.3
352+ , text >=1.2.1.0 && < 1.4
304− , time >= 1.4 && < 1.9
353+ , time >= 1.4 && < 2.0
305 , transformers >= 0.5 && < 0.6
354 , transformers >= 0.5 && < 0.6
306 , uniplate >=1.6 && < 1.7
355 , uniplate >=1.6 && < 1.7
307 , unordered-containers < 0.3
356 , unordered-containers < 0.3
@@ -309,11 +358,12 @@ Library
309 , vector < 0.13
358 , vector < 0.13
310 , vector-binary-instances < 0.3
359 , vector-binary-instances < 0.3
311 , zip-archive > 0.2.3.5 && < 0.5
360 , zip-archive > 0.2.3.5 && < 0.5
312− , fsnotify >= 0.2 && < 2.2
361+ , fsnotify >= 0.2 && < 0.4
313 , async < 2.3
362 , async < 2.3
314
363
315 if !impl(ghc >= 8.0)
364 if !impl(ghc >= 8.0)
316− Build-Depends: semigroups == 0.18.*
365+ Build-Depends: semigroups == 0.18.*
366+ , fail == 4.9.0.*
317
367
318 Default-Language: Haskell2010
368 Default-Language: Haskell2010
319 ghc-prof-options: -auto-all -caf-all
369 ghc-prof-options: -auto-all -caf-all
@@ -332,6 +382,7 @@ Library
332 cpp-options: -DIDRIS_GMP
382 cpp-options: -DIDRIS_GMP
333 if flag(freestanding)
383 if flag(freestanding)
334 other-modules: Target_idris
384 other-modules: Target_idris
385+ autogen-modules: Target_idris
335 cpp-options: -DFREESTANDING
386 cpp-options: -DFREESTANDING
336 if flag(CI)
387 if flag(CI)
337 ghc-options: -Werror
388 ghc-options: -Werror
@@ -365,7 +416,7 @@ Test-suite regression-and-feature-tests
365 , filepath
416 , filepath
366 , directory
417 , directory
367 , haskeline >= 0.7
418 , haskeline >= 0.7
368− , optparse-applicative >= 0.13 && < 0.15
419+ , optparse-applicative >= 0.13 && < 0.16
369 , tagged
420 , tagged
370 , tasty >= 0.8
421 , tasty >= 0.8
371 , tasty-golden >= 2.0
422 , tasty-golden >= 2.0
@@ -380,6 +431,7 @@ Test-suite regression-and-feature-tests
380
431
381Executable idris-codegen-c
432Executable idris-codegen-c
382 Main-is: Main.hs
433 Main-is: Main.hs
434+ autogen-modules: Paths_idris
383 other-modules: Paths_idris
435 other-modules: Paths_idris
384 hs-source-dirs: codegen/idris-codegen-c
436 hs-source-dirs: codegen/idris-codegen-c
385
437
@@ -395,6 +447,7 @@ Executable idris-codegen-c
395
447
396Executable idris-codegen-javascript
448Executable idris-codegen-javascript
397 Main-is: Main.hs
449 Main-is: Main.hs
450+ autogen-modules: Paths_idris
398 other-modules: Paths_idris
451 other-modules: Paths_idris
399 hs-source-dirs: codegen/idris-codegen-javascript
452 hs-source-dirs: codegen/idris-codegen-javascript
400
453
@@ -410,6 +463,7 @@ Executable idris-codegen-javascript
410
463
411Executable idris-codegen-node
464Executable idris-codegen-node
412 Main-is: Main.hs
465 Main-is: Main.hs
466+ autogen-modules: Paths_idris
413 other-modules: Paths_idris
467 other-modules: Paths_idris
414 hs-source-dirs: codegen/idris-codegen-node
468 hs-source-dirs: codegen/idris-codegen-node
415
469
libs/base/Control/Isomorphism.idr+20−23
@@ -17,21 +17,22 @@ record Iso a b where
17
17
18-- Isomorphism properties
18-- Isomorphism properties
19
19
20−||| Isomorphism is Reflexive
20+||| Isomorphism is reflexive
21isoRefl : Iso a a
21isoRefl : Iso a a
22−isoRefl = MkIso id id (\x => Refl) (\x => Refl)
22+isoRefl = MkIso id id (\_ => Refl) (\_ => Refl)
23
23
24||| Isomorphism is transitive
24||| Isomorphism is transitive
25isoTrans : Iso a b -> Iso b c -> Iso a c
25isoTrans : Iso a b -> Iso b c -> Iso a c
26isoTrans (MkIso to from toFrom fromTo) (MkIso to' from' toFrom' fromTo') =
26isoTrans (MkIso to from toFrom fromTo) (MkIso to' from' toFrom' fromTo') =
27− MkIso (\x => to' (to x))
27+ MkIso xto xfrom xtoFrom xfromTo where
28− (\y => from (from' y))
28+ xto : a -> c
29− (\y => (to' (to (from (from' y)))) ={ cong (toFrom (from' y)) }=
29+ xto = to' . to
30+ xfrom : c -> a
31+ xfrom = from . from'
32+ xtoFrom : (z : c) -> xto (xfrom z) = z
30− (to' (from' y)) ={ toFrom' y }=
33+ xtoFrom z = rewrite toFrom $ from' z in toFrom' z
31− y QED)
34+ xfromTo : (x : a) -> xfrom (xto x) = x
32− (\x => (from (from' (to' (to x)))) ={ cong (fromTo' (to x)) }=
35+ xfromTo x = rewrite fromTo' (to x) in fromTo x
33− (from (to x)) ={ fromTo x }=
34− x QED)
35
36
36Category Iso where
37Category Iso where
37 id = isoRefl
38 id = isoRefl
@@ -99,8 +100,7 @@ eitherBotRight = isoTrans eitherComm eitherBotLeft
99
100
100||| Isomorphism is a congruence with regards to disjunction
101||| Isomorphism is a congruence with regards to disjunction
101eitherCong : Iso a a' -> Iso b b' -> Iso (Either a b) (Either a' b')
102eitherCong : Iso a a' -> Iso b b' -> Iso (Either a b) (Either a' b')
102−eitherCong {a = a} {a' = a'} {b = b} {b' = b'}
103− (MkIso to from toFrom fromTo)
103+eitherCong (MkIso to from toFrom fromTo)
104 (MkIso to' from' toFrom' fromTo') =
104 (MkIso to' from' toFrom' fromTo') =
105 MkIso (eitherMap to to') (eitherMap from from') ok1 ok2
105 MkIso (eitherMap to to') (eitherMap from from') ok1 ok2
106 where eitherMap : (c -> c') -> (d -> d') -> Either c d -> Either c' d'
106 where eitherMap : (c -> c') -> (d -> d') -> Either c d -> Either c' d'
@@ -143,9 +143,7 @@ pairAssoc = MkIso to from ok1 ok2
143
143
144||| Conjunction with truth is a no-op
144||| Conjunction with truth is a no-op
145pairUnitRight : Iso (a, ()) a
145pairUnitRight : Iso (a, ()) a
146−pairUnitRight = MkIso fst (\x => (x, ())) (\x => Refl) ok
146+pairUnitRight = MkIso fst (\x => (x, ())) (\_ => Refl) (\(_, ()) => Refl)
147− where ok : (x : (a, ())) -> (fst x, ()) = x
148− ok (x, ()) = Refl
149
147
150||| Conjunction with truth is a no-op
148||| Conjunction with truth is a no-op
151pairUnitLeft : Iso ((), a) a
149pairUnitLeft : Iso ((), a) a
@@ -161,8 +159,7 @@ pairBotRight = isoTrans pairComm pairBotLeft
161
159
162||| Isomorphism is a congruence with regards to conjunction
160||| Isomorphism is a congruence with regards to conjunction
163pairCong : Iso a a' -> Iso b b' -> Iso (a, b) (a', b')
161pairCong : Iso a a' -> Iso b b' -> Iso (a, b) (a', b')
164−pairCong {a = a} {a' = a'} {b = b} {b' = b'}
165− (MkIso to from toFrom fromTo)
162+pairCong (MkIso to from toFrom fromTo)
166 (MkIso to' from' toFrom' fromTo') =
163 (MkIso to' from' toFrom' fromTo') =
167 MkIso to'' from'' iso1 iso2
164 MkIso to'' from'' iso1 iso2
168 where to'' : (a, b) -> (a', b')
165 where to'' : (a, b) -> (a', b')
@@ -205,7 +202,7 @@ distribLeft = MkIso to from toFrom fromTo
205
202
206||| Products distribute over sums
203||| Products distribute over sums
207distribRight : Iso (a, Either b c) (Either (a, b) (a, c))
204distribRight : Iso (a, Either b c) (Either (a, b) (a, c))
208−distribRight {a} {b} {c} = (pairComm `isoTrans` distribLeft) `isoTrans` eitherCong pairComm pairComm
205+distribRight = (pairComm `isoTrans` distribLeft) `isoTrans` eitherCong pairComm pairComm
209
206
210
207
211-- Enable preorder reasoning syntax over isomorphisms
208-- Enable preorder reasoning syntax over isomorphisms
@@ -222,7 +219,7 @@ step a iso1 iso2 = isoTrans iso1 iso2
222-- Isomorphisms over Maybe
219-- Isomorphisms over Maybe
223||| Isomorphism is a congruence with respect to Maybe
220||| Isomorphism is a congruence with respect to Maybe
224maybeCong : Iso a b -> Iso (Maybe a) (Maybe b)
221maybeCong : Iso a b -> Iso (Maybe a) (Maybe b)
225−maybeCong {a} {b} (MkIso to from toFrom fromTo) = MkIso (map to) (map from) ok1 ok2
222+maybeCong (MkIso to from toFrom fromTo) = MkIso (map to) (map from) ok1 ok2
226 where ok1 : (y : Maybe b) -> map to (map from y) = y
223 where ok1 : (y : Maybe b) -> map to (map from y) = y
227 ok1 Nothing = Refl
224 ok1 Nothing = Refl
228 ok1 (Just x) = (Just (to (from x))) ={ cong (toFrom x) }= (Just x) QED
225 ok1 (Just x) = (Just (to (from x))) ={ cong (toFrom x) }= (Just x) QED
@@ -253,7 +250,7 @@ maybeVoidUnit = (Maybe Void) ={ maybeEither }=
253 () QED
250 () QED
254
251
255eitherMaybeLeftMaybe : Iso (Either (Maybe a) b) (Maybe (Either a b))
252eitherMaybeLeftMaybe : Iso (Either (Maybe a) b) (Maybe (Either a b))
256−eitherMaybeLeftMaybe {a} {b} =
253+eitherMaybeLeftMaybe =
257 (Either (Maybe a) b) ={ eitherCongLeft maybeEither }=
254 (Either (Maybe a) b) ={ eitherCongLeft maybeEither }=
258 (Either (Either a ()) b) ={ eitherAssoc }=
255 (Either (Either a ()) b) ={ eitherAssoc }=
259 (Either a (Either () b)) ={ eitherCongRight eitherComm }=
256 (Either a (Either () b)) ={ eitherCongRight eitherComm }=
@@ -263,7 +260,7 @@ eitherMaybeLeftMaybe {a} {b} =
263
260
264
261
265eitherMaybeRightMaybe : Iso (Either a (Maybe b)) (Maybe (Either a b))
262eitherMaybeRightMaybe : Iso (Either a (Maybe b)) (Maybe (Either a b))
266−eitherMaybeRightMaybe {a} {b} =
263+eitherMaybeRightMaybe =
267 (Either a (Maybe b)) ={ eitherComm }=
264 (Either a (Maybe b)) ={ eitherComm }=
268 (Either (Maybe b) a) ={ eitherMaybeLeftMaybe }=
265 (Either (Maybe b) a) ={ eitherMaybeLeftMaybe }=
269 (Maybe (Either b a)) ={ maybeCong eitherComm }=
266 (Maybe (Either b a)) ={ maybeCong eitherComm }=
@@ -288,8 +285,8 @@ maybeIsoS = MkIso forth back fb bf
288 fb (FS x) = Refl
285 fb (FS x) = Refl
289
286
290finZeroBot : Iso (Fin 0) Void
287finZeroBot : Iso (Fin 0) Void
291−finZeroBot = MkIso (\x => void (uninhabited x))
288+finZeroBot = MkIso (void . uninhabited)
292− (\x => void x)
289+ void
293 (\x => void x)
290 (\x => void x)
294 (\x => void (uninhabited x))
291 (\x => void (uninhabited x))
295
292
libs/base/Data/Fin.idr+9
@@ -65,6 +65,11 @@ weakenN : (n : Nat) -> Fin m -> Fin (m + n)
65weakenN n FZ = FZ
65weakenN n FZ = FZ
66weakenN n (FS f) = FS (weakenN n f)
66weakenN n (FS f) = FS (weakenN n f)
67
67
68+||| Weaken the bound on a Fin using an inequality proof
69+weakenLTE : LTE n m -> Fin n -> Fin m
70+weakenLTE (LTESucc p) FZ = FZ
71+weakenLTE (LTESucc p) (FS f) = FS $ weakenLTE p f
72+
68||| Attempt to tighten the bound on a Fin.
73||| Attempt to tighten the bound on a Fin.
69||| Return `Left` if the bound could not be tightened, or `Right` if it could.
74||| Return `Left` if the bound could not be tightened, or `Right` if it could.
70strengthen : Fin (S n) -> Either (Fin (S n)) (Fin n)
75strengthen : Fin (S n) -> Either (Fin (S n)) (Fin n)
@@ -101,6 +106,10 @@ implementation MinBound (Fin (S n)) where
101implementation MaxBound (Fin (S n)) where
106implementation MaxBound (Fin (S n)) where
102 maxBound = last
107 maxBound = last
103
108
109+||| Add two Fins
110+addFin : (x : Fin n) -> (y : Fin m) -> Fin (finToNat x + m)
111+addFin FZ y = y
112+addFin (FS x) y = FS $ addFin x y
104
113
105-- Construct a Fin from an integer literal which must fit in the given Fin
114-- Construct a Fin from an integer literal which must fit in the given Fin
106
115
libs/base/Data/List/Quantifiers.idr+5
@@ -75,3 +75,8 @@ all d (x::xs) with (d x)
75 case all d xs of
75 case all d xs of
76 Yes prf' => Yes (prf :: prf')
76 Yes prf' => Yes (prf :: prf')
77 No prf' => No (notAllThere prf')
77 No prf' => No (notAllThere prf')
78+
79+||| Given a proof of membership for some element, extract the property proof for it
80+indexAll : Elem x xs -> All p xs -> p x
81+indexAll Here (p::_ ) = p
82+indexAll (There e) ( _::ps) = indexAll e ps
libs/base/Data/So.idr+11−1
@@ -12,7 +12,7 @@ module Data.So
12||| If you find yourself using `So` for something other than primitive types,
12||| If you find yourself using `So` for something other than primitive types,
13||| it may be appropriate to define a type of evidence for the property that you
13||| it may be appropriate to define a type of evidence for the property that you
14||| care about instead.
14||| care about instead.
15−data So : Bool -> Type where
15+data So : Bool -> Type where
16 Oh : So True
16 Oh : So True
17
17
18implementation Uninhabited (So False) where
18implementation Uninhabited (So False) where
@@ -23,4 +23,14 @@ choose : (b : Bool) -> Either (So b) (So (not b))
23choose True = Left Oh
23choose True = Left Oh
24choose False = Right Oh
24choose False = Right Oh
25
25
26+||| Absurd when you have proof that both `b` and `not b` is true.
27+export
28+soAbsurd : So b -> So (not b) -> Void
29+soAbsurd sb snb with (sb)
30+ | Oh = uninhabited snb
31+
32+||| Transmission between usage of value-level `not` and type-level `Not`.
33+export
34+soNotToNotSo : So (not b) -> Not (So b)
35+soNotToNotSo = flip soAbsurd
26
36
libs/base/Data/Vect.idr+265−1
@@ -45,36 +45,64 @@ lengthCorrect (S n) (x :: xs) = rewrite lengthCorrect n xs in Refl
45--------------------------------------------------------------------------------
45--------------------------------------------------------------------------------
46
46
47||| All but the first element of the vector
47||| All but the first element of the vector
48+|||
49+||| ```idris example
50+||| tail [1,2,3,4]
51+||| ```
48tail : Vect (S len) elem -> Vect len elem
52tail : Vect (S len) elem -> Vect len elem
49tail (x::xs) = xs
53tail (x::xs) = xs
50
54
51||| Only the first element of the vector
55||| Only the first element of the vector
56+|||
57+||| ```idris example
58+||| head [1,2,3,4]
59+||| ```
52head : Vect (S len) elem -> elem
60head : Vect (S len) elem -> elem
53head (x::xs) = x
61head (x::xs) = x
54
62
55||| The last element of the vector
63||| The last element of the vector
64+|||
65+||| ```idris example
66+||| last [1,2,3,4]
67+||| ```
56last : Vect (S len) elem -> elem
68last : Vect (S len) elem -> elem
57last (x::[]) = x
69last (x::[]) = x
58last (x::y::ys) = last $ y::ys
70last (x::y::ys) = last $ y::ys
59
71
60||| All but the last element of the vector
72||| All but the last element of the vector
73+|||
74+||| ```idris example
75+||| init [1,2,3,4]
76+||| ```
61init : Vect (S len) elem -> Vect len elem
77init : Vect (S len) elem -> Vect len elem
62init (x::[]) = []
78init (x::[]) = []
63init (x::y::ys) = x :: init (y::ys)
79init (x::y::ys) = x :: init (y::ys)
64
80
65||| Extract a particular element from a vector
81||| Extract a particular element from a vector
82+|||
83+||| ```idris example
84+||| index 1 [1,2,3,4]
85+||| ```
66index : Fin len -> Vect len elem -> elem
86index : Fin len -> Vect len elem -> elem
67index FZ (x::xs) = x
87index FZ (x::xs) = x
68index (FS k) (x::xs) = index k xs
88index (FS k) (x::xs) = index k xs
69
89
70
90
71||| Insert an element at a particular index
91||| Insert an element at a particular index
92+|||
93+||| ```idris example
94+||| insertAt 1 8 [1,2,3,4]
95+||| ```
72insertAt : Fin (S len) -> elem -> Vect len elem -> Vect (S len) elem
96insertAt : Fin (S len) -> elem -> Vect len elem -> Vect (S len) elem
73insertAt FZ y xs = y :: xs
97insertAt FZ y xs = y :: xs
74insertAt (FS k) y (x::xs) = x :: insertAt k y xs
98insertAt (FS k) y (x::xs) = x :: insertAt k y xs
75insertAt (FS k) y [] = absurd k
99insertAt (FS k) y [] = absurd k
76
100
77||| Construct a new vector consisting of all but the indicated element
101||| Construct a new vector consisting of all but the indicated element
102+|||
103+||| ```idris example
104+||| deleteAt 1 [1,2,3,4]
105+||| ```
78deleteAt : Fin (S len) -> Vect (S len) elem -> Vect len elem
106deleteAt : Fin (S len) -> Vect (S len) elem -> Vect len elem
79deleteAt FZ (x::xs) = xs
107deleteAt FZ (x::xs) = xs
80deleteAt {len = S m} (FS k) (x::xs) = x :: deleteAt k xs
108deleteAt {len = S m} (FS k) (x::xs) = x :: deleteAt k xs
@@ -82,6 +110,10 @@ deleteAt {len = Z} (FS k) (x::xs) = absurd k
82deleteAt _ [] impossible
110deleteAt _ [] impossible
83
111
84||| Replace an element at a particlar index with another
112||| Replace an element at a particlar index with another
113+|||
114+||| ```idris example
115+||| replaceAt 1 8 [1,2,3,4]
116+||| ```
85replaceAt : Fin len -> elem -> Vect len elem -> Vect len elem
117replaceAt : Fin len -> elem -> Vect len elem -> Vect len elem
86replaceAt FZ y (x::xs) = y :: xs
118replaceAt FZ y (x::xs) = y :: xs
87replaceAt (FS k) y (x::xs) = x :: replaceAt k y xs
119replaceAt (FS k) y (x::xs) = x :: replaceAt k y xs
@@ -90,6 +122,10 @@ replaceAt (FS k) y (x::xs) = x :: replaceAt k y xs
90||| @ i the index to replace at
122||| @ i the index to replace at
91||| @ f the update function
123||| @ f the update function
92||| @ xs the vector to replace in
124||| @ xs the vector to replace in
125+|||
126+||| ```idris example
127+||| updateAt 1 (+10) [1,2,3,4]
128+||| ```
93updateAt : (i : Fin len) -> (f : elem -> elem) -> (xs : Vect len elem) -> Vect len elem
129updateAt : (i : Fin len) -> (f : elem -> elem) -> (xs : Vect len elem) -> Vect len elem
94updateAt FZ f (x::xs) = f x :: xs
130updateAt FZ f (x::xs) = f x :: xs
95updateAt (FS k) f (x::xs) = x :: updateAt k f xs
131updateAt (FS k) f (x::xs) = x :: updateAt k f xs
@@ -100,18 +136,30 @@ updateAt (FS k) f (x::xs) = x :: updateAt k f xs
100
136
101||| Get the first n elements of a Vect
137||| Get the first n elements of a Vect
102||| @ n the number of elements to take
138||| @ n the number of elements to take
139+|||
140+||| ```idris example
141+||| take 2 [1,2,3,4]
142+||| ```
103take : (n : Nat) -> Vect (n + m) elem -> Vect n elem
143take : (n : Nat) -> Vect (n + m) elem -> Vect n elem
104take Z xs = []
144take Z xs = []
105take (S k) (x :: xs) = x :: take k xs
145take (S k) (x :: xs) = x :: take k xs
106
146
107||| Remove the first n elements of a Vect
147||| Remove the first n elements of a Vect
108||| @ n the number of elements to remove
148||| @ n the number of elements to remove
149+|||
150+||| ```idris example
151+||| drop 2 [1,2,3,4]
152+||| ```
109drop : (n : Nat) -> Vect (n + m) elem -> Vect m elem
153drop : (n : Nat) -> Vect (n + m) elem -> Vect m elem
110drop Z xs = xs
154drop Z xs = xs
111drop (S k) (x :: xs) = drop k xs
155drop (S k) (x :: xs) = drop k xs
112
156
113||| Take up to the first n elements of a Vect if they exist.
157||| Take up to the first n elements of a Vect if they exist.
114||| @ n the maximum number of elements to take
158||| @ n the maximum number of elements to take
159+|||
160+||| ```idris example
161+||| takeUpto 10 [1,2,3,4]
162+||| ```
115takeUpto : (x : Nat) -> Vect n elem -> Vect (minimum x n) elem
163takeUpto : (x : Nat) -> Vect n elem -> Vect (minimum x n) elem
116takeUpto Z ys = []
164takeUpto Z ys = []
117takeUpto x [] = rewrite minimumZeroZeroLeft x in []
165takeUpto x [] = rewrite minimumZeroZeroLeft x in []
@@ -119,6 +167,10 @@ takeUpto (S x) (y::ys) = y :: takeUpto x ys
119
167
120||| Drop up to the first n elements of a Vect if they exist.
168||| Drop up to the first n elements of a Vect if they exist.
121||| @ n the maximum number of elements to remove.
169||| @ n the maximum number of elements to remove.
170+|||
171+||| ```idris example
172+||| dropUpto 10 [1,2,3,4]
173+||| ```
122dropUpto : (x : Nat) -> Vect n elem -> Vect (n `minus` minimum x n) elem
174dropUpto : (x : Nat) -> Vect n elem -> Vect (n `minus` minimum x n) elem
123dropUpto Z ys {n} = rewrite minusZeroRight n in ys
175dropUpto Z ys {n} = rewrite minusZeroRight n in ys
124dropUpto x [] = []
176dropUpto x [] = []
@@ -128,6 +180,10 @@ dropUpto (S x) (y :: ys) = dropUpto x ys
128||| Boolean predicate.
180||| Boolean predicate.
129|||
181|||
130||| @ p the predicate
182||| @ p the predicate
183+|||
184+||| ```idris example
185+||| takeWhile (<3) [1,2,3,4]
186+||| ```
131takeWhile : (p : elem -> Bool) -> Vect len elem -> (q ** Vect q elem)
187takeWhile : (p : elem -> Bool) -> Vect len elem -> (q ** Vect q elem)
132takeWhile p [] = (_ ** [])
188takeWhile p [] = (_ ** [])
133takeWhile p (x::xs) =
189takeWhile p (x::xs) =
@@ -141,6 +197,10 @@ takeWhile p (x::xs) =
141||| Boolean predicate.
197||| Boolean predicate.
142|||
198|||
143||| @ p the predicate
199||| @ p the predicate
200+|||
201+||| ```idris example
202+||| dropWhile (<3) [1,2,3,4]
203+||| ```
144dropWhile : (p : elem -> Bool) -> Vect len elem -> (q ** Vect q elem)
204dropWhile : (p : elem -> Bool) -> Vect len elem -> (q ** Vect q elem)
145dropWhile p [] = (_ ** [])
205dropWhile p [] = (_ ** [])
146dropWhile p (x::xs) =
206dropWhile p (x::xs) =
@@ -154,6 +214,10 @@ dropWhile p (x::xs) =
154--------------------------------------------------------------------------------
214--------------------------------------------------------------------------------
155
215
156||| Reverse the order of the elements of a vector
216||| Reverse the order of the elements of a vector
217+|||
218+||| ```idris example
219+||| reverse [1,2,3,4]
220+||| ```
157reverse : Vect len elem -> Vect len elem
221reverse : Vect len elem -> Vect len elem
158reverse xs = go [] xs
222reverse xs = go [] xs
159 where go : Vect n elem -> Vect m elem -> Vect (n+m) elem
223 where go : Vect n elem -> Vect m elem -> Vect (n+m) elem
@@ -164,6 +228,10 @@ reverse xs = go [] xs
164||| Alternate an element between the other elements of a vector
228||| Alternate an element between the other elements of a vector
165||| @ sep the element to intersperse
229||| @ sep the element to intersperse
166||| @ xs the vector to separate with `sep`
230||| @ xs the vector to separate with `sep`
231+|||
232+||| ```idris example
233+||| intersperse 0 [1,2,3,4]
234+||| ```
167intersperse : (sep : elem) -> (xs : Vect len elem) -> Vect (len + pred len) elem
235intersperse : (sep : elem) -> (xs : Vect len elem) -> Vect (len + pred len) elem
168intersperse sep [] = []
236intersperse sep [] = []
169intersperse sep (x::xs) = x :: intersperse' sep xs
237intersperse sep (x::xs) = x :: intersperse' sep xs
@@ -188,6 +256,10 @@ fromList' {len} ys (x::xs) =
188||| Convert a list to a vector.
256||| Convert a list to a vector.
189|||
257|||
190||| The length of the list should be statically known.
258||| The length of the list should be statically known.
259+|||
260+||| ```idris example
261+||| fromList [1,2,3,4]
262+||| ```
191fromList : (l : List elem) -> Vect (length l) elem
263fromList : (l : List elem) -> Vect (length l) elem
192fromList l =
264fromList l =
193 rewrite (sym $ plusZeroRightNeutral (length l)) in
265 rewrite (sym $ plusZeroRightNeutral (length l)) in
@@ -198,19 +270,31 @@ fromList l =
198--------------------------------------------------------------------------------
270--------------------------------------------------------------------------------
199
271
200||| Append two vectors
272||| Append two vectors
273+|||
274+||| ```idris example
275+||| [1,2,3,4] ++ [5,6]
276+||| ```
201(++) : (xs : Vect m elem) -> (ys : Vect n elem) -> Vect (m + n) elem
277(++) : (xs : Vect m elem) -> (ys : Vect n elem) -> Vect (m + n) elem
202(++) [] ys = ys
278(++) [] ys = ys
203(++) (x::xs) ys = x :: xs ++ ys
279(++) (x::xs) ys = x :: xs ++ ys
204
280
205−||| Repeate some value some number of times.
281+||| Repeat some value some number of times.
206|||
282|||
207||| @ len the number of times to repeat it
283||| @ len the number of times to repeat it
208||| @ x the value to repeat
284||| @ x the value to repeat
285+|||
286+||| ```idris example
287+||| replicate 4 1
288+||| ```
209replicate : (len : Nat) -> (x : elem) -> Vect len elem
289replicate : (len : Nat) -> (x : elem) -> Vect len elem
210replicate Z x = []
290replicate Z x = []
211replicate (S k) x = x :: replicate k x
291replicate (S k) x = x :: replicate k x
212
292
213||| Merge two ordered vectors
293||| Merge two ordered vectors
294+|||
295+||| ```idris example
296+||| mergeBy compare (fromList [1,3,5]) (fromList [2,3,4,5,6])
297+||| ```
214mergeBy : (elem -> elem -> Ordering) -> (xs : Vect n elem) -> (ys : Vect m elem) -> Vect (n + m) elem
298mergeBy : (elem -> elem -> Ordering) -> (xs : Vect n elem) -> (ys : Vect m elem) -> Vect (n + m) elem
215mergeBy order [] [] = []
299mergeBy order [] [] = []
216mergeBy order [] (x :: xs) = x :: xs
300mergeBy order [] (x :: xs) = x :: xs
@@ -234,30 +318,54 @@ merge = mergeBy compare
234||| @ f the function to combine elements with
318||| @ f the function to combine elements with
235||| @ xs the first vector of elements
319||| @ xs the first vector of elements
236||| @ ys the second vector of elements
320||| @ ys the second vector of elements
321+|||
322+||| ```idris example
323+||| zipWith (+) (fromList [1,2,3,4]) (fromList [5,6,7,8])
324+||| ```
237zipWith : (f : a -> b -> c) -> (xs : Vect n a) -> (ys : Vect n b) -> Vect n c
325zipWith : (f : a -> b -> c) -> (xs : Vect n a) -> (ys : Vect n b) -> Vect n c
238zipWith f [] [] = []
326zipWith f [] [] = []
239zipWith f (x::xs) (y::ys) = f x y :: zipWith f xs ys
327zipWith f (x::xs) (y::ys) = f x y :: zipWith f xs ys
240
328
241||| Combine three equal-length vectors into a vector with some function
329||| Combine three equal-length vectors into a vector with some function
330+|||
331+||| ```idris example
332+||| zipWith3 (\x,y,z => x+y+z) (fromList [1,2,3,4]) (fromList [5,6,7,8]) (fromList [1,1,1,1])
333+||| ```
242zipWith3 : (a -> b -> c -> d) -> (xs : Vect n a) -> (ys : Vect n b) -> (zs : Vect n c) -> Vect n d
334zipWith3 : (a -> b -> c -> d) -> (xs : Vect n a) -> (ys : Vect n b) -> (zs : Vect n c) -> Vect n d
243zipWith3 f [] [] [] = []
335zipWith3 f [] [] [] = []
244zipWith3 f (x::xs) (y::ys) (z::zs) = f x y z :: zipWith3 f xs ys zs
336zipWith3 f (x::xs) (y::ys) (z::zs) = f x y z :: zipWith3 f xs ys zs
245
337
246||| Combine two equal-length vectors pairwise
338||| Combine two equal-length vectors pairwise
339+|||
340+||| ```idris example
341+||| zip (fromList [1,2,3,4]) (fromList [1,2,3,4])
342+||| ```
247zip : (xs : Vect n a) -> (ys : Vect n b) -> Vect n (a, b)
343zip : (xs : Vect n a) -> (ys : Vect n b) -> Vect n (a, b)
248zip = zipWith (\x,y => (x,y))
344zip = zipWith (\x,y => (x,y))
249
345
250||| Combine three equal-length vectors elementwise into a vector of tuples
346||| Combine three equal-length vectors elementwise into a vector of tuples
347+|||
348+||| ```idris example
349+||| zip3 (fromList [1,2,3,4]) (fromList [1,2,3,4]) (fromList [1,2,3,4])
350+||| ```
251zip3 : (xs : Vect n a) -> (ys : Vect n b) -> (zs : Vect n c) -> Vect n (a, b, c)
351zip3 : (xs : Vect n a) -> (ys : Vect n b) -> (zs : Vect n c) -> Vect n (a, b, c)
252zip3 = zipWith3 (\x,y,z => (x,y,z))
352zip3 = zipWith3 (\x,y,z => (x,y,z))
253
353
254||| Convert a vector of pairs to a pair of vectors
354||| Convert a vector of pairs to a pair of vectors
355+|||
356+||| ```idris example
357+||| unzip (fromList [(1,2), (1,2)])
358+||| ```
255unzip : (xs : Vect n (a, b)) -> (Vect n a, Vect n b)
359unzip : (xs : Vect n (a, b)) -> (Vect n a, Vect n b)
256unzip [] = ([], [])
360unzip [] = ([], [])
257unzip ((l, r)::xs) with (unzip xs)
361unzip ((l, r)::xs) with (unzip xs)
258 | (lefts, rights) = (l::lefts, r::rights)
362 | (lefts, rights) = (l::lefts, r::rights)
259
363
260||| Convert a vector of three-tuples to a triplet of vectors
364||| Convert a vector of three-tuples to a triplet of vectors
365+|||
366+||| ```idris example
367+||| unzip3 (fromList [(1,2,3), (1,2,3)])
368+||| ```
261unzip3 : (xs : Vect n (a, b, c)) -> (Vect n a, Vect n b, Vect n c)
369unzip3 : (xs : Vect n (a, b, c)) -> (Vect n a, Vect n b, Vect n c)
262unzip3 [] = ([], [], [])
370unzip3 [] = ([], [], [])
263unzip3 ((l,c,r)::xs) with (unzip3 xs)
371unzip3 ((l,c,r)::xs) with (unzip3 xs)
@@ -299,6 +407,10 @@ implementation Functor (Vect n) where
299|||
407|||
300||| @ f the partial function (expressed by returning `Maybe`)
408||| @ f the partial function (expressed by returning `Maybe`)
301||| @ xs the vector to check for results
409||| @ xs the vector to check for results
410+|||
411+||| ```idris example
412+||| mapMaybe ((find (=='a')) . unpack) (fromList ["abc","ade","bgh","xyz"])
413+||| ```
302mapMaybe : (f : a -> Maybe b) -> (xs : Vect len a) -> (m : Nat ** Vect m b)
414mapMaybe : (f : a -> Maybe b) -> (xs : Vect len a) -> (m : Nat ** Vect m b)
303mapMaybe f [] = (_ ** [])
415mapMaybe f [] = (_ ** [])
304mapMaybe f (x::xs) =
416mapMaybe f (x::xs) =
@@ -323,16 +435,28 @@ implementation Foldable (Vect n) where
323--------------------------------------------------------------------------------
435--------------------------------------------------------------------------------
324
436
325||| Flatten a vector of equal-length vectors
437||| Flatten a vector of equal-length vectors
438+|||
439+||| ```idris example
440+||| concat [[1,2,3], [4,5,6]]
441+||| ```
326concat : (xss : Vect m (Vect n elem)) -> Vect (m * n) elem
442concat : (xss : Vect m (Vect n elem)) -> Vect (m * n) elem
327concat [] = []
443concat [] = []
328concat (v::vs) = v ++ concat vs
444concat (v::vs) = v ++ concat vs
329
445
330||| Foldr without seeding the accumulator
446||| Foldr without seeding the accumulator
447+|||
448+||| ```idris example
449+||| foldr1 (-) (fromList [1,2,3])
450+||| ```
331foldr1 : (t -> t -> t) -> Vect (S n) t -> t
451foldr1 : (t -> t -> t) -> Vect (S n) t -> t
332foldr1 f [x] = x
452foldr1 f [x] = x
333foldr1 f (x::y::xs) = f x (foldr1 f (y::xs))
453foldr1 f (x::y::xs) = f x (foldr1 f (y::xs))
334
454
335||| Foldl without seeding the accumulator
455||| Foldl without seeding the accumulator
456+|||
457+||| ```idris example
458+||| foldl1 (-) (fromList [1,2,3])
459+||| ```
336foldl1 : (t -> t -> t) -> Vect (S n) t -> t
460foldl1 : (t -> t -> t) -> Vect (S n) t -> t
337foldl1 f (x::xs) = foldl f x xs
461foldl1 f (x::xs) = foldl f x xs
338
462
@@ -342,6 +466,10 @@ foldl1 f (x::xs) = foldl f x xs
342
466
343||| The scanl function is similar to foldl, but returns all the intermediate
467||| The scanl function is similar to foldl, but returns all the intermediate
344||| accumulator states in the form of a vector.
468||| accumulator states in the form of a vector.
469+|||
470+||| ```idris example
471+||| scanl (-) 0 (fromList [1,2,3])
472+||| ```
345scanl : (res -> elem -> res) -> res -> Vect len elem -> Vect (S len) res
473scanl : (res -> elem -> res) -> res -> Vect len elem -> Vect (S len) res
346scanl f q [] = [q]
474scanl f q [] = [q]
347scanl f q (x::xs) = q :: scanl f (f q x) xs
475scanl f q (x::xs) = q :: scanl f (f q x) xs
@@ -350,6 +478,10 @@ scanl f q (x::xs) = q :: scanl f (f q x) xs
350||| starting value.
478||| starting value.
351||| It assumes the first element of the vector to be the starting value and then
479||| It assumes the first element of the vector to be the starting value and then
352||| starts the fold with the element following it.
480||| starts the fold with the element following it.
481+|||
482+||| ```idris example
483+||| scanl1 (-) (fromList [1,2,3])
484+||| ```
353scanl1 : (elem -> elem -> elem) -> Vect len elem -> Vect len elem
485scanl1 : (elem -> elem -> elem) -> Vect len elem -> Vect len elem
354scanl1 f [] = []
486scanl1 f [] = []
355scanl1 f (x::xs) = scanl f x xs
487scanl1 f (x::xs) = scanl f x xs
@@ -362,6 +494,10 @@ scanl1 f (x::xs) = scanl f x xs
362||| @ p the equality test
494||| @ p the equality test
363||| @ e the item to search for
495||| @ e the item to search for
364||| @ xs the vector to search in
496||| @ xs the vector to search in
497+|||
498+||| ```idris example
499+||| elemBy (==) 2 [1,2,3,4]
500+||| ```
365elemBy : (p : elem -> elem -> Bool) -> (e : elem) -> (xs : Vect len elem) -> Bool
501elemBy : (p : elem -> elem -> Bool) -> (e : elem) -> (xs : Vect len elem) -> Bool
366elemBy p e [] = False
502elemBy p e [] = False
367elemBy p e (x::xs) = p e x || elemBy p e xs
503elemBy p e (x::xs) = p e x || elemBy p e xs
@@ -369,17 +505,29 @@ elemBy p e (x::xs) = p e x || elemBy p e xs
369||| Use the default Boolean equality on elements to search for an item
505||| Use the default Boolean equality on elements to search for an item
370||| @ x what to search for
506||| @ x what to search for
371||| @ xs where to search
507||| @ xs where to search
508+|||
509+||| ```idris example
510+||| elem 3 [1,2,3,4]
511+||| ```
372elem : Eq elem => (x : elem) -> (xs : Vect len elem) -> Bool
512elem : Eq elem => (x : elem) -> (xs : Vect len elem) -> Bool
373elem = elemBy (==)
513elem = elemBy (==)
374
514
375||| Find the association of some key with a user-provided comparison
515||| Find the association of some key with a user-provided comparison
376||| @ p the comparison operator for keys (True if they match)
516||| @ p the comparison operator for keys (True if they match)
377||| @ e the key to look for
517||| @ e the key to look for
518+|||
519+||| ```idris example
520+||| lookupBy (==) 2 [(1, 'a'), (2, 'b'), (3, 'c')]
521+||| ```
378lookupBy : (p : key -> key -> Bool) -> (e : key) -> (xs : Vect n (key, val)) -> Maybe val
522lookupBy : (p : key -> key -> Bool) -> (e : key) -> (xs : Vect n (key, val)) -> Maybe val
379lookupBy p e [] = Nothing
523lookupBy p e [] = Nothing
380lookupBy p e ((l, r)::xs) = if p e l then Just r else lookupBy p e xs
524lookupBy p e ((l, r)::xs) = if p e l then Just r else lookupBy p e xs
381
525
382||| Find the assocation of some key using the default Boolean equality test
526||| Find the assocation of some key using the default Boolean equality test
527+|||
528+||| ```idris example
529+||| lookup 3 [(1, 'a'), (2, 'b'), (3, 'c')]
530+||| ```
383lookup : Eq key => key -> Vect n (key, val) -> Maybe val
531lookup : Eq key => key -> Vect n (key, val) -> Maybe val
384lookup = lookupBy (==)
532lookup = lookupBy (==)
385
533
@@ -387,11 +535,19 @@ lookup = lookupBy (==)
387||| @ p the comparison operator
535||| @ p the comparison operator
388||| @ elems the vector to search
536||| @ elems the vector to search
389||| @ xs what to search for
537||| @ xs what to search for
538+|||
539+||| ```idris example
540+||| hasAnyBy (==) [2,5] [1,2,3,4]
541+||| ```
390hasAnyBy : (p : elem -> elem -> Bool) -> (elems : Vect m elem) -> (xs : Vect len elem) -> Bool
542hasAnyBy : (p : elem -> elem -> Bool) -> (elems : Vect m elem) -> (xs : Vect len elem) -> Bool
391hasAnyBy p elems [] = False
543hasAnyBy p elems [] = False
392hasAnyBy p elems (x::xs) = elemBy p x elems || hasAnyBy p elems xs
544hasAnyBy p elems (x::xs) = elemBy p x elems || hasAnyBy p elems xs
393
545
394||| Check if any element of xs is found in elems using the default Boolean equality test
546||| Check if any element of xs is found in elems using the default Boolean equality test
547+|||
548+||| ```idris example
549+||| hasAny [2,5] [1,2,3,4]
550+||| ```
395hasAny : Eq elem => Vect m elem -> Vect len elem -> Bool
551hasAny : Eq elem => Vect m elem -> Vect len elem -> Bool
396hasAny = hasAnyBy (==)
552hasAny = hasAnyBy (==)
397
553
@@ -401,30 +557,62 @@ hasAny = hasAnyBy (==)
401
557
402||| Find the first element of the vector that satisfies some test
558||| Find the first element of the vector that satisfies some test
403||| @ p the test to satisfy
559||| @ p the test to satisfy
560+|||
561+||| ```idris example
562+||| find (== 3) [1,2,3,4]
563+||| ```
404find : (p : elem -> Bool) -> (xs : Vect len elem) -> Maybe elem
564find : (p : elem -> Bool) -> (xs : Vect len elem) -> Maybe elem
405find p [] = Nothing
565find p [] = Nothing
406find p (x::xs) = if p x then Just x else find p xs
566find p (x::xs) = if p x then Just x else find p xs
407
567
408||| Find the index of the first element of the vector that satisfies some test
568||| Find the index of the first element of the vector that satisfies some test
569+|||
570+||| ```idris example
571+||| findIndex (== 3) [1,2,3,4]
572+||| ```
409findIndex : (elem -> Bool) -> Vect len elem -> Maybe (Fin len)
573findIndex : (elem -> Bool) -> Vect len elem -> Maybe (Fin len)
410findIndex p [] = Nothing
574findIndex p [] = Nothing
411findIndex p (x :: xs) = if p x then Just 0 else map FS (findIndex p xs)
575findIndex p (x :: xs) = if p x then Just 0 else map FS (findIndex p xs)
412
576
413||| Find the indices of all elements that satisfy some test
577||| Find the indices of all elements that satisfy some test
578+|||
579+||| ```idris example
580+||| findIndices (< 3) [1,2,3,4]
581+||| ```
414findIndices : (elem -> Bool) -> Vect m elem -> List (Fin m)
582findIndices : (elem -> Bool) -> Vect m elem -> List (Fin m)
415findIndices p [] = []
583findIndices p [] = []
416findIndices p (x :: xs) = let is = map FS $ findIndices p xs
584findIndices p (x :: xs) = let is = map FS $ findIndices p xs
417 in if p x then 0 :: is else is
585 in if p x then 0 :: is else is
418
586
587+||| Find the index of the first element of the vector that satisfies some test
588+|||
589+||| ```idris example
590+||| elemIndexBy (==) 3 [1,2,3,4]
591+||| ```
419elemIndexBy : (elem -> elem -> Bool) -> elem -> Vect m elem -> Maybe (Fin m)
592elemIndexBy : (elem -> elem -> Bool) -> elem -> Vect m elem -> Maybe (Fin m)
420elemIndexBy p e = findIndex $ p e
593elemIndexBy p e = findIndex $ p e
421
594
595+||| Find the index of the first element of the vector equal to the given one.
596+|||
597+||| ```idris example
598+||| elemIndex 3 [1,2,3,4]
599+||| ```
422elemIndex : Eq elem => elem -> Vect m elem -> Maybe (Fin m)
600elemIndex : Eq elem => elem -> Vect m elem -> Maybe (Fin m)
423elemIndex = elemIndexBy (==)
601elemIndex = elemIndexBy (==)
424
602
603+||| Find the indices of all elements that satisfy some test
604+|||
605+||| ```idris example
606+||| elemIndicesBy (<=) 3 [1,2,3,4]
607+||| ```
425elemIndicesBy : (elem -> elem -> Bool) -> elem -> Vect m elem -> List (Fin m)
608elemIndicesBy : (elem -> elem -> Bool) -> elem -> Vect m elem -> List (Fin m)
426elemIndicesBy p e = findIndices $ p e
609elemIndicesBy p e = findIndices $ p e
427
610
611+||| Find the indices of all elements uquals to the given one
612+|||
613+||| ```idris example
614+||| elemIndices 3 [1,2,3,4,3]
615+||| ```
428elemIndices : Eq elem => elem -> Vect m elem -> List (Fin m)
616elemIndices : Eq elem => elem -> Vect m elem -> List (Fin m)
429elemIndices = elemIndicesBy (==)
617elemIndices = elemIndicesBy (==)
430
618
@@ -433,6 +621,10 @@ elemIndices = elemIndicesBy (==)
433--------------------------------------------------------------------------------
621--------------------------------------------------------------------------------
434
622
435||| Find all elements of a vector that satisfy some test
623||| Find all elements of a vector that satisfy some test
624+|||
625+||| ```idris example
626+||| filter (< 3) (fromList [1,2,3,4])
627+||| ```
436filter : (elem -> Bool) -> Vect len elem -> (p ** Vect p elem)
628filter : (elem -> Bool) -> Vect len elem -> (p ** Vect p elem)
437filter p [] = ( _ ** [] )
629filter p [] = ( _ ** [] )
438filter p (x::xs) =
630filter p (x::xs) =
@@ -443,6 +635,10 @@ filter p (x::xs) =
443 (_ ** tail)
635 (_ ** tail)
444
636
445||| Make the elements of some vector unique by some test
637||| Make the elements of some vector unique by some test
638+|||
639+||| ```idris example
640+||| nubBy (==) (fromList [1,2,2,3,4,4])
641+||| ```
446nubBy : (elem -> elem -> Bool) -> Vect len elem -> (p ** Vect p elem)
642nubBy : (elem -> elem -> Bool) -> Vect len elem -> (p ** Vect p elem)
447nubBy = nubBy' []
643nubBy = nubBy' []
448 where
644 where
@@ -454,15 +650,29 @@ nubBy = nubBy' []
454 | (_ ** tail) = (_ ** x::tail)
650 | (_ ** tail) = (_ ** x::tail)
455
651
456||| Make the elements of some vector unique by the default Boolean equality
652||| Make the elements of some vector unique by the default Boolean equality
653+|||
654+||| ```idris example
655+||| nub (fromList [1,2,2,3,4,4])
656+||| ```
457nub : Eq elem => Vect len elem -> (p ** Vect p elem)
657nub : Eq elem => Vect len elem -> (p ** Vect p elem)
458nub = nubBy (==)
658nub = nubBy (==)
459
659
660+||| Delete first element from list according to some test
661+|||
662+||| ```idris example
663+||| deleteBy (<) 3 (fromList [1,2,2,3,4,4])
664+||| ```
460deleteBy : (elem -> elem -> Bool) -> elem -> Vect len elem -> (p ** Vect p elem)
665deleteBy : (elem -> elem -> Bool) -> elem -> Vect len elem -> (p ** Vect p elem)
461deleteBy _ _ [] = (_ ** [])
666deleteBy _ _ [] = (_ ** [])
462deleteBy eq x (y::ys) =
667deleteBy eq x (y::ys) =
463 let (len ** zs) = deleteBy eq x ys
668 let (len ** zs) = deleteBy eq x ys
464 in if x `eq` y then (_ ** ys) else (S len ** y ::zs)
669 in if x `eq` y then (_ ** ys) else (S len ** y ::zs)
465
670
671+||| Delete first element from list equal to the given one
672+|||
673+||| ```idris example
674+||| delete 2 (fromList [1,2,2,3,4,4])
675+||| ```
466delete : (Eq elem) => elem -> Vect len elem -> (p ** Vect p elem)
676delete : (Eq elem) => elem -> Vect len elem -> (p ** Vect p elem)
467delete = deleteBy (==)
677delete = deleteBy (==)
468
678
@@ -477,11 +687,21 @@ delete = deleteBy (==)
477|||
687|||
478||| @ n the index to split at
688||| @ n the index to split at
479||| @ xs the `Vect` to split in two
689||| @ xs the `Vect` to split in two
690+|||
691+||| ```idris example
692+||| splitAt 2 (fromList [1,2,3,4])
693+||| ```
480splitAt : (n : Nat) -> (xs : Vect (n + m) elem) -> (Vect n elem, Vect m elem)
694splitAt : (n : Nat) -> (xs : Vect (n + m) elem) -> (Vect n elem, Vect m elem)
481splitAt Z xs = ([], xs)
695splitAt Z xs = ([], xs)
482splitAt (S k) (x :: xs) with (splitAt k xs)
696splitAt (S k) (x :: xs) with (splitAt k xs)
483 | (tk, dr) = (x :: tk, dr)
697 | (tk, dr) = (x :: tk, dr)
484
698
699+||| A tuple where the first element is a `Vect` of the `n` elements passing given test
700+||| and the second element is a `Vect` of the remaining elements of the original.
701+|||
702+||| ```idris example
703+||| partition (== 2) (fromList [1,2,3,2,4])
704+||| ```
485partition : (elem -> Bool) -> Vect len elem -> ((p ** Vect p elem), (q ** Vect q elem))
705partition : (elem -> Bool) -> Vect len elem -> ((p ** Vect p elem), (q ** Vect q elem))
486partition p [] = ((_ ** []), (_ ** []))
706partition p [] = ((_ ** []), (_ ** []))
487partition p (x::xs) =
707partition p (x::xs) =
@@ -495,17 +715,37 @@ partition p (x::xs) =
495-- Predicates
715-- Predicates
496--------------------------------------------------------------------------------
716--------------------------------------------------------------------------------
497
717
718+||| Verify vector prefix
719+|||
720+||| ```idris example
721+||| isPrefixOfBy (==) (fromList [1,2]) (fromList [1,2,3,4])
722+||| ```
498isPrefixOfBy : (elem -> elem -> Bool) -> Vect m elem -> Vect len elem -> Bool
723isPrefixOfBy : (elem -> elem -> Bool) -> Vect m elem -> Vect len elem -> Bool
499isPrefixOfBy p [] right = True
724isPrefixOfBy p [] right = True
500isPrefixOfBy p left [] = False
725isPrefixOfBy p left [] = False
501isPrefixOfBy p (x::xs) (y::ys) = p x y && isPrefixOfBy p xs ys
726isPrefixOfBy p (x::xs) (y::ys) = p x y && isPrefixOfBy p xs ys
502
727
728+||| Verify vector prefix
729+|||
730+||| ```idris example
731+||| isPrefixOf (fromList [1,2]) (fromList [1,2,3,4])
732+||| ```
503isPrefixOf : Eq elem => Vect m elem -> Vect len elem -> Bool
733isPrefixOf : Eq elem => Vect m elem -> Vect len elem -> Bool
504isPrefixOf = isPrefixOfBy (==)
734isPrefixOf = isPrefixOfBy (==)
505
735
736+||| Verify vector suffix
737+|||
738+||| ```idris example
739+||| isSuffixOfBy (==) (fromList [3,4]) (fromList [1,2,3,4])
740+||| ```
506isSuffixOfBy : (elem -> elem -> Bool) -> Vect m elem -> Vect len elem -> Bool
741isSuffixOfBy : (elem -> elem -> Bool) -> Vect m elem -> Vect len elem -> Bool
507isSuffixOfBy p left right = isPrefixOfBy p (reverse left) (reverse right)
742isSuffixOfBy p left right = isPrefixOfBy p (reverse left) (reverse right)
508
743
744+||| Verify vector suffix
745+|||
746+||| ```idris example
747+||| isSuffixOf (fromList [3,4]) (fromList [1,2,3,4])
748+||| ```
509isSuffixOf : Eq elem => Vect m elem -> Vect len elem -> Bool
749isSuffixOf : Eq elem => Vect m elem -> Vect len elem -> Bool
510isSuffixOf = isSuffixOfBy (==)
750isSuffixOf = isSuffixOfBy (==)
511
751
@@ -513,10 +753,20 @@ isSuffixOf = isSuffixOfBy (==)
513-- Conversions
753-- Conversions
514--------------------------------------------------------------------------------
754--------------------------------------------------------------------------------
515
755
756+||| Convert Maybe type into Vect
757+|||
758+||| ```idris example
759+||| maybeToVect (Just 2)
760+||| ```
516maybeToVect : Maybe elem -> (p ** Vect p elem)
761maybeToVect : Maybe elem -> (p ** Vect p elem)
517maybeToVect Nothing = (_ ** [])
762maybeToVect Nothing = (_ ** [])
518maybeToVect (Just j) = (_ ** [j])
763maybeToVect (Just j) = (_ ** [j])
519
764
765+||| Convert first element of Vect (if exists) into Maybe.
766+|||
767+||| ```idris example
768+||| vectToMaybe [2]
769+||| ```
520vectToMaybe : Vect len elem -> Maybe elem
770vectToMaybe : Vect len elem -> Maybe elem
521vectToMaybe [] = Nothing
771vectToMaybe [] = Nothing
522vectToMaybe (x::xs) = Just x
772vectToMaybe (x::xs) = Just x
@@ -525,6 +775,11 @@ vectToMaybe (x::xs) = Just x
525-- Misc
775-- Misc
526--------------------------------------------------------------------------------
776--------------------------------------------------------------------------------
527
777
778+||| Filter out Nothings from Vect
779+|||
780+||| ```idris example
781+||| catMaybes [Just 1, Just 2, Nothing, Nothing, Just 5]
782+||| ```
528catMaybes : Vect n (Maybe elem) -> (p ** Vect p elem)
783catMaybes : Vect n (Maybe elem) -> (p ** Vect p elem)
529catMaybes [] = (_ ** [])
784catMaybes [] = (_ ** [])
530catMaybes (Nothing::xs) = catMaybes xs
785catMaybes (Nothing::xs) = catMaybes xs
@@ -532,6 +787,11 @@ catMaybes ((Just j)::xs) =
532 let (_ ** tail) = catMaybes xs
787 let (_ ** tail) = catMaybes xs
533 in (_ ** j::tail)
788 in (_ ** j::tail)
534
789
790+||| Get diagonal elements
791+|||
792+||| ```idris example
793+||| diag [[1,2,3], [4,5,6], [7,8,9]]
794+||| ```
535diag : Vect len (Vect len elem) -> Vect len elem
795diag : Vect len (Vect len elem) -> Vect len elem
536diag [] = []
796diag [] = []
537diag ((x::xs)::xss) = x :: diag (map tail xss)
797diag ((x::xs)::xss) = x :: diag (map tail xss)
@@ -545,6 +805,10 @@ range {len=S _} = FZ :: map FS range
545||| This is like zipping all the inner `Vect`s together and is equivalent to `traverse id` (`transposeTraverse`).
805||| This is like zipping all the inner `Vect`s together and is equivalent to `traverse id` (`transposeTraverse`).
546|||
806|||
547||| As the types ensure rectangularity, this is an involution, unlike `Prelude.List.transpose`.
807||| As the types ensure rectangularity, this is an involution, unlike `Prelude.List.transpose`.
808+|||
809+||| ```idris example
810+||| transpose [[1,2], [3,4], [5,6], [7,8]]
811+||| ```
548transpose : Vect m (Vect n elem) -> Vect n (Vect m elem)
812transpose : Vect m (Vect n elem) -> Vect n (Vect m elem)
549transpose [] = replicate _ [] -- = [| [] |]
813transpose [] = replicate _ [] -- = [| [] |]
550transpose (x :: xs) = zipWith (::) x (transpose xs) -- = [| x :: xs |]
814transpose (x :: xs) = zipWith (::) x (transpose xs) -- = [| x :: xs |]
libs/base/System.idr−1
@@ -100,7 +100,6 @@ record Clock where
100 nanoseconds : Integer
100 nanoseconds : Integer
101
101
102||| Get the system's wall clock time.
102||| Get the system's wall clock time.
103−||| At the moment, this returns 0 on Windows
104clockTime : IO Clock
103clockTime : IO Clock
105clockTime
104clockTime
106 = do vm <- getMyVM
105 = do vm <- getMyVM
libs/contrib/Control/Algebra/Lattice.idr+16
@@ -25,6 +25,9 @@ implementation JoinSemilattice Nat where
25implementation Ord a => JoinSemilattice (MaxiphobicHeap a) where
25implementation Ord a => JoinSemilattice (MaxiphobicHeap a) where
26 join = merge
26 join = merge
27
27
28+JoinSemilattice Bool where
29+ join a b = a || b
30+
28||| Sets equipped with a binary operation that is commutative, associative and
31||| Sets equipped with a binary operation that is commutative, associative and
29||| idempotent. Must satisfy the following laws:
32||| idempotent. Must satisfy the following laws:
30|||
33|||
@@ -42,6 +45,9 @@ interface MeetSemilattice a where
42implementation MeetSemilattice Nat where
45implementation MeetSemilattice Nat where
43 meet = minimum
46 meet = minimum
44
47
48+MeetSemilattice Bool where
49+ meet a b = a && b
50+
45||| Sets equipped with a binary operation that is commutative, associative and
51||| Sets equipped with a binary operation that is commutative, associative and
46||| idempotent and supplied with a unitary element. Must satisfy the following
52||| idempotent and supplied with a unitary element. Must satisfy the following
47||| laws:
53||| laws:
@@ -63,6 +69,9 @@ interface JoinSemilattice a => BoundedJoinSemilattice a where
63implementation BoundedJoinSemilattice Nat where
69implementation BoundedJoinSemilattice Nat where
64 bottom = Z
70 bottom = Z
65
71
72+BoundedJoinSemilattice Bool where
73+ bottom = False
74+
66||| Sets equipped with a binary operation that is commutative, associative and
75||| Sets equipped with a binary operation that is commutative, associative and
67||| idempotent and supplied with a unitary element. Must satisfy the following
76||| idempotent and supplied with a unitary element. Must satisfy the following
68||| laws:
77||| laws:
@@ -81,6 +90,9 @@ implementation BoundedJoinSemilattice Nat where
81interface MeetSemilattice a => BoundedMeetSemilattice a where
90interface MeetSemilattice a => BoundedMeetSemilattice a where
82 top : a
91 top : a
83
92
93+BoundedMeetSemilattice Bool where
94+ top = True
95+
84||| Sets equipped with two binary operations that are both commutative,
96||| Sets equipped with two binary operations that are both commutative,
85||| associative and idempotent, along with absorbtion laws for relating the two
97||| associative and idempotent, along with absorbtion laws for relating the two
86||| binary operations. Must satisfy the following:
98||| binary operations. Must satisfy the following:
@@ -101,6 +113,8 @@ interface (JoinSemilattice a, MeetSemilattice a) => Lattice a where { }
101
113
102implementation Lattice Nat where { }
114implementation Lattice Nat where { }
103
115
116+Lattice Bool where { }
117+
104||| Sets equipped with two binary operations that are both commutative,
118||| Sets equipped with two binary operations that are both commutative,
105||| associative and idempotent and supplied with neutral elements, along with
119||| associative and idempotent and supplied with neutral elements, along with
106||| absorbtion laws for relating the two binary operations. Must satisfy the
120||| absorbtion laws for relating the two binary operations. Must satisfy the
@@ -122,3 +136,5 @@ implementation Lattice Nat where { }
122||| forall a, meet a top == top
136||| forall a, meet a top == top
123||| forall a, join a bottom == bottom
137||| forall a, join a bottom == bottom
124interface (BoundedJoinSemilattice a, BoundedMeetSemilattice a) => BoundedLattice a where { }
138interface (BoundedJoinSemilattice a, BoundedMeetSemilattice a) => BoundedLattice a where { }
139+
140+BoundedLattice Bool where { }
libs/contrib/Control/Algebra/Laws.idr+128−80
@@ -6,98 +6,146 @@ import Interfaces.Verified
6
6
7%access export
7%access export
8
8
9+||| -(-x) = x in any verified group.
10+inverseSquaredIsIdentity : VerifiedGroup t => (x : t) ->
11+ inverse (inverse x) = x
12+inverseSquaredIsIdentity x =
13+ let
14+ ix = inverse x
15+ iix = inverse ix
16+ in
17+ rewrite sym $ monoidNeutralIsNeutralR iix in
18+ rewrite sym $ groupInverseIsInverseL x in
19+ rewrite sym $ semigroupOpIsAssociative x ix iix in
20+ rewrite groupInverseIsInverseL ix in
21+ monoidNeutralIsNeutralL x
22+
9−||| A prof that -0 = 0 in any verified group.
23+||| -0 = 0 in any verified group.
10−inverseNeutralIsNeutral : VerifiedGroup t => inverse (the t A.neutral) = A.neutral
24+inverseNeutralIsNeutral : VerifiedGroup t =>
25+ inverse (the t A.neutral) = A.neutral
11inverseNeutralIsNeutral {t} =
26inverseNeutralIsNeutral {t} =
12− let zero = the t neutral
27+ let e = the t neutral in
13− step1 = cong {f = (<+> inverse zero)} (the (zero = zero) Refl)
14− step2 = replace {P = \x => zero <+> inverse zero = x} (groupInverseIsInverseL zero) step1
28+ rewrite sym $ cong {f = inverse} (groupInverseIsInverseL e) in
15− in
16− replace {P = \x => x = neutral} (monoidNeutralIsNeutralR $ inverse zero) step2
29+ rewrite monoidNeutralIsNeutralR $ inverse e in
30+ inverseSquaredIsIdentity e
17
31
18−||| A proof that -(-x) = x in any verified group.
32+||| -(x + y) = -y + -x in any verified group.
19−inverseSquaredIsIdentity : VerifiedGroup t => (x : t) -> inverse (inverse x) = x
33+inverseOfSum : VerifiedGroup t => (l, r : t) ->
20−inverseSquaredIsIdentity {t} x =
34+ inverse (l <+> r) = inverse r <+> inverse l
35+inverseOfSum {t} l r =
36+ let
21− let zero = the t neutral
37+ e = the t neutral
22− step1 = cong {f = (x <+>)} (groupInverseIsInverseL (inverse x))
38+ il = inverse l
23− step2 = replace {P = \r => r = x <+> neutral} (semigroupOpIsAssociative x (inverse x) (inverse $ inverse x)) step1
39+ ir = inverse r
24− step3 = replace {P = \r => r <+> inverse (inverse x) = x <+> neutral} (groupInverseIsInverseL x) step2
40+ sum = l <+> r
41+ ilr = inverse sum
42+ iril = ir <+> il
43+ ile = il <+> e
44+ in
45+ -- expand
25− step4 = replace {P = \r => r = x <+> neutral} (monoidNeutralIsNeutralR (inverse $ inverse x)) step3
46+ rewrite sym $ monoidNeutralIsNeutralR ilr in
26− in
47+ rewrite sym $ groupInverseIsInverseR r in
48+ rewrite sym $ monoidNeutralIsNeutralL ir in
49+ rewrite sym $ groupInverseIsInverseR l in
50+ -- shuffle
51+ rewrite semigroupOpIsAssociative ir il l in
52+ rewrite sym $ semigroupOpIsAssociative iril l r in
53+ rewrite sym $ semigroupOpIsAssociative iril sum ilr in
54+ -- contract
55+ rewrite sym $ monoidNeutralIsNeutralL il in
56+ rewrite groupInverseIsInverseL sum in
57+ rewrite sym $ semigroupOpIsAssociative (ir <+> ile) l ile in
58+ rewrite semigroupOpIsAssociative l il e in
59+ rewrite groupInverseIsInverseL l in
27− replace {P = \r => inverse (inverse x) = r} (monoidNeutralIsNeutralL x) step4
60+ rewrite monoidNeutralIsNeutralL e in
61+ Refl
28
62
29−||| A proof that -(x + y) = -x - y in any verified abelian group.
63+||| -(x + y) = -x + -y in any verified abelian group.
30−inverseDistributesOverGroupOp : VerifiedAbelianGroup t => (l, r : t) -> inverse (l <+> r) = inverse l <+> inverse r
64+inverseDistributesOverGroupOp : VerifiedAbelianGroup t => (l, r : t) ->
65+ inverse (l <+> r) = inverse l <+> inverse r
31−inverseDistributesOverGroupOp {t} l r =
66+inverseDistributesOverGroupOp l r =
32− let step1 = replace {P = \x => x = neutral} (sym $ groupInverseIsInverseL (l <+> r)) $ the (the t neutral = neutral) Refl
33− step2 = cong {f = ((inverse r) <+>) . ((inverse l) <+>)} step1
34− step3 = replace {P = \x => inverse r <+> (inverse l <+> (l <+> r <+> inverse (l <+> r))) = inverse r <+> x} (monoidNeutralIsNeutralL (inverse l)) step2
35− step4 = replace {P = \x => x = inverse r <+> inverse l} (semigroupOpIsAssociative (inverse r) (inverse l) (l <+> r <+> inverse (l <+> r))) step3
36− step5 = replace {P = \x => x = inverse r <+> inverse l} (semigroupOpIsAssociative (inverse r <+> inverse l) (l <+> r) (inverse (l <+> r))) step4
37− step6 = replace {P = \x => x <+> inverse (l <+> r) = inverse r <+> inverse l} (semigroupOpIsAssociative (inverse r <+> inverse l) l r) step5
38− step7 = replace {P = \x => x <+> r <+> inverse (l <+> r) = inverse r <+> inverse l} (sym $ semigroupOpIsAssociative (inverse r) (inverse l) l) step6
39− step8 = replace {P = \x => inverse r <+> x <+> r <+> inverse (l <+> r) = inverse r <+> inverse l} (groupInverseIsInverseR l) step7
40− step9 = replace {P = \x => x <+> r <+> inverse (l <+> r) = inverse r <+> inverse l} (monoidNeutralIsNeutralL (inverse r)) step8
41− step10 = replace {P = \x => x <+> inverse (l <+> r) = inverse r <+> inverse l} (groupInverseIsInverseR r) step9
42− step11 = replace {P = \x => x = inverse r <+> inverse l} (monoidNeutralIsNeutralR (inverse (l <+> r))) step10
43− in
44− replace {P = \x => inverse (l <+> r) = x} (abelianGroupOpIsCommutative (inverse r) (inverse l)) step11
67+ rewrite abelianGroupOpIsCommutative (inverse l) (inverse r) in
68+ inverseOfSum l r
45
69
46−||| A proof that anything multiplied by zero yields zero back.
70+||| Anything multiplied by zero yields zero back in a verified ring.
47−multNeutralAbsorbingL : VerifiedRingWithUnity t => (r : t) -> A.neutral <.> r = A.neutral
71+multNeutralAbsorbingL : VerifiedRing t => (r : t) ->
72+ A.neutral <.> r = A.neutral
48−multNeutralAbsorbingL r =
73+multNeutralAbsorbingL {t} r =
49− let step1 = the (unity <.> r = r) (ringWithUnityIsUnityR r)
74+ let
75+ e = the t neutral
76+ ir = inverse r
77+ exr = e <.> r
78+ iexr = inverse exr
79+ in
50− step2 = replace {P = \x => x <.> r = r} (sym $ monoidNeutralIsNeutralR unity) step1
80+ rewrite sym $ monoidNeutralIsNeutralR exr in
51− step3 = replace {P = \x => x = r} (ringOpIsDistributiveR neutral unity r) step2
81+ rewrite sym $ groupInverseIsInverseR exr in
52− step4 = replace {P = \x => neutral <.> r <+> x = r} (ringWithUnityIsUnityR r) step3
53− step5 = cong {f = \x => x <+> inverse r} step4
54− step6 = replace {P = \x => x = r <+> inverse r} (sym $ semigroupOpIsAssociative (neutral <.> r) r (inverse r)) step5
82+ rewrite sym $ semigroupOpIsAssociative iexr exr ((iexr <+> exr) <.> r) in
55− step7 = replace {P = \x => neutral <.> r <+> x = x} (groupInverseIsInverseL r) step6
83+ rewrite groupInverseIsInverseR exr in
56− in
84+ rewrite sym $ ringOpIsDistributiveR e e r in
57− replace {P = \x => x = neutral} (monoidNeutralIsNeutralL (neutral <.> r)) step7
85+ rewrite monoidNeutralIsNeutralR e in
86+ groupInverseIsInverseR exr
58
87
59−||| A proof that anything multiplied by zero yields zero back.
88+||| Anything multiplied by zero yields zero back in a verified ring.
60−multNeutralAbsorbingR : VerifiedRingWithUnity t => (l : t) -> l <.> A.neutral = A.neutral
89+multNeutralAbsorbingR : VerifiedRing t => (l : t) ->
90+ l <.> A.neutral = A.neutral
61−multNeutralAbsorbingR l =
91+multNeutralAbsorbingR {t} l =
62− let step1 = the (l <.> unity = l) (ringWithUnityIsUnityL l)
92+ let
63− step2 = replace {P = \x => l <.> x = l} (sym $ monoidNeutralIsNeutralR unity) step1
93+ e = the t neutral
64− step3 = replace {P = \x => x = l} (ringOpIsDistributiveL l neutral unity) step2
94+ il = inverse l
65− step4 = replace {P = \x => l <.> neutral <+> x = l} (ringWithUnityIsUnityL l) step3
95+ lxe = l <.> e
66− step5 = cong {f = \x => x <+> inverse l} step4
96+ ilxe = inverse lxe
97+ in
98+ rewrite sym $ monoidNeutralIsNeutralL lxe in
99+ rewrite sym $ groupInverseIsInverseL lxe in
67− step6 = replace {P = \x => x = l <+> inverse l} (sym $ semigroupOpIsAssociative (l <.> neutral) l (inverse l)) step5
100+ rewrite semigroupOpIsAssociative (l <.> (lxe <+> ilxe)) lxe ilxe in
68− step7 = replace {P = \x => l <.> neutral <+> x = x} (groupInverseIsInverseL l) step6
101+ rewrite groupInverseIsInverseL lxe in
69− in
102+ rewrite sym $ ringOpIsDistributiveL l e e in
70− replace {P = \x => x = neutral} (monoidNeutralIsNeutralL (l <.> neutral)) step7
103+ rewrite monoidNeutralIsNeutralL e in
104+ groupInverseIsInverseL lxe
71
105
72−||| A proof that inverse operator can be extracted before multiplication
106+||| Inverse operator can be extracted before multiplication.
73||| (-x)y = -(xy)
107||| (-x)y = -(xy)
74−multInverseInversesL : VerifiedRingWithUnity t => (l, r : t) -> inverse l <.> r = inverse (l <.> r)
108+multInverseInversesL : VerifiedRing t => (l, r : t) ->
109+ inverse l <.> r = inverse (l <.> r)
75multInverseInversesL l r =
110multInverseInversesL l r =
111+ let
112+ il = inverse l
113+ lxr = l <.> r
114+ ilxr = il <.> r
115+ i_lxr = inverse lxr
116+ in
117+ rewrite sym $ monoidNeutralIsNeutralR ilxr in
118+ rewrite sym $ groupInverseIsInverseR lxr in
119+ rewrite sym $ semigroupOpIsAssociative i_lxr lxr ilxr in
120+ rewrite sym $ ringOpIsDistributiveR l il r in
76− let step1 = replace {P = \x => x <.> r = neutral} (sym $ groupInverseIsInverseL l) (multNeutralAbsorbingL r)
121+ rewrite groupInverseIsInverseL l in
77− step2 = replace {P = \x => x = neutral} (ringOpIsDistributiveR l (inverse l) r) step1
122+ rewrite multNeutralAbsorbingL r in
78− step3 = cong {f = ((inverse (l <.> r)) <+>)} step2
79− step4 = replace {P = \x => inverse (l <.> r) <+> (l <.> r <+> inverse l <.> r) = x} (monoidNeutralIsNeutralL (inverse (l <.> r))) step3
123+ monoidNeutralIsNeutralL i_lxr
80− step5 = replace {P = \x => x = inverse (l <.> r)} (semigroupOpIsAssociative (inverse (l <.> r)) (l <.> r) (inverse l <.> r)) step4
81− step6 = replace {P = \x => x <+> inverse l <.> r = inverse (l <.> r)} (groupInverseIsInverseR (l <.> r)) step5
82− in
83− replace {P = \x => x = inverse (l <.> r)} (monoidNeutralIsNeutralR (inverse l <.> r)) step6
84
124
85−||| A proof that inverse operator can be extracted before multiplication
125+||| Inverse operator can be extracted before multiplication.
86||| x(-y) = -(xy)
126||| x(-y) = -(xy)
87−multInverseInversesR : VerifiedRingWithUnity t => (l, r : t) -> l <.> inverse r = inverse (l <.> r)
127+multInverseInversesR : VerifiedRing t => (l, r : t) ->
128+ l <.> inverse r = inverse (l <.> r)
88multInverseInversesR l r =
129multInverseInversesR l r =
89− let step1 = replace {P = \x => l <.> x = neutral} (sym $ groupInverseIsInverseL r) (multNeutralAbsorbingR l)
130+ let
90− step2 = replace {P = \x => x = neutral} (ringOpIsDistributiveL l r (inverse r)) step1
131+ ir = inverse r
91− step3 = cong {f = ((inverse (l <.> r)) <+>)} step2
132+ lxr = l <.> r
133+ lxir = l <.> ir
134+ ilxr = inverse lxr
135+ in
92− step4 = replace {P = \x => inverse (l <.> r) <+> (l <.> r <+> l <.> inverse r) = x} (monoidNeutralIsNeutralL (inverse (l <.> r))) step3
136+ rewrite sym $ monoidNeutralIsNeutralL lxir in
137+ rewrite sym $ groupInverseIsInverseL lxr in
93− step5 = replace {P = \x => x = inverse (l <.> r)} (semigroupOpIsAssociative (inverse (l <.> r)) (l <.> r) (l <.> inverse r)) step4
138+ rewrite semigroupOpIsAssociative lxir lxr ilxr in
139+ rewrite sym $ ringOpIsDistributiveL l ir r in
94− step6 = replace {P = \x => x <+> l <.> inverse r = inverse (l <.> r)} (groupInverseIsInverseR (l <.> r)) step5
140+ rewrite groupInverseIsInverseR r in
95− in
141+ rewrite multNeutralAbsorbingR l in
96− replace {P = \x => x = inverse (l <.> r)} (monoidNeutralIsNeutralR (l <.> inverse r)) step6
142+ monoidNeutralIsNeutralR ilxr
97
143
98−||| A proof that multiplication of inverses is the same as multiplication of original
144+||| Multiplication of inverses is the same as multiplication of
99−||| elements. (-x)(-y) = xy
145+||| original elements.
146+||| (-x)(-y) = xy
100−multNegativeByNegativeIsPositive : VerifiedRingWithUnity t => (l, r : t) -> inverse l <.> inverse r = l <.> r
147+multNegativeByNegativeIsPositive : VerifiedRing t => (l, r : t) ->
148+ inverse l <.> inverse r = l <.> r
101multNegativeByNegativeIsPositive l r =
149multNegativeByNegativeIsPositive l r =
102 rewrite multInverseInversesR (inverse l) r in
150 rewrite multInverseInversesR (inverse l) r in
103 rewrite sym $ multInverseInversesL (inverse l) r in
151 rewrite sym $ multInverseInversesL (inverse l) r in
libs/contrib/Data/Bool/Extra.idr+52−2
@@ -3,6 +3,12 @@ module Data.Bool.Extra
3%access public export
3%access public export
4%default total
4%default total
5
5
6+notInvolutive : (x : Bool) -> not (not x) = x
7+notInvolutive True = Refl
8+notInvolutive False = Refl
9+
10+-- AND
11+
6andSameNeutral : (x : Bool) -> x && x = x
12andSameNeutral : (x : Bool) -> x && x = x
7andSameNeutral False = Refl
13andSameNeutral False = Refl
8andSameNeutral True = Refl
14andSameNeutral True = Refl
@@ -15,6 +21,20 @@ andTrueNeutral : (x : Bool) -> x && True = x
15andTrueNeutral False = Refl
21andTrueNeutral False = Refl
16andTrueNeutral True = Refl
22andTrueNeutral True = Refl
17
23
24+andAssociative : (x, y, z : Bool) -> x && (y && z) = (x && y) && z
25+andAssociative True _ _ = Refl
26+andAssociative False _ _ = Refl
27+
28+andCommutative : (x, y : Bool) -> x && y = y && x
29+andCommutative x True = andTrueNeutral x
30+andCommutative x False = andFalseFalse x
31+
32+andNotFalse : (x : Bool) -> x && not x = False
33+andNotFalse False = Refl
34+andNotFalse True = Refl
35+
36+-- OR
37+
18orSameNeutral : (x : Bool) -> x || x = x
38orSameNeutral : (x : Bool) -> x || x = x
19orSameNeutral False = Refl
39orSameNeutral False = Refl
20orSameNeutral True = Refl
40orSameNeutral True = Refl
@@ -27,6 +47,36 @@ orTrueTrue : (x : Bool) -> x || True = True
27orTrueTrue False = Refl
47orTrueTrue False = Refl
28orTrueTrue True = Refl
48orTrueTrue True = Refl
29
49
50+orAssociative : (x, y, z : Bool) -> x || (y || z) = (x || y) || z
51+orAssociative True _ _ = Refl
52+orAssociative False _ _ = Refl
53+
54+orCommutative : (x, y : Bool) -> x || y = y || x
55+orCommutative x True = orTrueTrue x
56+orCommutative x False = orFalseNeutral x
57+
58+orNotTrue : (x : Bool) -> x || not x = True
59+orNotTrue False = Refl
60+orNotTrue True = Refl
61+
62+-- interaction & De Morgan's laws
63+
30−orSameAndRightNeutral : (x, right : Bool) -> x || (x && right) = x
64+orSameAndRightNeutral : (x, y : Bool) -> x || (x && y) = x
31orSameAndRightNeutral False _ = Refl
65orSameAndRightNeutral False _ = Refl
32−orSameAndRightNeutral True _ = Refl
66+orSameAndRightNeutral True _ = Refl
67+
68+andDistribOrR : (x, y, z : Bool) -> x && (y || z) = (x && y) || (x && z)
69+andDistribOrR False _ _ = Refl
70+andDistribOrR True _ _ = Refl
71+
72+orDistribAndR : (x, y, z : Bool) -> x || (y && z) = (x || y) && (x || z)
73+orDistribAndR False _ _ = Refl
74+orDistribAndR True _ _ = Refl
75+
76+notAndIsOr : (x, y : Bool) -> not (x && y) = not x || not y
77+notAndIsOr False _ = Refl
78+notAndIsOr True _ = Refl
79+
80+notOrIsAnd : (x, y : Bool) -> not (x || y) = not x && not y
81+notOrIsAnd False _ = Refl
82+notOrIsAnd True _ = Refl
libs/contrib/Data/Combinators.idr+2−2
@@ -26,13 +26,13 @@ infixl 9 ...
26(...) = (.) . (.)
26(...) = (.) . (.)
27
27
28||| Warbler, as named in "To Mock a Mockingbird".
28||| Warbler, as named in "To Mock a Mockingbird".
29−||| See http://code.jsoftware.com/wiki/Vocabulary/tilde
29+||| See https://code.jsoftware.com/wiki/Vocabulary/tilde
30||| Equivalent to `join` on the Reader monad (`(->) e` in Haskell)
30||| Equivalent to `join` on the Reader monad (`(->) e` in Haskell)
31reflex : (a -> a -> b) -> (a -> b)
31reflex : (a -> a -> b) -> (a -> b)
32reflex f x = f x x
32reflex f x = f x x
33
33
34||| Phoenix, according to Data.Aviary.
34||| Phoenix, according to Data.Aviary.
35−||| See http://code.jsoftware.com/wiki/Vocabulary/fork.
35+||| See https://code.jsoftware.com/wiki/Vocabulary/fork.
36||| Equivalent to `liftA2` on the Reader monad (`(->) e` in Haskell)
36||| Equivalent to `liftA2` on the Reader monad (`(->) e` in Haskell)
37fork2 : (b -> c -> d) -> (a -> b) -> (a -> c) -> (a -> d)
37fork2 : (b -> c -> d) -> (a -> b) -> (a -> c) -> (a -> d)
38fork2 f g h x = f (g x) (h x)
38fork2 f g h x = f (g x) (h x)
libs/contrib/Data/List/Extra.idrdeleted−44
@@ -1,44 +0,0 @@
1−module Data.List.Extra
2−
3−%default total
4−%access export
5−
6−||| Serves as a specification for reverseOnto.
7−reverseOntoSpec : (xs, ys : List a) -> reverseOnto xs ys = reverse ys ++ xs
8−reverseOntoSpec _ [] = Refl
9−reverseOntoSpec xs (y::ys) =
10− trans (reverseOntoSpec (y::xs) ys)
11− (trans (appendAssociative (reverse ys) [y] xs)
12− (cong {f = \l => l ++ xs} (sym (reverseOntoSpec [y] ys))))
13−
14−||| The reverse of an empty list is an empty list. Together with reverseCons,
15−||| serves as a specification for reverse.
16−reverseNil : reverse [] = []
17−reverseNil = Refl
18−
19−||| The reverse of a cons is the reverse of the tail followed by the head.
20−||| Together with reverseNil serves as a specification for reverse.
21−reverseCons : (x : a) -> (xs : List a) -> reverse (x::xs) = reverse xs ++ [x]
22−reverseCons x xs = reverseOntoSpec [x] xs
23−
24−||| Reversing an append is appending reversals backwards.
25−reverseAppend : (xs, ys : List a) ->
26− reverse (xs ++ ys) = reverse ys ++ reverse xs
27−reverseAppend [] ys = sym (appendNilRightNeutral (reverse ys))
28−reverseAppend (x :: xs) ys =
29− trans (trans (reverseCons x (xs ++ ys))
30− (cong {f = \l => l ++ [x]} (reverseAppend xs ys)))
31− (sym (trans (cong (reverseCons x xs))
32− (appendAssociative (reverse ys) (reverse xs) [x])))
33−
34−||| Reversing a singleton list is a no-op.
35−reverseSingletonId : (x : a) -> reverse [x] = [x]
36−reverseSingletonId _ = Refl
37−
38−||| Reversing a reverse gives the original.
39−reverseReverseId : (xs : List a) -> reverse (reverse xs) = xs
40−reverseReverseId [] = Refl
41−reverseReverseId (x :: xs) =
42− trans (cong (reverseCons x xs))
43− (trans (reverseAppend (reverse xs) [x])
44− (cong (reverseReverseId xs)))
libs/contrib/Data/List/Reverse.idrnew file+99
@@ -0,0 +1,99 @@
1+||| Properties of the reverse function.
2+module Data.List.Reverse
3+
4+%default total
5+%access export
6+
7+||| The final segment of the accumulator is the final segment of the result.
8+reverseOntoAcc : (xs, ys, zs : List a) ->
9+ reverseOnto (ys ++ zs) xs = (reverseOnto ys xs) ++ zs
10+reverseOntoAcc [] _ _ = Refl
11+reverseOntoAcc (x :: xs) (ys) (zs) = reverseOntoAcc xs (x :: ys) zs
12+
13+||| Serves as a specification for reverseOnto.
14+reverseOntoSpec : (xs, ys : List a) -> reverseOnto xs ys = reverse ys ++ xs
15+reverseOntoSpec xs ys = reverseOntoAcc ys [] xs
16+
17+||| The reverse of an empty list is an empty list. Together with reverseCons,
18+||| serves as a specification for reverse.
19+reverseNil : reverse [] = []
20+reverseNil = Refl
21+
22+||| The reverse of a cons is the reverse of the tail followed by the head.
23+||| Together with reverseNil serves as a specification for reverse.
24+reverseCons : (x : a) -> (xs : List a) -> reverse (x::xs) = reverse xs ++ [x]
25+reverseCons x xs = reverseOntoSpec [x] xs
26+
27+||| Reversing an append is appending reversals backwards.
28+reverseAppend : (xs, ys : List a) ->
29+ reverse (xs ++ ys) = reverse ys ++ reverse xs
30+reverseAppend [] ys = sym (appendNilRightNeutral (reverse ys))
31+reverseAppend (x :: xs) ys =
32+ rewrite reverseCons x (xs ++ ys) in
33+ rewrite reverseAppend xs ys in
34+ rewrite reverseCons x xs in
35+ sym $ appendAssociative (reverse ys) (reverse xs) [x]
36+
37+||| A recursive definition of reverse.
38+reverseRec : List a -> List a
39+reverseRec [] = []
40+reverseRec (x :: xs) = reverseRec xs ++ [x]
41+
42+||| The iterative and recursive defintions of reverse are the same.
43+reverseEquiv : (xs : List a) -> reverseRec xs = reverse xs
44+reverseEquiv [] = Refl
45+reverseEquiv (x :: xs) =
46+ rewrite reverseEquiv xs in
47+ rewrite reverseAppend [x] xs in
48+ Refl
49+
50+||| Reversing a singleton list is a no-op.
51+reverseSingletonId : (x : a) -> reverse [x] = [x]
52+reverseSingletonId _ = Refl
53+
54+||| Reversing a reverse gives the original.
55+reverseReverseId : (xs : List a) -> reverse (reverse xs) = xs
56+reverseReverseId [] = Refl
57+reverseReverseId (x :: xs) =
58+ rewrite reverseCons x xs in
59+ rewrite reverseAppend (reverse xs) [x] in
60+ cong $ reverseReverseId xs
61+
62+||| Reversing onto preserves list length.
63+reverseOntoLength : (xs, acc : List a) ->
64+ length $ reverseOnto acc xs = length acc + length xs
65+reverseOntoLength [] acc = rewrite plusZeroRightNeutral (length acc) in Refl
66+reverseOntoLength (x :: xs) acc =
67+ rewrite reverseOntoLength xs (x :: acc) in
68+ plusSuccRightSucc (length acc) (length xs)
69+
70+||| Reversing preserves list length.
71+reverseLength : (xs : List a) -> length $ reverse xs = length xs
72+reverseLength xs = reverseOntoLength xs []
73+
74+||| Equal reversed lists are equal.
75+reverseEqual : (xs, ys : List a) -> reverse xs = reverse ys -> xs = ys
76+reverseEqual xs ys prf =
77+ rewrite sym $ reverseReverseId xs in
78+ rewrite prf in
79+ reverseReverseId ys
80+
81+||| Do geese see God?
82+data Palindrome : (xs : List a) -> Type where
83+ Empty : Palindrome []
84+ Single : Palindrome [_]
85+ Multi : Palindrome xs -> Palindrome $ [x] ++ xs ++ [x]
86+
87+||| A Palindrome reversed is itself.
88+palindromeReverse : (xs : List a) -> Palindrome xs -> reverse xs = xs
89+palindromeReverse [] Empty = Refl
90+palindromeReverse [_] Single = Refl
91+palindromeReverse ([x] ++ ys ++ [x]) (Multi pf) =
92+ rewrite reverseAppend ([x] ++ ys) [x] in
93+ rewrite reverseAppend [x] ys in
94+ rewrite palindromeReverse ys pf in
95+ Refl
96+
97+||| Only Palindromes are equal to their own reverse.
98+postulate -- This is a tough one. Any takers?
99+reversePalindrome : (xs : List a) -> reverse xs = xs -> Palindrome xs
libs/contrib/Data/Logic/Propositional.idrnew file+161
@@ -0,0 +1,161 @@
1+module Data.Logic.Propositional
2+
3+%default total
4+%access public export
5+
6+-- Idris uses intuitionistic logic, so it does not validate the
7+-- principle of excluded middle (PEM) or similar theorems of classical
8+-- logic. But it does validate certain relations among these
9+-- propositions, and that's what's in this file.
10+
11+||| The principle of excluded middle
12+PEM : Type -> Type
13+PEM p = Either p (Not p)
14+
15+||| Double negation elimination
16+DNE : Type -> Type
17+DNE p = Not $ Not p -> p
18+
19+||| The consensus theorem (at least, the interesting part)
20+Consensus : Type -> Type -> Type -> Type
21+Consensus p q r = (q, r) -> Either (p, q) (Not p, r)
22+
23+||| Peirce's law
24+Peirce : Type -> Type -> Type
25+Peirce p q = ((p -> q) -> p) -> p
26+
27+||| Not sure if this one has a name, so call it Frege's law
28+Frege : Type -> Type -> Type -> Type
29+Frege p q r = (p -> r) -> (q -> r) -> ((p -> q) -> q) -> r
30+
31+||| The converse of contraposition: (p -> q) -> Not q -> Not p
32+Transposition : Type -> Type -> Type
33+Transposition p q = (Not q -> Not p) -> p -> q
34+
35+||| This isn't a good name.
36+Switch : Type -> Type
37+Switch p = (Not p -> p) -> p
38+
39+-- PEM and the others can't be proved outright, but it is possible to
40+-- prove the double negations (DN) of all of them.
41+
42+||| The double negation of a proposition
43+DN : Type -> Type
44+DN p = Not $ Not p
45+
46+pemDN : DN $ PEM p
47+pemDN f = f $ Right $ \x => f $ Left x
48+
49+dneDN : DN $ DNE p
50+dneDN f = f $ \g => void $ g $ \x => f $ \_ => x
51+
52+consensusDN : DN $ Consensus p q r
53+consensusDN f = f $ \(y, z) => Right (\x => f $ \(_, _) => Left (x, y), z)
54+
55+peirceDN : DN $ Peirce p q
56+peirceDN f = f $ \g => g $ \x => void $ f $ \_ => x
57+
58+fregeDN : DN $ Frege p q r
59+fregeDN f = f $ \g, h, i => h $ i $ \x => void $ f $ \_, _, _ => g x
60+
61+transpositionDN : DN $ Transposition p q
62+transpositionDN f = f $ \g, x => void $ g (\y => f $ \_, _ => y) x
63+
64+switchDN : DN $ Switch p
65+switchDN f = f $ \g => g $ \x => f $ \_ => x
66+
67+-- It's easy to prove all these theorems assuming PEM.
68+
69+dnePEM : PEM p -> DNE p
70+dnePEM (Left l) _ = l
71+dnePEM (Right r) f = void $ f r
72+
73+consensusPEM : PEM p -> Consensus p q r
74+consensusPEM (Left l) (y, _) = Left (l, y)
75+consensusPEM (Right r) (_, z) = Right (r, z)
76+
77+peircePEM : PEM p -> Peirce p q
78+peircePEM (Left l) _ = l
79+peircePEM (Right r) f = f $ \x => void $ r x
80+
81+fregePEM : PEM p -> Frege p q r
82+fregePEM (Left l) f _ _ = f l
83+fregePEM (Right r) _ g h = g $ h $ \x => void $ r x
84+
85+transpositionPEM : PEM p -> Transposition q p
86+transpositionPEM (Left l) _ _ = l
87+transpositionPEM (Right r) f x = void $ f r x
88+
89+switchPEM : PEM p -> Switch p
90+switchPEM (Left l) _ = l
91+switchPEM (Right r) f = f r
92+
93+-- It's trivial to prove these theorems assuming double negation
94+-- elimination (DNE), since their double negations can all be proved.
95+
96+||| Eliminate double negations
97+EDN : DN p -> DNE p -> p
98+EDN f g = g f
99+
100+pemDNE : DNE $ PEM p -> PEM p
101+pemDNE = EDN pemDN
102+
103+-- It's possible to prove the theorems assuming Peirce's law, but some
104+-- thought must be given to choosing the right instances. Peirce's law
105+-- is therefore weaker than PEM on an instance-by-instance basis, but
106+-- all the instances together are equivalent.
107+
108+pemPeirce : Peirce (PEM p) Void -> PEM p
109+pemPeirce f = f $ \g => Right $ \x => g $ Left x
110+
111+dnePeirce : Peirce p Void -> DNE p
112+dnePeirce f g = f $ \h => void $ g h
113+
114+consensusPeirce : Peirce (Consensus p q r) Void -> Consensus p q r
115+consensusPeirce f (y, z) =
116+ f (\g, (_, _) => Right (\x => g (\_ => Left (x, y)), z)) (y, z)
117+
118+fregePeirce : Peirce (Frege p q r) Void -> Frege p q r
119+fregePeirce f g h i =
120+ f (\j, _, _, _ => h $ i $ \x => void $ j $ \_, _, _ => g x) g h i
121+
122+transpositionPeirce : Peirce (Transposition p q) Void -> Transposition p q
123+transpositionPeirce f g x =
124+ f (\h, _, _ => void $ g (\y => h $ \_, _ => y) x) (\j, _ => g j x) x
125+
126+-- There are a variety of single axioms sufficient for deriving all of
127+-- classical logic. The earliest of these is known as Nicod's axiom,
128+-- but it is written using only nand operators and doesn't lend itself
129+-- to Idris's type system. Meredith's axiom, on the other hand, is
130+-- written using implication and negation.
131+
132+||| Meredith's axiom, sufficient for deriving all of classical logic
133+Meredith : (p, q, r, s, t : Type) -> Type
134+Meredith p q r s t =
135+ ((((p -> q) -> Not r -> Not s) -> r) -> t) -> (t -> p) -> s -> p
136+
137+-- The Meredith axiom implies all of classical logic, and so in
138+-- particular it implies PEM, and therefore cannot be proved in
139+-- intuitionistic logic. As usual, however, its double negation can be
140+-- proved.
141+
142+meredithDN : DN $ Meredith p q r s t
143+meredithDN f =
144+ f $ \g, h, x =>
145+ h $ g $ \i =>
146+ void $ i
147+ (\y => void $ f $ \_, _, _ => y)
148+ (\z => f $ \_, _, _ => h $ g $ \_ => z)
149+ x
150+
151+-- Meredith can be proved assuming PEM, since the type system itself
152+-- takes care of the rest.
153+
154+meredithPEM : PEM p -> Meredith p q r s t
155+meredithPEM (Left l) _ _ _ = l
156+meredithPEM (Right r) f g x =
157+ g $ f $ \h =>
158+ void $ h
159+ (\y => void $ r y)
160+ (\z => r $ g $ f (\_ => z))
161+ x
libs/contrib/Data/Nat/Ack.idrnew file+60
@@ -0,0 +1,60 @@
1+||| Properties of the Ackermann function.
2+module Data.Nat.Ackermann
3+
4+%access public export
5+
6+%default total
7+
8+-- Primitive recursive functions are functions that can be calculated
9+-- by programs that don't use unbounded loops. Almost all common
10+-- mathematical functions are primitive recursive.
11+
12+-- Uncomputable functions are functions that can't be calculated by
13+-- any programs at all. One example is the Busy Beaver function:
14+-- BB(k) = the maximum number of steps that can be executed by a
15+-- halting Turing machine with k states.
16+-- The values of the Busy Beaver function are unimaginably large for
17+-- any but the smallest inputs.
18+
19+-- The Ackermann function is the most well-known example of a total
20+-- computable function that is not primitive recursive, i.e. a general
21+-- recursive function. It grows strictly faster than any primitive
22+-- recursive function, but also strictly slower than a function like
23+-- the Busy Beaver.
24+
25+-- There are many variations of the Ackermann function. Here is one
26+-- common definition
27+-- (see https://sites.google.com/site/pointlesslargenumberstuff/home/2/ackermann)
28+-- that uses nested recursion:
29+
30+ackRec : Nat -> Nat -> Nat
31+-- Base rule
32+ackRec Z m = S m
33+-- Prime rule
34+ackRec (S k) Z = ackRec k 1
35+-- Catastrophic rule
36+ackRec (S k) (S j) = ackRec k $ ackRec (S k) j
37+
38+-- The so-called "base rule" and "prime rule" work together to ensure
39+-- termination. Happily, the Idris totality checker has no issues.
40+
41+-- An unusual "repeating" defintion of the function is given in the
42+-- book The Little Typer:
43+
44+ackRep : Nat -> Nat -> Nat
45+ackRep Z = (+) 1
46+ackRep (S k) = repeat (ackRep k)
47+ where
48+ repeat : (Nat -> Nat) -> Nat -> Nat
49+ repeat f Z = f 1
50+ repeat f (S k) = f (repeat f k)
51+
52+-- These two definitions don't look like they define the same
53+-- function, but they do:
54+
55+ackRepRec : (n, m : Nat) -> ackRep n m = ackRec n m
56+ackRepRec Z _ = Refl
57+ackRepRec (S k) Z = ackRepRec k 1
58+ackRepRec (S k) (S j) =
59+ rewrite sym $ ackRepRec (S k) j in
60+ ackRepRec k $ ackRep (S k) j
libs/contrib/Data/Nat/Fact.idrnew file+56
@@ -0,0 +1,56 @@
1+||| Properties of factorial functions.
2+module Data.Nat.Fact
3+
4+%access public export
5+
6+%default total
7+
8+||| Recursive definition of factorial.
9+factRec : Nat -> Nat
10+factRec Z = 1
11+factRec (S k) = (S k) * factRec k
12+
13+||| Tail-recursive accumulator for factItr.
14+factAcc : Nat -> Nat -> Nat
15+factAcc Z acc = acc
16+factAcc (S k) acc = factAcc k $ (S k) * acc
17+
18+||| Iterative definition of factorial.
19+factItr : Nat -> Nat
20+factItr n = factAcc n 1
21+
22+----------------------------------------
23+
24+||| Multiplicand-shuffling lemma.
25+multShuffle : (a, b, c : Nat) -> a * (b * c) = b * (a * c)
26+multShuffle a b c =
27+ rewrite multAssociative a b c in
28+ rewrite multCommutative a b in
29+ sym $ multAssociative b a c
30+
31+||| Multiplication of the accumulator.
32+factAccMult : (a, b, c : Nat) ->
33+ a * factAcc b c = factAcc b (a * c)
34+factAccMult _ Z _ = Refl
35+factAccMult a (S k) c =
36+ rewrite factAccMult a k (S k * c) in
37+ rewrite multShuffle a (S k) c in
38+ Refl
39+
40+||| Addition of accumulators.
41+factAccPlus : (a, b, c : Nat) ->
42+ factAcc a b + factAcc a c = factAcc a (b + c)
43+factAccPlus Z _ _ = Refl
44+factAccPlus (S k) b c =
45+ rewrite factAccPlus k (S k * b) (S k * c) in
46+ rewrite sym $ multDistributesOverPlusRight (S k) b c in
47+ Refl
48+
49+||| The recursive and iterative definitions are the equivalent.
50+factRecItr : (n : Nat) -> factRec n = factItr n
51+factRecItr Z = Refl
52+factRecItr (S k) =
53+ rewrite factRecItr k in
54+ rewrite factAccMult k k 1 in
55+ rewrite multOneRightNeutral k in
56+ factAccPlus k 1 k
libs/contrib/Data/Nat/Fib.idrnew file+50
@@ -0,0 +1,50 @@
1+||| Properties of the Fibonacci function.
2+module Data.Nat.Fib
3+
4+%access public export
5+
6+%default total
7+
8+||| Recursive definition of Fibonacci.
9+fibRec : Nat -> Nat
10+fibRec Z = Z
11+fibRec (S Z) = S Z
12+fibRec (S (S k)) = fibRec (S k) + fibRec k
13+
14+||| Accumulator for fibItr.
15+fibAcc : Nat -> Nat -> Nat -> Nat
16+fibAcc Z a _ = a
17+fibAcc (S k) a b = fibAcc k b (a + b)
18+
19+||| Iterative definition of Fibonacci.
20+fibItr : Nat -> Nat
21+fibItr n = fibAcc n 0 1
22+
23+||| Addend shuffling lemma.
24+plusLemma : (a, b, c, d : Nat) -> (a + b) + (c + d) = (a + c) + (b + d)
25+plusLemma a b c d =
26+ rewrite sym $ plusAssociative a b (c + d) in
27+ rewrite plusAssociative b c d in
28+ rewrite plusCommutative b c in
29+ rewrite sym $ plusAssociative c b d in
30+ plusAssociative a c (b + d)
31+
32+||| Helper lemma for fibacc.
33+fibAdd : (n, a, b, c, d : Nat) ->
34+ fibAcc n a b + fibAcc n c d = fibAcc n (a + c) (b + d)
35+fibAdd Z _ _ _ _ = Refl
36+fibAdd (S Z) _ _ _ _ = Refl
37+fibAdd (S (S k)) a b c d =
38+ rewrite fibAdd k (a + b) (b + (a + b)) (c + d) (d + (c + d)) in
39+ rewrite plusLemma b (a + b) d (c + d) in
40+ rewrite plusLemma a b c d in
41+ Refl
42+
43+||| Iterative and recursive Fibonacci definitions are equivalent.
44+fibEq : (n : Nat) -> fibRec n = fibItr n
45+fibEq Z = Refl
46+fibEq (S Z) = Refl
47+fibEq (S (S k)) =
48+ rewrite fibEq k in
49+ rewrite fibEq (S k) in
50+ fibAdd k 1 1 0 1
libs/contrib/Data/Nat/Parity.idr+204−3
@@ -2,9 +2,52 @@ module Data.Nat.Parity
2
2
3%access public export
3%access public export
4
4
5−--------------------------------------------------------------------------------
5+----------------------------------------
6−-- Parity
6+
7−--------------------------------------------------------------------------------
7+-- Type-level, constructive definitions of parity.
8+
9+||| A nat is Even when it is twice some other nat.
10+Even : Nat -> Type
11+Even n = (half : Nat ** n = half * 2)
12+
13+||| A nat is Odd when it is one more than twice some other nat.
14+Odd : Nat -> Type
15+Odd n = (haf : Nat ** n = S $ haf * 2)
16+
17+----------------------------------------
18+
19+||| Two more than an Even is Even.
20+add2Even : Even n -> Even (2 + n)
21+add2Even (half ** pf) = (S half ** cong {f = (+) 2} pf)
22+
23+||| Two more than an Odd is Odd.
24+add2Odd : Odd n -> Odd (2 + n)
25+add2Odd (haf ** pf) = (S haf ** cong {f = (+) 2} pf)
26+
27+||| One more than an Even is Odd.
28+succEvenOdd : Even n -> Odd (S n)
29+succEvenOdd (half ** pf) = (half ** cong {f = S} pf)
30+
31+||| One more than an Odd is Even.
32+succOddEven : Odd n -> Even (S n)
33+succOddEven (haf ** pf) = (S haf ** cong {f = S} pf)
34+
35+||| One less than an Odd is Even.
36+predOddEven : Odd (S n) -> Even n
37+predOddEven (haf ** pf) = (haf ** cong {f = Nat.pred} pf)
38+
39+||| A helper fact.
40+succDoublePredPred : S n = k * 2 -> n = S $ (pred k) * 2
41+succDoublePredPred {k = Z} prf = absurd prf
42+succDoublePredPred {k = S _} prf = cong {f = Nat.pred} prf
43+
44+||| One less than an Even is Odd.
45+predEvenOdd : Even (S n) -> Odd n
46+predEvenOdd (half ** pf) = (pred half ** succDoublePredPred pf)
47+
48+----------------------------------------
49+
50+-- Boolean definitions of parity.
8
51
9mutual
52mutual
10 even : Nat -> Bool
53 even : Nat -> Bool
@@ -14,3 +57,161 @@ mutual
14 odd : Nat -> Bool
57 odd : Nat -> Bool
15 odd Z = False
58 odd Z = False
16 odd (S k) = even k
59 odd (S k) = even k
60+
61+----------------------------------------
62+
63+-- The boolean and type-level definitions are equivalent in the sense
64+-- that a proof of one can be gotten from a proof of the other.
65+
66+mutual
67+ ||| Evens are even.
68+ evenEven : Even n -> even n = True
69+ evenEven {n = Z} _ = Refl
70+ evenEven {n = S _} pf = oddOdd $ predEvenOdd pf
71+
72+ ||| Odds are odd.
73+ oddOdd : Odd n -> odd n = True
74+ oddOdd {n = Z} (_ ** pf) = absurd pf
75+ oddOdd {n = S _} pf = evenEven $ predOddEven pf
76+
77+mutual
78+ ||| If it's even, it's Even.
79+ evenEvenConverse : even n = True -> Even n
80+ evenEvenConverse {n = Z} prf = (0 ** Refl)
81+ evenEvenConverse {n = S k} prf =
82+ let (haf ** pf) = oddOddConverse prf in
83+ (S haf ** cong pf)
84+
85+ ||| If it's odd, it's Odd
86+ oddOddConverse : odd n = True -> Odd n
87+ oddOddConverse {n = Z} prf = absurd prf
88+ oddOddConverse {n = S k} prf =
89+ let (half ** pf) = evenEvenConverse prf in
90+ (half ** cong pf)
91+
92+----------------------------------------
93+
94+||| Every nat is either even or odd.
95+evenorodd : (n : Nat) -> Either (even n = True) (odd n = True)
96+evenorodd Z = Left Refl
97+evenorodd (S k) = case evenorodd k of
98+ Left l => Right l
99+ Right r => Left r
100+
101+||| Every nat is either Even or Odd.
102+evenOrOdd : (n : Nat) -> Either (Even n) (Odd n)
103+evenOrOdd n = case evenorodd n of
104+ Left e => Left $ evenEvenConverse e
105+ Right o => Right $ oddOddConverse o
106+
107+||| No nat is both even and odd.
108+notevenandodd : even n = True -> odd n = True -> Void
109+notevenandodd {n = Z} en on = absurd on
110+notevenandodd {n = S _} en on = notevenandodd on en
111+
112+||| No nat is both Even and Odd.
113+notEvenAndOdd : Even n -> Odd n -> Void
114+notEvenAndOdd en on = notevenandodd (evenEven en) (oddOdd on)
115+
116+||| Evenness is decidable.
117+evenDec : (n : Nat) -> Dec $ Even n
118+evenDec n = case evenOrOdd n of
119+ Left even => Yes even
120+ Right odd => No $ \even => notEvenAndOdd even odd
121+
122+||| Oddness is decidable.
123+oddDec : (n : Nat) -> Dec $ Odd n
124+oddDec n = case evenOrOdd n of
125+ Left even => No $ notEvenAndOdd even
126+ Right odd => Yes odd
127+
128+----------------------------------------
129+
130+||| An Odd is the successor of an Even.
131+oddSuccEven : Odd n -> (m : Nat ** (n = S m, Even m))
132+oddSuccEven (haf ** pf) = (haf * 2 ** (pf, (haf ** Refl)))
133+
134+||| Even plus Even is Even.
135+evenPlusEven : Even j -> Even k -> Even (j + k)
136+evenPlusEven (half_j ** pf_j) (half_k ** pf_k) =
137+ (half_j + half_k **
138+ rewrite pf_j in
139+ rewrite pf_k in
140+ sym $ multDistributesOverPlusLeft half_j half_k 2)
141+
142+||| Odd plus Even is Odd.
143+oddPlusEven : Odd j -> Even k -> Odd (j + k)
144+oddPlusEven oj ek =
145+ let
146+ (i ** (ipj, ei)) = oddSuccEven oj
147+ (half_ik ** eik) = evenPlusEven ei ek
148+ in
149+ (half_ik **
150+ rewrite ipj in
151+ cong {f = S} eik)
152+
153+||| Even plus Odd is Odd.
154+evenPlusOdd : Even j -> Odd k -> Odd (j + k)
155+evenPlusOdd {j} {k} ej ok = rewrite plusCommutative j k in oddPlusEven ok ej
156+
157+||| Odd plus Odd is Even.
158+oddPlusOdd : Odd j -> Odd k -> Even (j + k)
159+oddPlusOdd oj ok =
160+ let
161+ (i ** (ipj, ei)) = oddSuccEven oj
162+ (haf_ik ** oik) = evenPlusOdd ei ok
163+ in
164+ (S haf_ik **
165+ rewrite ipj in
166+ rewrite oik in
167+ Refl)
168+
169+||| A helper fact.
170+multShuffle : (a, b, c : Nat) ->
171+ (a * c) * (b * c) = ((a * b) * c) * c
172+multShuffle a b c =
173+ rewrite multAssociative (a * c) b c in
174+ rewrite multCommutative (a * c) b in
175+ rewrite multAssociative b a c in
176+ rewrite multCommutative b a in
177+ Refl
178+
179+||| Even times Even is Even.
180+evenMultEven : Even j -> Even k -> Even (j * k)
181+evenMultEven (half_j ** pf_j) (half_k ** pf_k) =
182+ (half_j * half_k * 2 **
183+ rewrite pf_j in
184+ rewrite pf_k in
185+ multShuffle half_j half_k 2)
186+
187+||| Odd times Even is Even.
188+oddMultEven : Odd j -> Even k -> Even (j * k)
189+oddMultEven oj (half_k ** pf_k) =
190+ let
191+ (i ** (ipj, ei)) = oddSuccEven oj
192+ (half_ik ** oik) = evenMultEven ei (half_k ** pf_k)
193+ in
194+ (half_k + half_ik **
195+ rewrite multDistributesOverPlusLeft half_k half_ik 2 in
196+ rewrite ipj in
197+ rewrite oik in
198+ rewrite pf_k in
199+ Refl)
200+
201+||| Even times Odd is Even.
202+evenMultOdd : Even j -> Odd k -> Even (j * k)
203+evenMultOdd {j} {k} ej ok = rewrite multCommutative j k in oddMultEven ok ej
204+
205+||| Odd times Odd is Odd.
206+oddMultOdd : Odd j -> Odd k -> Odd (j * k)
207+oddMultOdd oj (haf_k ** pf_k) =
208+ let
209+ (i ** (ipj, ei)) = oddSuccEven oj
210+ (half_ik ** eik) = evenMultOdd ei (haf_k ** pf_k)
211+ in
212+ (haf_k + half_ik **
213+ rewrite multDistributesOverPlusLeft haf_k half_ik 2 in
214+ rewrite ipj in
215+ rewrite eik in
216+ rewrite pf_k in
217+ Refl)
libs/contrib/Data/SortedMap.idr+4
@@ -201,6 +201,10 @@ export
201empty : Ord k => SortedMap k v
201empty : Ord k => SortedMap k v
202empty = Empty
202empty = Empty
203
203
204+export
205+singleton : Ord k => k -> v -> SortedMap k v
206+singleton k v = M Z (Leaf k v)
207+
204export
208export
205lookup : k -> SortedMap k v -> Maybe v
209lookup : k -> SortedMap k v -> Maybe v
206lookup _ Empty = Nothing
210lookup _ Empty = Nothing
libs/contrib/Interfaces/Verified.idr+36
@@ -6,6 +6,7 @@ import Control.Algebra.NumericImplementations
6import Control.Algebra.VectorSpace
6import Control.Algebra.VectorSpace
7import Data.Vect
7import Data.Vect
8import Data.ZZ
8import Data.ZZ
9+import Data.Bool.Extra
9
10
10%default total
11%default total
11%access public export
12%access public export
@@ -317,7 +318,42 @@ interface JoinSemilattice a => VerifiedJoinSemilattice a where
317 joinSemilatticeJoinIsCommutative : (l, r : a) -> join l r = join r l
318 joinSemilatticeJoinIsCommutative : (l, r : a) -> join l r = join r l
318 joinSemilatticeJoinIsIdempotent : (e : a) -> join e e = e
319 joinSemilatticeJoinIsIdempotent : (e : a) -> join e e = e
319
320
321+VerifiedJoinSemilattice Nat where
322+ joinSemilatticeJoinIsAssociative = maximumAssociative
323+ joinSemilatticeJoinIsCommutative = maximumCommutative
324+ joinSemilatticeJoinIsIdempotent = maximumIdempotent
325+
326+VerifiedJoinSemilattice Bool where
327+ joinSemilatticeJoinIsAssociative = orAssociative
328+ joinSemilatticeJoinIsCommutative = orCommutative
329+ joinSemilatticeJoinIsIdempotent = orSameNeutral
330+
320interface MeetSemilattice a => VerifiedMeetSemilattice a where
331interface MeetSemilattice a => VerifiedMeetSemilattice a where
321 meetSemilatticeMeetIsAssociative : (l, c, r : a) -> meet l (meet c r) = meet (meet l c) r
332 meetSemilatticeMeetIsAssociative : (l, c, r : a) -> meet l (meet c r) = meet (meet l c) r
322 meetSemilatticeMeetIsCommutative : (l, r : a) -> meet l r = meet r l
333 meetSemilatticeMeetIsCommutative : (l, r : a) -> meet l r = meet r l
323 meetSemilatticeMeetIsIdempotent : (e : a) -> meet e e = e
334 meetSemilatticeMeetIsIdempotent : (e : a) -> meet e e = e
335+
336+VerifiedMeetSemilattice Nat where
337+ meetSemilatticeMeetIsAssociative = minimumAssociative
338+ meetSemilatticeMeetIsCommutative = minimumCommutative
339+ meetSemilatticeMeetIsIdempotent = minimumIdempotent
340+
341+VerifiedMeetSemilattice Bool where
342+ meetSemilatticeMeetIsAssociative = andAssociative
343+ meetSemilatticeMeetIsCommutative = andCommutative
344+ meetSemilatticeMeetIsIdempotent = andSameNeutral
345+
346+interface (VerifiedJoinSemilattice a, BoundedJoinSemilattice a) => VerifiedBoundedJoinSemilattice a where
347+ joinBottomIsIdentity : (x : a) -> join x Lattice.bottom = x
348+
349+VerifiedBoundedJoinSemilattice Nat where
350+ joinBottomIsIdentity = maximumZeroNLeft
351+
352+VerifiedBoundedJoinSemilattice Bool where
353+ joinBottomIsIdentity = orFalseNeutral
354+
355+interface (VerifiedMeetSemilattice a, BoundedMeetSemilattice a) => VerifiedBoundedMeetSemilattice a where
356+ meetTopIsIdentity : (x : a) -> meet x Lattice.top = x
357+
358+VerifiedBoundedMeetSemilattice Bool where
359+ meetTopIsIdentity = andTrueNeutral
libs/contrib/Language/JSON.idr+1−1
@@ -1,4 +1,4 @@
1−||| The JSON language, as described at http://json.org/
1+||| The JSON language, as described at https://json.org/
2module Language.JSON
2module Language.JSON
3
3
4import Language.JSON.Lexer
4import Language.JSON.Lexer
libs/contrib/contrib.ipkg+1−1
@@ -43,7 +43,7 @@ modules = CFFI
43 , Data.Heap
43 , Data.Heap
44 , Data.IOArray
44 , Data.IOArray
45 , Data.List.Zipper
45 , Data.List.Zipper
46− , Data.List.Extra
46+ , Data.List.Reverse
47
47
48 , Data.Matrix
48 , Data.Matrix
49 , Data.Matrix.Algebraic
49 , Data.Matrix.Algebraic
libs/effects/Effect/File.idr+4−4
@@ -73,8 +73,8 @@ data FileHandle : (m : Mode) -> Type where
73-- ---------------------------------------------- [ Resource Type Construction ]
73-- ---------------------------------------------- [ Resource Type Construction ]
74
74
75||| Calculates the type for the resource being computed over. `Unit`
75||| Calculates the type for the resource being computed over. `Unit`
76−||| to describe pre-and-post file handle acquisistion, and `FileHandle
76+||| to describe pre-and-post file handle acquisition, and `FileHandle
77−||| m` when a file handle has been aqcuired.
77+||| m` when a file handle has been acquired.
78|||
78|||
79||| @m The mode the file handle was generated under.
79||| @m The mode the file handle was generated under.
80||| @ty The functions return type.
80||| @ty The functions return type.
@@ -315,7 +315,7 @@ R = FileHandle Read
315W : Type
315W : Type
316W = FileHandle WriteTruncate
316W = FileHandle WriteTruncate
317
317
318−||| A file can only be appeneded to.
318+||| A file can only be appended to.
319A : Type
319A : Type
320A = FileHandle Append
320A = FileHandle Append
321
321
@@ -324,7 +324,7 @@ RW : Type
324RW = FileHandle ReadWrite
324RW = FileHandle ReadWrite
325
325
326||| A file opened for reading and writing and has been truncated to
326||| A file opened for reading and writing and has been truncated to
327−||| zero if it previsiouly existed.
327+||| zero if it previously existed.
328RWPlus : Type
328RWPlus : Type
329RWPlus = FileHandle ReadWriteTruncate
329RWPlus = FileHandle ReadWriteTruncate
330
330
libs/effects/Effect/Logging/Category.idr+2−2
@@ -130,7 +130,7 @@ initLogger l cs = call $ InitLogger l cs
130|||
130|||
131||| @l The logging level.
131||| @l The logging level.
132||| @cs The logging categories.
132||| @cs The logging categories.
133−||| @m THe message to be logged.
133+||| @m The message to be logged.
134log : (Show a, Eq a) => (l : LogLevel n)
134log : (Show a, Eq a) => (l : LogLevel n)
135 -> (cs : List a)
135 -> (cs : List a)
136 -> (m : String)
136 -> (m : String)
@@ -141,7 +141,7 @@ log l cs msg = call $ Log l cs msg
141|||
141|||
142||| @l The logging level.
142||| @l The logging level.
143||| @cs The logging categories.
143||| @cs The logging categories.
144−||| @m THe message to be logged.
144+||| @m The message to be logged.
145logN : (Show a, Eq a) => (l : Nat)
145logN : (Show a, Eq a) => (l : Nat)
146 -> {auto prf : LTE l 70}
146 -> {auto prf : LTE l 70}
147 -> (cs : List a)
147 -> (cs : List a)
libs/effects/Effect/Perf.idr+1−1
@@ -193,7 +193,7 @@ collectPMetrics b = call $ TurnOn b
193collectPMetricsAndShow : Eff () [PERF]
193collectPMetricsAndShow : Eff () [PERF]
194collectPMetricsAndShow = call $ TurnOn True
194collectPMetricsAndShow = call $ TurnOn True
195
195
196−||| Return gatheres metrics
196+||| Return gathered metrics
197getPerfMetrics : Eff PMetrics [PERF]
197getPerfMetrics : Eff PMetrics [PERF]
198getPerfMetrics = call $ GetMetrics
198getPerfMetrics = call $ GetMetrics
199
199
libs/prelude/IO.idr+1−1
@@ -80,7 +80,7 @@ foreign_prim f fname (FFun arg sc) env
80||| Idris compiler backend in use. For the default C backend, see the
80||| Idris compiler backend in use. For the default C backend, see the
81||| documentation for `FFI_C`.
81||| documentation for `FFI_C`.
82|||
82|||
83−||| For more details, please consult [the Idris documentation](http://docs.idris-lang.org/en/latest/reference/ffi.html).
83+||| For more details, please consult [the Idris documentation](https://idris.readthedocs.io/en/latest/reference/ffi.html).
84|||
84|||
85||| @ f an FFI descriptor, which is specific to the compiler backend.
85||| @ f an FFI descriptor, which is specific to the compiler backend.
86||| @ fname the name of the foreign function
86||| @ fname the name of the foreign function
libs/prelude/Prelude/File.idr+34−27
@@ -3,6 +3,7 @@ module Prelude.File
3import Builtins
3import Builtins
4import Prelude.List
4import Prelude.List
5import Prelude.Maybe
5import Prelude.Maybe
6+import Prelude.Functor
6import Prelude.Monad
7import Prelude.Monad
7import Prelude.Chars
8import Prelude.Chars
8import Prelude.Strings
9import Prelude.Strings
@@ -80,7 +81,7 @@ do_ferror h = foreign FFI_C "fileError" (Ptr -> IO Int) h
80export
81export
81ferror : File -> IO Bool
82ferror : File -> IO Bool
82ferror (FHandle h) = do err <- do_ferror h
83ferror (FHandle h) = do err <- do_ferror h
83− pure (not (err == 0))
84+ pure (err /= 0)
84
85
85||| Call the RTS's file opening function
86||| Call the RTS's file opening function
86private
87private
@@ -95,15 +96,13 @@ export
95fopen : (f : String) -> (m : String) -> IO (Either FileError File)
96fopen : (f : String) -> (m : String) -> IO (Either FileError File)
96fopen f m = do h <- do_fopen f m
97fopen f m = do h <- do_fopen f m
97 if !(nullPtr h)
98 if !(nullPtr h)
98− then do err <- getFileError
99+ then Left <$> getFileError
99− pure (Left err)
100 else pure (Right (FHandle h))
100 else pure (Right (FHandle h))
101
101
102||| Check whether a file handle is actually a null pointer
102||| Check whether a file handle is actually a null pointer
103export
103export
104validFile : File -> IO Bool
104validFile : File -> IO Bool
105−validFile (FHandle h) = do x <- nullPtr h
105+validFile (FHandle h) = not <$> nullPtr h
106− pure (not x)
107
106
108||| Modes for opening files
107||| Modes for opening files
109data Mode = Read | WriteTruncate | Append | ReadWrite | ReadWriteTruncate | ReadAppend
108data Mode = Read | WriteTruncate | Append | ReadWrite | ReadWriteTruncate | ReadAppend
@@ -151,7 +150,8 @@ do_getFileAccessTime h =
151private
150private
152do_getFileModifiedTime : Ptr -> IO Integer
151do_getFileModifiedTime : Ptr -> IO Integer
153do_getFileModifiedTime h =
152do_getFileModifiedTime h =
153+ do vm <- getMyVM
154− do MkRaw i <- foreign FFI_C "fileModifiedTime" (Ptr -> IO (Raw Integer)) h
154+ MkRaw i <- foreign FFI_C "fileModifiedTime" (Ptr -> Ptr -> IO (Raw Integer)) vm h
155 pure i
155 pure i
156
156
157private
157private
@@ -169,17 +169,15 @@ fileSize : File -> IO (Either FileError Int)
169fileSize (FHandle h)
169fileSize (FHandle h)
170 = do s <- do_getFileSize h
170 = do s <- do_getFileSize h
171 if (s < 0)
171 if (s < 0)
172− then do err <- getFileError
172+ then Left <$> getFileError
173− pure (Left err)
174 else pure (Right s)
173 else pure (Right s)
175
174
176export
175export
177fileModifiedTime : File -> IO (Either FileError Integer)
176fileModifiedTime : File -> IO (Either FileError Integer)
178fileModifiedTime (FHandle h)
177fileModifiedTime (FHandle h)
179 = do s <- do_getFileModifiedTime h
178 = do s <- do_getFileModifiedTime h
180− if (s < 0)
179+ if (s == -1)
181− then do err <- getFileError
180+ then Left <$> getFileError
182− pure (Left err)
183 else pure (Right s)
181 else pure (Right s)
184
182
185export
183export
@@ -187,8 +185,7 @@ fileAccessTime : File -> IO (Either FileError Integer)
187fileAccessTime (FHandle h)
185fileAccessTime (FHandle h)
188 = do s <- do_getFileAccessTime h
186 = do s <- do_getFileAccessTime h
189 if (s < 0)
187 if (s < 0)
190− then do err <- getFileError
188+ then Left <$> getFileError
191− pure (Left err)
192 else pure (Right s)
189 else pure (Right s)
193
190
194export
191export
@@ -196,11 +193,9 @@ fileStatusTime : File -> IO (Either FileError Integer)
196fileStatusTime (FHandle h)
193fileStatusTime (FHandle h)
197 = do s <- do_getFileStatusTime h
194 = do s <- do_getFileStatusTime h
198 if (s < 0)
195 if (s < 0)
199− then do err <- getFileError
196+ then Left <$> getFileError
200− pure (Left err)
201 else pure (Right s)
197 else pure (Right s)
202
198
203−
204private
199private
205do_fread : Ptr -> IO' l String
200do_fread : Ptr -> IO' l String
206do_fread h = prim_fread h
201do_fread h = prim_fread h
@@ -264,8 +259,7 @@ do_fwrite h s = do res <- prim_fwrite h s
264 then do errno <- getErrno
259 then do errno <- getErrno
265 if errno == 0
260 if errno == 0
266 then pure (Left FileWriteError)
261 then pure (Left FileWriteError)
267− else do err <- getFileError
262+ else Left <$> getFileError
268− pure (Left err)
269 else pure (Right ())
263 else pure (Right ())
270
264
271||| Write a line to a file
265||| Write a line to a file
@@ -287,7 +281,18 @@ do_feof h = foreign FFI_C "fileEOF" (Ptr -> IO Int) h
287export
281export
288fEOF : File -> IO Bool
282fEOF : File -> IO Bool
289fEOF (FHandle h) = do eof <- do_feof h
283fEOF (FHandle h) = do eof <- do_feof h
290− pure (not (eof == 0))
284+ pure (eof /= 0)
285+
286+private
287+do_fremove : String -> IO Int
288+do_fremove s = foreign FFI_C "fileRemove" (String -> IO Int) s
289+
290+||| Remove a file
291+||| @s the file name
292+export
293+fRemove : (s : String) -> IO Bool
294+fRemove s = do res <- do_fremove s
295+ pure (res == 0)
291
296
292export
297export
293fpoll : File -> IO Bool
298fpoll : File -> IO Bool
@@ -306,7 +311,8 @@ readFile : (filepath : String) -> IO (Either FileError String)
306readFile fn = do Right h <- openFile fn Read
311readFile fn = do Right h <- openFile fn Read
307 | Left err => pure (Left err)
312 | Left err => pure (Left err)
308 Right max <- fileSize h
313 Right max <- fileSize h
314+ | Left err => do closeFile h
309− | Left err => pure (Left err)
315+ pure (Left err)
310 sb <- newStringBuffer (max + 1)
316 sb <- newStringBuffer (max + 1)
311 c <- readFile' h max sb
317 c <- readFile' h max sb
312 closeFile h
318 closeFile h
@@ -329,8 +335,11 @@ export
329writeFile : (filepath : String) -> (contents : String) ->
335writeFile : (filepath : String) -> (contents : String) ->
330 IO (Either FileError ())
336 IO (Either FileError ())
331writeFile fn contents = do
337writeFile fn contents = do
332− Right h <- openFile fn WriteTruncate | Left err => pure (Left err)
338+ Right h <- openFile fn WriteTruncate
339+ | Left err => pure (Left err)
333− Right () <- fPutStr h contents | Left err => pure (Left err)
340+ Right () <- fPutStr h contents
341+ | Left err => do closeFile h
342+ pure (Left err)
334 closeFile h
343 closeFile h
335 pure (Right ())
344 pure (Right ())
336
345
@@ -340,8 +349,7 @@ dirOpen : (d : String) -> IO (Either FileError Directory)
340dirOpen d
349dirOpen d
341 = do dptr <- foreign FFI_C "idris_dirOpen" (String -> IO Ptr) d
350 = do dptr <- foreign FFI_C "idris_dirOpen" (String -> IO Ptr) d
342 if !(nullPtr dptr)
351 if !(nullPtr dptr)
343− then do err <- getFileError
352+ then Left <$> getFileError
344− pure (Left err)
345 else pure (Right (DHandle dptr))
353 else pure (Right (DHandle dptr))
346
354
347export
355export
@@ -352,7 +360,7 @@ export
352dirError : Directory -> IO Bool
360dirError : Directory -> IO Bool
353dirError (DHandle d)
361dirError (DHandle d)
354 = do err <- foreign FFI_C "idris_dirError" (Ptr -> IO Int) d
362 = do err <- foreign FFI_C "idris_dirError" (Ptr -> IO Int) d
355− pure (not (err == 0))
363+ pure (err /= 0)
356
364
357export
365export
358dirEntry : Directory -> IO (Either FileError String)
366dirEntry : Directory -> IO (Either FileError String)
@@ -368,8 +376,7 @@ createDir d
368 = do ok <- foreign FFI_C "idris_mkdir" (String -> IO Int) d
376 = do ok <- foreign FFI_C "idris_mkdir" (String -> IO Int) d
369 if (ok == 0)
377 if (ok == 0)
370 then pure (Right ())
378 then pure (Right ())
371− else do err <- getFileError
379+ else Left <$> getFileError
372− pure (Left err)
373
380
374export
381export
375changeDir : String -> IO Bool
382changeDir : String -> IO Bool
libs/prelude/Prelude/Nat.idr+32−61
@@ -512,19 +512,18 @@ plusLeftCancel (S left) right right' p =
512
512
513total plusRightCancel : (left : Nat) -> (left' : Nat) -> (right : Nat) ->
513total plusRightCancel : (left : Nat) -> (left' : Nat) -> (right : Nat) ->
514 (p : left + right = left' + right) -> left = left'
514 (p : left + right = left' + right) -> left = left'
515−plusRightCancel left left' Z p = rewrite sym (plusZeroRightNeutral left) in
515+plusRightCancel left left' right p =
516− rewrite sym (plusZeroRightNeutral left') in
516+ plusLeftCancel right left left' $
517− p
517+ rewrite plusCommutative right left in
518−plusRightCancel left left' (S right) p =
518+ rewrite plusCommutative right left' in
519− plusRightCancel left left' right
519+ p
520− (succInjective _ _ (rewrite plusSuccRightSucc left right in
521− rewrite plusSuccRightSucc left' right in p))
522
520
523total plusLeftLeftRightZero : (left : Nat) -> (right : Nat) ->
521total plusLeftLeftRightZero : (left : Nat) -> (right : Nat) ->
524 (p : left + right = left) -> right = Z
522 (p : left + right = left) -> right = Z
525−plusLeftLeftRightZero Z right p = p
523+plusLeftLeftRightZero left right p =
526−plusLeftLeftRightZero (S left) right p =
524+ plusLeftCancel left right Z $
527− plusLeftLeftRightZero left right (succInjective _ _ p)
525+ rewrite plusZeroRightNeutral left in
526+ p
528
527
529-- Mult
528-- Mult
530total multZeroLeftZero : (right : Nat) -> Z * right = Z
529total multZeroLeftZero : (right : Nat) -> Z * right = Z
@@ -558,27 +557,21 @@ multCommutative (S left) right =
558 rewrite multRightSuccPlus right left in
557 rewrite multRightSuccPlus right left in
559 Refl
558 Refl
560
559
561−total multDistributesOverPlusRight : (left : Nat) -> (centre : Nat) -> (right : Nat) ->
562− left * (centre + right) = (left * centre) + (left * right)
563−multDistributesOverPlusRight Z centre right = Refl
564−multDistributesOverPlusRight (S left) centre right =
565− let inductiveHypothesis = multDistributesOverPlusRight left centre right in
566− rewrite inductiveHypothesis in
567− rewrite plusAssociative (plus centre (mult left centre)) right (mult left right) in
568− rewrite sym (plusAssociative centre (mult left centre) right) in
569− rewrite plusCommutative (mult left centre) right in
570− rewrite plusAssociative centre right (mult left centre) in
571− rewrite plusAssociative (plus centre right) (mult left centre) (mult left right) in
572− Refl
573−
574total multDistributesOverPlusLeft : (left : Nat) -> (centre : Nat) -> (right : Nat) ->
560total multDistributesOverPlusLeft : (left : Nat) -> (centre : Nat) -> (right : Nat) ->
575 (left + centre) * right = (left * right) + (centre * right)
561 (left + centre) * right = (left * right) + (centre * right)
576−multDistributesOverPlusLeft Z centre right = Refl
562+multDistributesOverPlusLeft Z centre right = Refl
577−multDistributesOverPlusLeft (S left) centre right =
563+multDistributesOverPlusLeft (S k) centre right =
578− let inductiveHypothesis = multDistributesOverPlusLeft left centre right in
564+ rewrite multDistributesOverPlusLeft k centre right in
579− rewrite inductiveHypothesis in
580− rewrite plusAssociative right (mult left right) (mult centre right) in
565+ rewrite plusAssociative right (k * right) (centre * right) in
581− Refl
566+ Refl
567+
568+total multDistributesOverPlusRight : (left : Nat) -> (centre : Nat) -> (right : Nat) ->
569+ left * (centre + right) = (left * centre) + (left * right)
570+multDistributesOverPlusRight left centre right =
571+ rewrite multCommutative left (centre + right) in
572+ rewrite multCommutative left centre in
573+ rewrite multCommutative left right in
574+ multDistributesOverPlusLeft centre right left
582
575
583total multAssociative : (left : Nat) -> (centre : Nat) -> (right : Nat) ->
576total multAssociative : (left : Nat) -> (centre : Nat) -> (right : Nat) ->
584 left * (centre * right) = (left * centre) * right
577 left * (centre * right) = (left * centre) * right
@@ -590,18 +583,10 @@ multAssociative (S left) centre right =
590 Refl
583 Refl
591
584
592total multOneLeftNeutral : (right : Nat) -> 1 * right = right
585total multOneLeftNeutral : (right : Nat) -> 1 * right = right
593−multOneLeftNeutral Z = Refl
586+multOneLeftNeutral right = plusZeroRightNeutral right
594−multOneLeftNeutral (S right) =
595− let inductiveHypothesis = multOneLeftNeutral right in
596− rewrite inductiveHypothesis in
597− Refl
598
587
599total multOneRightNeutral : (left : Nat) -> left * 1 = left
588total multOneRightNeutral : (left : Nat) -> left * 1 = left
600−multOneRightNeutral Z = Refl
589+multOneRightNeutral left = rewrite multCommutative left 1 in multOneLeftNeutral left
601−multOneRightNeutral (S left) =
602− let inductiveHypothesis = multOneRightNeutral left in
603− rewrite inductiveHypothesis in
604− Refl
605
590
606-- Minus
591-- Minus
607total minusSuccSucc : (left : Nat) -> (right : Nat) ->
592total minusSuccSucc : (left : Nat) -> (right : Nat) ->
@@ -689,10 +674,7 @@ total powerZeroOne : (base : Nat) -> power base 0 = S Z
689powerZeroOne base = Refl
674powerZeroOne base = Refl
690
675
691total powerOneNeutral : (base : Nat) -> power base 1 = base
676total powerOneNeutral : (base : Nat) -> power base 1 = base
692−powerOneNeutral Z = Refl
677+powerOneNeutral base = rewrite multCommutative base 1 in multOneLeftNeutral base
693−powerOneNeutral (S base) =
694− let inductiveHypothesis = powerOneNeutral base in
695− rewrite inductiveHypothesis in Refl
696
678
697total powerOneSuccOne : (exp : Nat) -> power 1 exp = S Z
679total powerOneSuccOne : (exp : Nat) -> power 1 exp = S Z
698powerOneSuccOne Z = Refl
680powerOneSuccOne Z = Refl
@@ -701,8 +683,7 @@ powerOneSuccOne (S exp) =
701 rewrite inductiveHypothesis in Refl
683 rewrite inductiveHypothesis in Refl
702
684
703total powerSuccSuccMult : (base : Nat) -> power base 2 = mult base base
685total powerSuccSuccMult : (base : Nat) -> power base 2 = mult base base
704−powerSuccSuccMult Z = Refl
705−powerSuccSuccMult (S base) = rewrite multOneRightNeutral base in Refl
686+powerSuccSuccMult base = rewrite multOneRightNeutral base in Refl
706
687
707total powerPowerMultPower : (base : Nat) -> (exp : Nat) -> (exp' : Nat) ->
688total powerPowerMultPower : (base : Nat) -> (exp : Nat) -> (exp' : Nat) ->
708 power (power base exp) exp' = power base (exp * exp')
689 power (power base exp) exp' = power base (exp * exp')
@@ -796,34 +777,24 @@ minimumIdempotent Z = Refl
796minimumIdempotent (S k) = cong (minimumIdempotent k)
777minimumIdempotent (S k) = cong (minimumIdempotent k)
797
778
798total minimumZeroZeroRight : (right : Nat) -> minimum 0 right = Z
779total minimumZeroZeroRight : (right : Nat) -> minimum 0 right = Z
799−minimumZeroZeroRight Z = Refl
780+minimumZeroZeroRight right = Refl
800−minimumZeroZeroRight (S right) = minimumZeroZeroRight right
801
781
802total minimumZeroZeroLeft : (left : Nat) -> minimum left 0 = Z
782total minimumZeroZeroLeft : (left : Nat) -> minimum left 0 = Z
803−minimumZeroZeroLeft Z = Refl
783+minimumZeroZeroLeft left = rewrite minimumCommutative left 0 in Refl
804−minimumZeroZeroLeft (S left) = Refl
805
784
806total minimumSuccSucc : (left : Nat) -> (right : Nat) ->
785total minimumSuccSucc : (left : Nat) -> (right : Nat) ->
807 minimum (S left) (S right) = S (minimum left right)
786 minimum (S left) (S right) = S (minimum left right)
808−minimumSuccSucc Z Z = Refl
787+minimumSuccSucc left right = Refl
809−minimumSuccSucc (S left) Z = Refl
810−minimumSuccSucc Z (S right) = Refl
811−minimumSuccSucc (S left) (S right) = Refl
812
788
813total maximumZeroNRight : (right : Nat) -> maximum Z right = right
789total maximumZeroNRight : (right : Nat) -> maximum Z right = right
814−maximumZeroNRight Z = Refl
790+maximumZeroNRight right = Refl
815−maximumZeroNRight (S right) = Refl
816
791
817total maximumZeroNLeft : (left : Nat) -> maximum left Z = left
792total maximumZeroNLeft : (left : Nat) -> maximum left Z = left
818−maximumZeroNLeft Z = Refl
793+maximumZeroNLeft left = rewrite maximumCommutative left Z in Refl
819−maximumZeroNLeft (S left) = Refl
820
794
821total maximumSuccSucc : (left : Nat) -> (right : Nat) ->
795total maximumSuccSucc : (left : Nat) -> (right : Nat) ->
822 S (maximum left right) = maximum (S left) (S right)
796 S (maximum left right) = maximum (S left) (S right)
823−maximumSuccSucc Z Z = Refl
797+maximumSuccSucc left right = Refl
824−maximumSuccSucc (S left) Z = Refl
825−maximumSuccSucc Z (S right) = Refl
826−maximumSuccSucc (S left) (S right) = Refl
827
798
828total sucMaxL : (l : Nat) -> maximum (S l) l = (S l)
799total sucMaxL : (l : Nat) -> maximum (S l) l = (S l)
829sucMaxL Z = Refl
800sucMaxL Z = Refl
man/idris.1+2−2
@@ -1,6 +1,6 @@
1.\" Manpage for Idris.
1.\" Manpage for Idris.
2.\" Contact <> to correct errors or typos.
2.\" Contact <> to correct errors or typos.
3−.TH man 1 "23 October 2018" "1.3.1" "Idris man page"
3+.TH man 1 "23 October 2018" "1.3.2" "Idris man page"
4.SH NAME
4.SH NAME
5idris -\ a general purpose pure functional programming language with dependent types.
5idris -\ a general purpose pure functional programming language with dependent types.
6.SH SYNOPSIS
6.SH SYNOPSIS
@@ -113,7 +113,7 @@ should not necessarily be seen as production ready nor for industrial use.
113
113
114.SH SEE ALSO
114.SH SEE ALSO
115
115
116−+ The IDRIS web site (http://idris-lang.org/
116++ The IDRIS web site (https://idris-lang.org/
117
117
118+ The IRC channel #idris, on chat.freenode.net
118+ The IRC channel #idris, on chat.freenode.net
119
119
rts/idris_bitstring.c−2
@@ -1,5 +1,3 @@
1−#include <assert.h>
2−
3#include "idris_rts.h"
1#include "idris_rts.h"
4
2
5VAL idris_b8const(VM *vm, uint8_t a) {
3VAL idris_b8const(VM *vm, uint8_t a) {
rts/idris_rts.c+7−10
@@ -242,6 +242,13 @@ void* iallocate(VM * vm, size_t isize, int outerlock) {
242 vm->heap.size += size;
242 vm->heap.size += size;
243 }
243 }
244 idris_gc(vm);
244 idris_gc(vm);
245+
246+ // If there's still not enough room, grow the heap and try again
247+ if (vm->heap.next + size >= vm->heap.end) {
248+ vm->heap.size += size+vm->heap.growth;
249+ idris_gc(vm);
250+ }
251+
245#ifdef HAS_PTHREAD
252#ifdef HAS_PTHREAD
246 if (lock) { // not message passing
253 if (lock) { // not message passing
247 pthread_mutex_unlock(&vm->alloc_lock);
254 pthread_mutex_unlock(&vm->alloc_lock);
@@ -1151,16 +1158,6 @@ void idris_disableBuffering(void) {
1151 setvbuf(stdout, NULL, _IONBF, 0);
1158 setvbuf(stdout, NULL, _IONBF, 0);
1152}
1159}
1153
1160
1154−#ifndef SEL4
1155−int idris_usleep(int usec) {
1156− struct timespec t;
1157− t.tv_sec = usec / 1000000;
1158− t.tv_nsec = (usec % 1000000) * 1000;
1159−
1160− return nanosleep(&t, NULL);
1161−}
1162−#endif // SEL4
1163−
1164void stackOverflow(void) {
1161void stackOverflow(void) {
1165 fprintf(stderr, "Stack overflow");
1162 fprintf(stderr, "Stack overflow");
1166 exit(-1);
1163 exit(-1);
rts/idris_rts.h+3−4
@@ -291,6 +291,9 @@ typedef intptr_t i_int;
291 if (vm->valstack_top+(x) > vm->stack_max) { stackOverflow(); } \
291 if (vm->valstack_top+(x) > vm->stack_max) { stackOverflow(); } \
292 else { memset(vm->valstack_top, 0, (x)*sizeof(VAL)); } \
292 else { memset(vm->valstack_top, 0, (x)*sizeof(VAL)); } \
293 } while(0)
293 } while(0)
294+#define RESERVENOALLOC(x) do { \
295+ if (vm->valstack_top+(x) > vm->stack_max) { stackOverflow(); } \
296+ } while(0)
294#define ADDTOP(x) vm->valstack_top += (x)
297#define ADDTOP(x) vm->valstack_top += (x)
295#define TOPBASE(x) vm->valstack_top = vm->valstack_base + (x)
298#define TOPBASE(x) vm->valstack_top = vm->valstack_base + (x)
296#define BASETOP(x) vm->valstack_base = vm->valstack_top + (x)
299#define BASETOP(x) vm->valstack_base = vm->valstack_top + (x)
@@ -504,10 +507,6 @@ const char *idris_getArg(int i);
504// disable stdin/stdout buffering
507// disable stdin/stdout buffering
505void idris_disableBuffering(void);
508void idris_disableBuffering(void);
506
509
507−#ifndef SEL4
508−int idris_usleep(int usec);
509−#endif // SEL4
510−
511// Handle stack overflow.
510// Handle stack overflow.
512// Just reports an error and exits.
511// Just reports an error and exits.
513
512
rts/idris_stdfgn.c+21−7
@@ -11,9 +11,7 @@
11#include <unistd.h>
11#include <unistd.h>
12
12
13#ifdef _WIN32
13#ifdef _WIN32
14−int win_fpoll(void* h);
14+#include "windows/win_utils.h"
15−FILE *win32_u8fopen(const char *path, const char *mode);
16−FILE *win32_u8popen(const char *path, const char *mode);
17#else
15#else
18#include <sys/select.h>
16#include <sys/select.h>
19#endif
17#endif
@@ -48,6 +46,10 @@ int fileError(void* h) {
48 return ferror(f);
46 return ferror(f);
49}
47}
50
48
49+int fileRemove(const char *filename) {
50+ return remove(filename);
51+}
52+
51int fileSize(void* h) {
53int fileSize(void* h) {
52 FILE* f = (FILE*)h;
54 FILE* f = (FILE*)h;
53 int fd = fileno(f);
55 int fd = fileno(f);
@@ -72,13 +74,13 @@ VAL fileAccessTime(void* h) {
72 }
74 }
73}
75}
74
76
75−VAL fileModifiedTime(void* h) {
77+VAL fileModifiedTime(VM* vm, void* h) {
76 FILE* f = (FILE*)h;
78 FILE* f = (FILE*)h;
77 int fd = fileno(f);
79 int fd = fileno(f);
78
80
79 struct stat buf;
81 struct stat buf;
80 if (fstat(fd, &buf) == 0) {
82 if (fstat(fd, &buf) == 0) {
81− return MKBIGI(buf.st_mtime);
83+ return MKBIGUI(vm, buf.st_mtime);
82 } else {
84 } else {
83 return MKBIGI(-1);
85 return MKBIGI(-1);
84 }
86 }
@@ -209,9 +211,11 @@ VAL idris_time() {
209VAL idris_clock(VM* vm) {
211VAL idris_clock(VM* vm) {
210 VAL result;
212 VAL result;
211#ifdef _WIN32
213#ifdef _WIN32
214+ int64_t sec, nsec;
215+ win32_gettime(&sec, &nsec);
212 idris_constructor(result, vm, 0, 2, 0);
216 idris_constructor(result, vm, 0, 2, 0);
213− idris_setConArg(result, 0, MKBIGI(0));
217+ idris_setConArg(result, 0, MKBIGI(sec));
214− idris_setConArg(result, 1, MKBIGI(0));
218+ idris_setConArg(result, 1, MKBIGI(nsec));
215#else
219#else
216 struct timespec ts;
220 struct timespec ts;
217 // We're not checking the result here, which is of course bad, but
221 // We're not checking the result here, which is of course bad, but
@@ -224,6 +228,16 @@ VAL idris_clock(VM* vm) {
224 return result;
228 return result;
225}
229}
226
230
231+#ifndef SEL4
232+int idris_usleep(int usec) {
233+ struct timespec t;
234+ t.tv_sec = usec / 1000000;
235+ t.tv_nsec = (usec % 1000000) * 1000;
236+
237+ return nanosleep(&t, NULL);
238+}
239+#endif // SEL4
240+
227VAL idris_mkFileError(VM* vm) {
241VAL idris_mkFileError(VM* vm) {
228 VAL result;
242 VAL result;
229 switch(errno) {
243 switch(errno) {
rts/idris_stdfgn.h+5−1
@@ -12,12 +12,13 @@ void* fileOpen(char* f, char* mode);
12void fileClose(void* h);
12void fileClose(void* h);
13int fileEOF(void* h);
13int fileEOF(void* h);
14int fileError(void* h);
14int fileError(void* h);
15+int fileRemove(const char* fname);
15// Returns a negative number if not a file (e.g. directory or device)
16// Returns a negative number if not a file (e.g. directory or device)
16int fileSize(void* h);
17int fileSize(void* h);
17
18
18// Return a negative number if not a file (e.g. directory or device)
19// Return a negative number if not a file (e.g. directory or device)
19VAL fileAccessTime(void* h);
20VAL fileAccessTime(void* h);
20−VAL fileModifiedTime(void* h);
21+VAL fileModifiedTime(VM* vm, void* h);
21VAL fileStatusTime(void* h);
22VAL fileStatusTime(void* h);
22
23
23void* idris_dirOpen(char* dname);
24void* idris_dirOpen(char* dname);
@@ -53,6 +54,9 @@ char* getEnvPair(int i);
53
54
54VAL idris_time();
55VAL idris_time();
55VAL idris_clock(VM* vm);
56VAL idris_clock(VM* vm);
57+#ifndef SEL4
58+int idris_usleep(int usec);
59+#endif // SEL4
56
60
57void idris_forceGC();
61void idris_forceGC();
58
62
rts/idris_utf8.c−1
@@ -1,5 +1,4 @@
1#include "idris_utf8.h"
1#include "idris_utf8.h"
2−#include <stdio.h>
3#include <string.h>
2#include <string.h>
4#include <stdlib.h>
3#include <stdlib.h>
5
4
rts/windows/win_utils.c+16
@@ -1,7 +1,9 @@
1#include <io.h>
1#include <io.h>
2+#include <stdint.h>
2#include <stdio.h>
3#include <stdio.h>
3#include <windows.h>
4#include <windows.h>
4
5
6+
5// THis file exists to avoid clashes between windows.h and idris_rts.h
7// THis file exists to avoid clashes between windows.h and idris_rts.h
6//
8//
7
9
@@ -28,6 +30,7 @@ int widen_utf8(const char *filename_utf8, LPWSTR *filename_w)
28 MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, *filename_w, num_chars);
30 MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, *filename_w, num_chars);
29 return num_chars;
31 return num_chars;
30}
32}
33+
31FILE *win32_u8fopen(const char *path, const char *mode)
34FILE *win32_u8fopen(const char *path, const char *mode)
32{
35{
33 LPWSTR wpath, wmode;
36 LPWSTR wpath, wmode;
@@ -49,3 +52,16 @@ FILE *win32_u8popen(const char *path, const char *mode)
49 free(wmode);
52 free(wmode);
50 return f;
53 return f;
51}
54}
55+
56+void win32_gettime(int64_t* sec, int64_t* nsec)
57+{
58+ FILETIME ft;
59+ GetSystemTimePreciseAsFileTime(&ft);
60+ ULARGE_INTEGER t;
61+ t.HighPart = ft.dwHighDateTime;
62+ t.LowPart = ft.dwLowDateTime;
63+
64+ *nsec = (t.QuadPart % 10000000)*100;
65+ *sec = t.QuadPart / 10000000;
66+ *sec -= 11644473600; // LDAP epoch to Unix epoch
67+}
rts/windows/win_utils.hnew file+9
@@ -0,0 +1,9 @@
1+#include <stdint.h>
2+#include <stdio.h>
3+
4+#pragma once
5+
6+int win_fpoll(void *h);
7+FILE *win32_u8fopen(const char *path, const char *mode);
8+FILE *win32_u8popen(const char *path, const char *mode);
9+void win32_gettime(int64_t* sec, int64_t* nsec);
src/IRTS/Bytecode.hs+3−2
@@ -86,6 +86,7 @@ data BC =
86 -- | reserve n more stack items (i.e. check there's space, grow if
86 -- | reserve n more stack items (i.e. check there's space, grow if
87 -- necessary)
87 -- necessary)
88 | RESERVE Int
88 | RESERVE Int
89+ | RESERVENOALLOC Int
89
90
90 -- | move the top of stack up
91 -- | move the top of stack up
91 | ADDTOP Int
92 | ADDTOP Int
@@ -127,13 +128,13 @@ bc reg (SV (Loc i)) r = assign reg (L i) ++ clean r
127bc reg (SApp False f vs) r =
128bc reg (SApp False f vs) r =
128 if argCount == 0
129 if argCount == 0
129 then moveReg 0 vs ++ [STOREOLD, BASETOP 0, CALL f] ++ ret
130 then moveReg 0 vs ++ [STOREOLD, BASETOP 0, CALL f] ++ ret
130− else RESERVE argCount : moveReg 0 vs ++
131+ else RESERVENOALLOC argCount : moveReg 0 vs ++
131 [STOREOLD, BASETOP 0, ADDTOP argCount, CALL f] ++ ret
132 [STOREOLD, BASETOP 0, ADDTOP argCount, CALL f] ++ ret
132 where
133 where
133 ret = assign reg RVal ++ clean r
134 ret = assign reg RVal ++ clean r
134 argCount = length vs
135 argCount = length vs
135bc reg (SApp True f vs) r
136bc reg (SApp True f vs) r
136− = RESERVE (length vs) : moveReg 0 vs
137+ = RESERVENOALLOC (length vs) : moveReg 0 vs
137 ++ [SLIDE (length vs), TOPBASE (length vs), TAILCALL f]
138 ++ [SLIDE (length vs), TOPBASE (length vs), TAILCALL f]
138bc reg (SForeign t fname args) r
139bc reg (SForeign t fname args) r
139 = FOREIGNCALL reg t fname (map farg args) : clean r
140 = FOREIGNCALL reg t fname (map farg args) : clean r
src/IRTS/CodegenC.hs+2
@@ -321,6 +321,8 @@ bcc f i (SLIDE n) = indent i ++ "SLIDE(vm, " ++ show n ++ ");\n"
321bcc f i REBASE = indent i ++ "REBASE;\n"
321bcc f i REBASE = indent i ++ "REBASE;\n"
322bcc f i (RESERVE 0) = ""
322bcc f i (RESERVE 0) = ""
323bcc f i (RESERVE n) = indent i ++ "RESERVE(" ++ show n ++ ");\n"
323bcc f i (RESERVE n) = indent i ++ "RESERVE(" ++ show n ++ ");\n"
324+bcc f i (RESERVENOALLOC 0) = ""
325+bcc f i (RESERVENOALLOC n) = indent i ++ "RESERVENOALLOC(" ++ show n ++ ");\n"
324bcc f i (ADDTOP 0) = ""
326bcc f i (ADDTOP 0) = ""
325bcc f i (ADDTOP n) = indent i ++ "ADDTOP(" ++ show n ++ ");\n"
327bcc f i (ADDTOP n) = indent i ++ "ADDTOP(" ++ show n ++ ");\n"
326bcc f i (TOPBASE n) = indent i ++ "TOPBASE(" ++ show n ++ ");\n"
328bcc f i (TOPBASE n) = indent i ++ "TOPBASE(" ++ show n ++ ");\n"
src/IRTS/DumpBC.hs+1
@@ -63,6 +63,7 @@ serializeBC n bc = indent n ++
63 SLIDE n -> "SLIDE " ++ show n
63 SLIDE n -> "SLIDE " ++ show n
64 REBASE -> "REBASE"
64 REBASE -> "REBASE"
65 RESERVE n -> "RESERVE " ++ show n
65 RESERVE n -> "RESERVE " ++ show n
66+ RESERVENOALLOC n -> "RESERVENOALLOC " ++ show n
66 ADDTOP n -> "ADDTOP " ++ show n
67 ADDTOP n -> "ADDTOP " ++ show n
67 TOPBASE n -> "TOPBASE " ++ show n
68 TOPBASE n -> "TOPBASE " ++ show n
68 BASETOP n -> "BASETOP " ++ show n
69 BASETOP n -> "BASETOP " ++ show n
src/IRTS/Portable.hs+1
@@ -265,6 +265,7 @@ instance ToJSON BC where
265 toJSON (FOREIGNCALL r fd ret exps) = object ["FOREIGNCALL" .= (r, fd, ret, exps)]
265 toJSON (FOREIGNCALL r fd ret exps) = object ["FOREIGNCALL" .= (r, fd, ret, exps)]
266 toJSON (SLIDE i) = object ["SLIDE" .= i]
266 toJSON (SLIDE i) = object ["SLIDE" .= i]
267 toJSON (RESERVE i) = object ["RESERVE" .= i]
267 toJSON (RESERVE i) = object ["RESERVE" .= i]
268+ toJSON (RESERVENOALLOC i) = object ["RESERVENOALLOC" .= i]
268 toJSON (ADDTOP i) = object ["ADDTOP" .= i]
269 toJSON (ADDTOP i) = object ["ADDTOP" .= i]
269 toJSON (TOPBASE i) = object ["TOPBASE" .= i]
270 toJSON (TOPBASE i) = object ["TOPBASE" .= i]
270 toJSON (BASETOP i) = object ["BASETOP" .= i]
271 toJSON (BASETOP i) = object ["BASETOP" .= i]
src/Idris/AbsSyntax.hs+2−1
@@ -1659,7 +1659,8 @@ getUnboundImplicits i t tm = getImps t (collectImps tm)
1659 argInfo n (Imp opt _ _ _ _ _) Placeholder
1659 argInfo n (Imp opt _ _ _ _ _) Placeholder
1660 = (True, PImp 0 True opt n Placeholder)
1660 = (True, PImp 0 True opt n Placeholder)
1661 argInfo n (Imp opt _ _ _ _ _) t'
1661 argInfo n (Imp opt _ _ _ _ _) t'
1662+ = (InaccessibleArg `elem` opt,
1662− = (False, PImp (getPriority i t') True opt n t')
1663+ PImp (getPriority i t') True opt n t')
1663 argInfo n (Exp opt _ _ _) t'
1664 argInfo n (Exp opt _ _ _) t'
1664 = (InaccessibleArg `elem` opt,
1665 = (InaccessibleArg `elem` opt,
1665 PExp (getPriority i t') opt n t')
1666 PExp (getPriority i t') opt n t')
src/Idris/CmdOptions.hs+4−3
@@ -18,6 +18,7 @@ import Idris.Info (getIdrisVersion)
18import Idris.Options
18import Idris.Options
19import IRTS.CodegenCommon
19import IRTS.CodegenCommon
20
20
21+import qualified Control.Monad.Fail as Fail
21import Control.Monad.Trans (lift)
22import Control.Monad.Trans (lift)
22import Control.Monad.Trans.Except (throwE)
23import Control.Monad.Trans.Except (throwE)
23import Control.Monad.Trans.Reader (ask)
24import Control.Monad.Trans.Reader (ask)
@@ -71,7 +72,7 @@ runArgParser = do opts <- execParser $ info parser
71 PP.empty,
72 PP.empty,
72 PP.text "More details over Idris can be found online here:",
73 PP.text "More details over Idris can be found online here:",
73 PP.empty,
74 PP.empty,
74− PP.indent 4 (PP.text "http://www.idris-lang.org/")]
75+ PP.indent 4 (PP.text "https://www.idris-lang.org/")]
75
76
76execArgParserPure :: [String] -> ParserResult [Opt]
77execArgParserPure :: [String] -> ParserResult [Opt]
77execArgParserPure args = preProcOpts <$> execParserPure (prefs idm) (info parser idm) args
78execArgParserPure args = preProcOpts <$> execParserPure (prefs idm) (info parser idm) args
@@ -264,7 +265,7 @@ parseCodegen :: String -> Codegen
264parseCodegen "bytecode" = Bytecode
265parseCodegen "bytecode" = Bytecode
265parseCodegen cg = Via IBCFormat (map toLower cg)
266parseCodegen cg = Via IBCFormat (map toLower cg)
266
267
267−parseLogCats :: Monad m => String -> m [LogCat]
268+parseLogCats :: Fail.MonadFail m => String -> m [LogCat]
268parseLogCats s =
269parseLogCats s =
269 case lastMay (readP_to_S doParse s) of
270 case lastMay (readP_to_S doParse s) of
270 Just (xs, _) -> return xs
271 Just (xs, _) -> return xs
@@ -290,7 +291,7 @@ parseLogCats s =
290 s <- look
291 s <- look
291 fail $ "Category: " ++ s ++ " is not recognised."
292 fail $ "Category: " ++ s ++ " is not recognised."
292
293
293−parseConsoleWidth :: Monad m => String -> m ConsoleWidth
294+parseConsoleWidth :: Fail.MonadFail m => String -> m ConsoleWidth
294parseConsoleWidth "auto" = return AutomaticWidth
295parseConsoleWidth "auto" = return AutomaticWidth
295parseConsoleWidth "infinite" = return InfinitelyWide
296parseConsoleWidth "infinite" = return InfinitelyWide
296parseConsoleWidth s =
297parseConsoleWidth s =
src/Idris/Core/CaseTree.hs+1−1
@@ -627,7 +627,7 @@ groupCons cs = gc [] cs
627 PConst cval -> return $ addConG cval (ps, res) acc
627 PConst cval -> return $ addConG cval (ps, res) acc
628 PSuc n -> return $ addg False CSuc [n] (ps, res) acc
628 PSuc n -> return $ addg False CSuc [n] (ps, res) acc
629 PReflected fn args -> return $ addg False (CFn fn) args (ps, res) acc
629 PReflected fn args -> return $ addg False (CFn fn) args (ps, res) acc
630− pat -> fail $ show pat ++ " is not a constructor or constant (can't happen)"
630+ pat -> error $ show pat ++ " is not a constructor or constant (can't happen)"
631
631
632 addg uniq c conargs res []
632 addg uniq c conargs res []
633 = [ConGroup uniq c [(conargs, res)]]
633 = [ConGroup uniq c [(conargs, res)]]
src/Idris/Core/Evaluate.hs+7
@@ -24,6 +24,7 @@ module Idris.Core.Evaluate(normalise, normaliseTrace, normaliseC,
24 lookupNames, lookupTyName, lookupTyNameExact, lookupTy, lookupTyExact,
24 lookupNames, lookupTyName, lookupTyNameExact, lookupTy, lookupTyExact,
25 lookupP, lookupP_all, lookupDef, lookupNameDef, lookupDefExact, lookupDefAcc, lookupDefAccExact, lookupVal,
25 lookupP, lookupP_all, lookupDef, lookupNameDef, lookupDefExact, lookupDefAcc, lookupDefAccExact, lookupVal,
26 mapDefCtxt, tcReducible,
26 mapDefCtxt, tcReducible,
27+ lookupTotalAccessibility,
27 lookupTotal, lookupTotalExact, lookupInjectiveExact,
28 lookupTotal, lookupTotalExact, lookupInjectiveExact,
28 lookupRigCount, lookupRigCountExact,
29 lookupRigCount, lookupRigCountExact,
29 lookupNameTotal, lookupMetaInformation, lookupTyEnv, isTCDict,
30 lookupNameTotal, lookupMetaInformation, lookupTyEnv, isTCDict,
@@ -1167,6 +1168,12 @@ lookupDefAcc n mkpublic ctxt
1167 where mkp (d, _, inj, a, _, _) = if mkpublic && (not (n == sUN "io_bind" || n == sUN "io_pure"))
1168 where mkp (d, _, inj, a, _, _) = if mkpublic && (not (n == sUN "io_bind" || n == sUN "io_pure"))
1168 then (d, Public) else (d, a)
1169 then (d, Public) else (d, a)
1169
1170
1171+lookupTotalAccessibility :: Name -> Context -> [(Totality,Accessibility)]
1172+lookupTotalAccessibility n ctxt = fmap unpack $ lookupCtxt n (definitions ctxt)
1173+
1174+ where
1175+ unpack ((_,_,_,a,t,_)) = (t,a)
1176+
1170lookupDefAccExact :: Name -> Bool -> Context ->
1177lookupDefAccExact :: Name -> Bool -> Context ->
1171 Maybe (Def, Accessibility)
1178 Maybe (Def, Accessibility)
1172lookupDefAccExact n mkpublic ctxt
1179lookupDefAccExact n mkpublic ctxt
src/Idris/Core/Execute.hs+12
@@ -30,6 +30,7 @@ import Data.Maybe
30import Data.Time.Clock.POSIX (getPOSIXTime)
30import Data.Time.Clock.POSIX (getPOSIXTime)
31import Data.Traversable (forM)
31import Data.Traversable (forM)
32import Debug.Trace
32import Debug.Trace
33+import System.Directory
33import System.IO
34import System.IO
34import System.IO.Error
35import System.IO.Error
35import System.IO.Unsafe
36import System.IO.Unsafe
@@ -387,6 +388,17 @@ execForeign env ctxt arity ty fn xs onfail
387 "The argument to fileError should be a file handle, but it was " ++
388 "The argument to fileError should be a file handle, but it was " ++
388 show handle ++
389 show handle ++
389 ". Are all cases covered?"
390 ". Are all cases covered?"
391+ | Just (FFun "fileRemove" [(_,fileStr)] _) <- foreignFromTT arity ty fn xs
392+ = case fileStr of
393+ EConstant (Str f) -> do res <- execIO $ catch (do removeFile f
394+ return $ ioWrap $ EConstant $ I 0)
395+ (\e -> do writeIORef fileError $ mapError e
396+ return $ ioWrap $ EConstant $ I (-1))
397+ execApp env ctxt res (drop arity xs)
398+ _ -> execFail . Msg $
399+ "The argument to fileRemove should be a constant string, but it was " ++
400+ show fileStr ++
401+ ". Are all cases covered?"
390 | Just (FFun "fileClose" [(_,handle)] _) <- foreignFromTT arity ty fn xs
402 | Just (FFun "fileClose" [(_,handle)] _) <- foreignFromTT arity ty fn xs
391 = case handle of
403 = case handle of
392 EHandle h -> do execIO $ hClose h
404 EHandle h -> do execIO $ hClose h
src/Idris/Core/TT.hs+6
@@ -70,6 +70,7 @@ import qualified Prelude as S (Semigroup(..))
70import Control.Applicative (Alternative, Applicative(..))
70import Control.Applicative (Alternative, Applicative(..))
71import qualified Control.Applicative as A (Alternative(..))
71import qualified Control.Applicative as A (Alternative(..))
72import Control.DeepSeq (($!!))
72import Control.DeepSeq (($!!))
73+import qualified Control.Monad.Fail as Fail
73import Control.Monad.State.Strict
74import Control.Monad.State.Strict
74import Data.Binary hiding (get, put)
75import Data.Binary hiding (get, put)
75import Data.Char
76import Data.Char
@@ -324,6 +325,11 @@ bindTC x k = case x of
324instance Monad TC where
325instance Monad TC where
325 return x = OK x
326 return x = OK x
326 x >>= k = bindTC x k
327 x >>= k = bindTC x k
328+#if !(MIN_VERSION_base(4,13,0))
329+ fail = Fail.fail
330+#endif
331+
332+instance Fail.MonadFail TC where
327 fail e = Error (InternalMsg e)
333 fail e = Error (InternalMsg e)
328
334
329instance MonadPlus TC where
335instance MonadPlus TC where
src/Idris/Docs.hs+11−6
@@ -94,11 +94,9 @@ pprintFD ist totalityFlag nsFlag (FD n doc args ty f) =
94 (if not (null argshow)
94 (if not (null argshow)
95 then nest 4 $ text "Arguments:" <$> vsep argshow
95 then nest 4 $ text "Arguments:" <$> vsep argshow
96 else empty)
96 else empty)
97− -- show totality status
97+ -- show totality and visibility status
98− <> let totality = getTotality in
98+ <> showTotalVisibility
99− (if totalityFlag && not (null totality)
99+ )
100− then line <> (vsep . map (\t -> text "The function is" <+> t) $ totality)
101− else empty))
102
100
103 where
101 where
104 ppo = ppOptionIst ist
102 ppo = ppOptionIst ist
@@ -135,7 +133,14 @@ pprintFD ist totalityFlag nsFlag (FD n doc args ty f) =
135 showArgs args ((n, True):bnd)
133 showArgs args ((n, True):bnd)
136 showArgs [] _ = [] -- end of arguments
134 showArgs [] _ = [] -- end of arguments
137
135
138− getTotality = map (text . show) $ lookupTotal n (tt_ctxt ist)
136+ showTotalVisibility =
137+ case lookupTotalAccessibility n (tt_ctxt ist) of
138+ [] -> empty
139+ xs -> line <> vsep (map (doShowTotalVisibility) xs)
140+
141+ doShowTotalVisibility (t,v) = if totalityFlag
142+ then text "The function is:" <+> ((text . show) t) <+> (text "&") <+> ((text . show) v)
143+ else text "The function is:" <+> ((text . show) v)
139
144
140pprintFDWithTotality :: IState -> Bool -> FunDoc -> Doc OutputAnnotation
145pprintFDWithTotality :: IState -> Bool -> FunDoc -> Doc OutputAnnotation
141pprintFDWithTotality ist = pprintFD ist True
146pprintFDWithTotality ist = pprintFD ist True
src/Idris/ModeCommon.hs+1−1
@@ -167,7 +167,7 @@ loadInputs inputs toline -- furthest line to read in input source files
167banner = " ____ __ _ \n" ++
167banner = " ____ __ _ \n" ++
168 " / _/___/ /____(_)____ \n" ++
168 " / _/___/ /____(_)____ \n" ++
169 " / // __ / ___/ / ___/ Version " ++ getIdrisVersion ++ "\n" ++
169 " / // __ / ___/ / ___/ Version " ++ getIdrisVersion ++ "\n" ++
170− " _/ // /_/ / / / (__ ) http://www.idris-lang.org/ \n" ++
170+ " _/ // /_/ / / / (__ ) https://www.idris-lang.org/ \n" ++
171 " /___/\\__,_/_/ /_/____/ Type :? for help \n" ++
171 " /___/\\__,_/_/ /_/____/ Type :? for help \n" ++
172 "\n" ++
172 "\n" ++
173 "Idris is free software with ABSOLUTELY NO WARRANTY. \n" ++
173 "Idris is free software with ABSOLUTELY NO WARRANTY. \n" ++
src/Idris/Parser/Stack.hs+16−2
@@ -5,7 +5,7 @@ Description : Idris parser stack and its primitives.
5License : BSD3
5License : BSD3
6Maintainer : The Idris Community.
6Maintainer : The Idris Community.
7-}
7-}
8−{-# LANGUAGE ConstraintKinds, FlexibleContexts, MultiParamTypeClasses #-}
8+{-# LANGUAGE CPP, ConstraintKinds, FlexibleContexts, MultiParamTypeClasses #-}
9module Idris.Parser.Stack
9module Idris.Parser.Stack
10 ( -- * Parsing
10 ( -- * Parsing
11 Parser(..)
11 Parser(..)
@@ -36,6 +36,7 @@ import Idris.Core.TT (FC(..))
36import Idris.Output (Message(..))
36import Idris.Output (Message(..))
37
37
38import Control.Arrow (app)
38import Control.Arrow (app)
39+import qualified Control.Monad.Fail as Fail
39import Control.Monad.State.Strict (StateT(..), evalStateT)
40import Control.Monad.State.Strict (StateT(..), evalStateT)
40import Control.Monad.Writer.Strict (MonadWriter(..), WriterT(..), listen,
41import Control.Monad.Writer.Strict (MonadWriter(..), WriterT(..), listen,
41 runWriterT, tell)
42 runWriterT, tell)
@@ -51,7 +52,7 @@ import qualified Util.Pretty as PP
51type Parser s = StateT s (WriterT FC (P.Parsec Void String))
52type Parser s = StateT s (WriterT FC (P.Parsec Void String))
52
53
53-- | A constraint for parsing without state
54-- | A constraint for parsing without state
54−type Parsing m = (P.MonadParsec Void String m, MonadWriter FC m)
55+type Parsing m = (Fail.MonadFail m, P.MonadParsec Void String m, MonadWriter FC m)
55
56
56-- | Run the Idris parser stack
57-- | Run the Idris parser stack
57runparser :: Parser st res -> st -> String -> String -> Either ParseError res
58runparser :: Parser st res -> st -> String -> String -> Either ParseError res
@@ -76,11 +77,20 @@ parseErrorOffset = P.errorOffset . parseError
76instance Message ParseError where
77instance Message ParseError where
77 messageExtent err = sourcePositionFC pos
78 messageExtent err = sourcePositionFC pos
78 where
79 where
80+#if MIN_VERSION_megaparsec(8,0,0)
81+ P.PosState {P.pstateSourcePos = pos} =
82+ P.reachOffsetNoLine (parseErrorOffset err) (parseErrorPosState err)
83+#else
79 (pos, _) = P.reachOffsetNoLine (parseErrorOffset err) (parseErrorPosState err)
84 (pos, _) = P.reachOffsetNoLine (parseErrorOffset err) (parseErrorPosState err)
85+#endif
80 messageText = PP.text . init . P.parseErrorTextPretty . parseError
86 messageText = PP.text . init . P.parseErrorTextPretty . parseError
81 messageSource err = Just sline
87 messageSource err = Just sline
82 where
88 where
89+#if MIN_VERSION_megaparsec(8,0,0)
90+ (sline, _) = P.reachOffset (parseErrorOffset err) (parseErrorPosState err)
91+#else
83 (_, sline, _) = P.reachOffset (parseErrorOffset err) (parseErrorPosState err)
92 (_, sline, _) = P.reachOffset (parseErrorOffset err) (parseErrorPosState err)
93+#endif
84
94
85-- | A fully formatted parse error, with caret and bar, etc.
95-- | A fully formatted parse error, with caret and bar, etc.
86prettyError :: ParseError -> String
96prettyError :: ParseError -> String
@@ -88,7 +98,11 @@ prettyError = P.errorBundlePretty . unParseError
88
98
89{- * Mark and restore -}
99{- * Mark and restore -}
90
100
101+#if MIN_VERSION_megaparsec(8,0,0)
102+type Mark = P.State String Void
103+#else
91type Mark = P.State String
104type Mark = P.State String
105+#endif
92
106
93-- | Retrieve the parser state so we can restart from this point later.
107-- | Retrieve the parser state so we can restart from this point later.
94mark :: Parsing m => m Mark
108mark :: Parsing m => m Mark
src/Idris/Reflection.hs+1−1
@@ -1105,7 +1105,7 @@ unApplyRaw tm = ua [] tm
1105 ua args t = (t, args)
1105 ua args t = (t, args)
1106
1106
1107-- | Build the reflected function definition(s) that correspond(s) to
1107-- | Build the reflected function definition(s) that correspond(s) to
1108−-- a provided unqualifed name
1108+-- a provided unqualified name
1109buildFunDefns :: IState -> Name -> [RFunDefn Term]
1109buildFunDefns :: IState -> Name -> [RFunDefn Term]
1110buildFunDefns ist n =
1110buildFunDefns ist n =
1111 [ mkFunDefn name clauses
1111 [ mkFunDefn name clauses
stack-11.22.yamlnew file+21
@@ -0,0 +1,21 @@
1+#recheck extra-deps next on resolver or cabal file change
2+resolver: lts-11.22
3+
4+extra-deps:
5+- cheapskate-0.1.1.2
6+- megaparsec-7.0.5
7+- Cabal-2.4.1.0
8+- network-3.1.1.1
9+- parser-combinators-1.0.0
10+
11+flags:
12+ idris:
13+ FFI: true
14+ GMP: true
15+
16+ghc-options:
17+ idris: -fwarn-unused-imports -fwarn-unused-binds
18+
19+nix:
20+ enable: false
21+ shell-file: stack-shell.nix
stack-12.26.yamlnew file+20
@@ -0,0 +1,20 @@
1+#recheck extra-deps next on resolver or cabal file change
2+resolver: lts-12.26
3+
4+extra-deps:
5+- cheapskate-0.1.1.2
6+- megaparsec-7.0.5
7+- Cabal-2.4.1.0
8+- network-3.1.1.1
9+
10+flags:
11+ idris:
12+ FFI: true
13+ GMP: true
14+
15+ghc-options:
16+ idris: -fwarn-unused-imports -fwarn-unused-binds
17+
18+nix:
19+ enable: false
20+ shell-file: stack-shell.nix
stack-15.3.yamlnew file+17
@@ -0,0 +1,17 @@
1+#recheck extra-deps next on resolver or cabal file change
2+resolver: lts-15.3
3+
4+extra-deps:
5+- cheapskate-0.1.1.2
6+
7+flags:
8+ idris:
9+ FFI: true
10+ GMP: true
11+
12+ghc-options:
13+ idris: -fwarn-unused-imports -fwarn-unused-binds
14+
15+nix:
16+ enable: false
17+ shell-file: stack-shell.nix
stack-15.4.yamlnew file+17
@@ -0,0 +1,17 @@
1+#recheck extra-deps next on resolver or cabal file change
2+resolver: lts-15.4
3+
4+extra-deps:
5+- cheapskate-0.1.1.2
6+
7+flags:
8+ idris:
9+ FFI: true
10+ GMP: true
11+
12+ghc-options:
13+ idris: -fwarn-unused-imports -fwarn-unused-binds
14+
15+nix:
16+ enable: false
17+ shell-file: stack-shell.nix
stack.yamlmode 100644 → 120000+1−25
@@ -1,25 +0,0 @@
1−#recheck extra-deps next on resolver or cabal file change
2−resolver: lts-13.0
3−
4−packages:
5− - location: .
6−
7−extra-deps:
8− - network-2.8.0.0@sha256:aae171e6c6028a7791dbe4de5b9d2da398056359e3cc7927465ffa3cdae1aa0b
9− - Cabal-2.2.0.1@sha256:2a80d8fb655474f0eaeb20434c47f64f84e6302e55973056f00df8ca050b9683
10− - megaparsec-7.0.4
11− - parser-combinators-1.0.0
12− - zip-archive-0.3.3@sha256:47cf2d66cc8e237f7226837758e1b041e24048ef3820d3d10276c500edb921bf
13− - containers-0.5.11.0@sha256:28ad7337057442f75bc689315ab4ec7bdf5e6b2c39668f306672cecd82c02798
14−
15−flags:
16− idris:
17− FFI: true
18− GMP: true
19−
20−ghc-options:
21− idris: -fwarn-unused-imports -fwarn-unused-binds
22−
23−nix:
24− enable: false
25− shell-file: stack-shell.nix
@@ -0,0 +1 @@
1+stack-15.4.yaml
test/README.md+5−5
@@ -113,18 +113,18 @@ and somewhat self-explanatory.
113
113
1141. Choose the family your test shall belong to and remember its identifier.
1141. Choose the family your test shall belong to and remember its identifier.
1152. Pick the next available integer in the test family. It will be the index.
1152. Pick the next available integer in the test family. It will be the index.
116−3. Say the family's identifier is `foo` and the index is `42`. You should call `./mktest.pl foo042` ; this will create the directory and a simple `run` script.
116+3. Say the family's identifier is `foo` and the index is `42`. You should call `./mktest.pl foo042` ; this will create the directory and a simple `run.sh` script.
1174. Modify the `run` script to your liking. If you want to call the idris executable, write `${IDRIS:-idris} $@`.
1174. Modify the `run` script to your liking. If you want to call the idris executable, write `${IDRIS:-idris} $@`.
1185. Add any file you may need in the directory. If they don't end in `.idr`, you should remember them for the next step.
1185. Add any file you may need in the directory. If they don't end in `.idr`, you should remember them for the next step.
1196. Add your test in `TestData.hs`. Each family has a list of `(Index, CompatCodegen)`. See the next section for the available values in `CompatCodegen`. In most cases, you should write `( 42, ANY)`.
1196. Add your test in `TestData.hs`. Each family has a list of `(Index, CompatCodegen)`. See the next section for the available values in `CompatCodegen`. In most cases, you should write `( 42, ANY)`.
120−7. Generate the `expected` file by doing:
120+7. Generate the `expected.out` file by doing:
121 ```
121 ```
122 # Using cabal
122 # Using cabal
123 cabal test --test-options="--pattern foo042 --accept"
123 cabal test --test-options="--pattern foo042 --accept"
124 # Using stack
124 # Using stack
125 stack test --test-arguments="--pattern foo042 --accept"
125 stack test --test-arguments="--pattern foo042 --accept"
126 ```
126 ```
127−8. Check the content of `expected`. Maybe the test didn't do what you thought it would. Fix and go back to 7 until it's ok.
127+8. Check the content of `expected.out`. Maybe the test didn't do what you thought it would. Fix and go back to 7 until it's ok.
128
128
129### Specifying compatible backends
129### Specifying compatible backends
130
130
@@ -146,7 +146,7 @@ Currently, `NONE` has the same effect as `ANY`, but this will change.
146
146
147### Updating golden files
147### Updating golden files
148
148
149−To update the `expected` file for every test, do one of the following:
149+To update the `expected.out` file for every test, do one of the following:
150
150
151```
151```
152# Using make
152# Using make
@@ -157,4 +157,4 @@ cabal test --test-options="--accept"
157stack test --test-arguments="--accept"
157stack test --test-arguments="--accept"
158```
158```
159
159
160−"Accepted" tests are the ones that update the golden file. A test can still fail if the `run` script itself crashes.
160+"Accepted" tests are the ones that update the golden file. A test can still fail if the `run.sh` script itself crashes.
test/TestData.hs+1
@@ -141,6 +141,7 @@ testFamiliesData = [
141 , ( 10, NODE_CG )
141 , ( 10, NODE_CG )
142 , ( 11, NODE_CG )
142 , ( 11, NODE_CG )
143 , ( 12, NODE_CG )
143 , ( 12, NODE_CG )
144+ , ( 13, C_CG )
144 ]),
145 ]),
145 ("folding", "Folding",
146 ("folding", "Folding",
146 [ ( 1, ANY )]),
147 [ ( 1, ANY )]),
test/TestRun.hs+2−2
@@ -62,7 +62,7 @@ ingredients = defaultIngredients ++
62test :: String -> String -> IO () -> TestTree
62test :: String -> String -> IO () -> TestTree
63test testName path = goldenVsFileDiff testName diff ref output
63test testName path = goldenVsFileDiff testName diff ref output
64 where
64 where
65− ref = path </> "expected"
65+ ref = path </> "expected.out"
66 output = path </> "output"
66 output = path </> "output"
67 diff ref new | os == "openbsd" = ["diff", "-u", new, ref]
67 diff ref new | os == "openbsd" = ["diff", "-u", new, ref]
68 | otherwise = ["diff", "--strip-trailing-cr", "-u", new, ref]
68 | otherwise = ["diff", "--strip-trailing-cr", "-u", new, ref]
@@ -92,7 +92,7 @@ mkGoldenTests testFamilies flags =
92-- this thing.
92-- this thing.
93runTest :: String -> Flags -> IO ()
93runTest :: String -> Flags -> IO ()
94runTest path flags = do
94runTest path flags = do
95− let run = (proc "bash" ("run" : flags)) {cwd = Just path}
95+ let run = (proc "bash" ("run.sh" : flags)) {cwd = Just path}
96 (_, output, error_out) <- readCreateProcessWithExitCode run ""
96 (_, output, error_out) <- readCreateProcessWithExitCode run ""
97 writeFile (path </> "output") (normalise output)
97 writeFile (path </> "output") (normalise output)
98 when (error_out /= "") $ hPutStrLn stderr ("\nError: " ++ path ++ "\n" ++ error_out)
98 when (error_out /= "") $ hPutStrLn stderr ("\nError: " ++ path ++ "\n" ++ error_out)
test/base001/expected → test/base001/expected.outrenamed

The content is the same.

test/base001/run → test/base001/run.shrenamed+1−1
@@ -3,7 +3,7 @@
3set -u
3set -u
4
4
5if [[ ${OSTYPE} = 'msys' ]]; then
5if [[ ${OSTYPE} = 'msys' ]]; then
6− cat expected # skip this test on Windows
6+ cat expected.out # skip this test on Windows
7else
7else
8 ${IDRIS:-idris} "$@" --build base001.ipkg | grep -v 'make.*:'
8 ${IDRIS:-idris} "$@" --build base001.ipkg | grep -v 'make.*:'
9 ./base001 2>&1 | grep -v '^sh:.*\./does-not-exist:'
9 ./base001 2>&1 | grep -v '^sh:.*\./does-not-exist:'
test/basic001/expected → test/basic001/expected.outrenamed

The content is the same.

test/basic001/run → test/basic001/run.shrenamed

Only the mode changed.

test/basic002/expected → test/basic002/expected.outrenamed

The content is the same.

test/basic002/run → test/basic002/run.shrenamed

Only the mode changed.

test/basic003/expected → test/basic003/expected.outrenamed

The content is the same.

test/basic003/run → test/basic003/run.shrenamed

Only the mode changed.

test/basic004/expected → test/basic004/expected.outrenamed

The content is the same.

test/basic004/run → test/basic004/run.shrenamed

Only the mode changed.

test/basic005/expected → test/basic005/expected.outrenamed

The content is the same.

test/basic005/run → test/basic005/run.shrenamed

Only the mode changed.

test/basic006/expected → test/basic006/expected.outrenamed

The content is the same.

test/basic006/run → test/basic006/run.shrenamed

Only the mode changed.

test/basic007/expected → test/basic007/expected.outrenamed

The content is the same.

test/basic007/run → test/basic007/run.shrenamed

Only the mode changed.

test/basic008/expected → test/basic008/expected.outrenamed

The content is the same.

test/basic008/run → test/basic008/run.shrenamed

Only the mode changed.

test/basic009/expected → test/basic009/expected.outrenamed

The content is the same.

test/basic009/run → test/basic009/run.shrenamed

Only the mode changed.

test/basic010/expected → test/basic010/expected.outrenamed

The content is the same.

test/basic010/run → test/basic010/run.shrenamed

Only the mode changed.

test/basic011/expected → test/basic011/expected.outrenamed

The content is the same.

test/basic011/run → test/basic011/run.shrenamed

Only the mode changed.

test/basic012/expected → test/basic012/expected.outrenamed

The content is the same.

test/basic012/run → test/basic012/run.shrenamed

Only the mode changed.

test/basic013/expected → test/basic013/expected.outrenamed

The content is the same.

test/basic013/run → test/basic013/run.shrenamed

Only the mode changed.

test/basic014/expected → test/basic014/expected.outrenamed

The content is the same.

test/basic014/run → test/basic014/run.shrenamed

Only the mode changed.

test/basic015/expected → test/basic015/expected.outrenamed

The content is the same.

test/basic015/run → test/basic015/run.shrenamed

Only the mode changed.

test/basic016/expected → test/basic016/expected.outrenamed

The content is the same.

test/basic016/run → test/basic016/run.shrenamed

Only the mode changed.

test/basic017/expected → test/basic017/expected.outrenamed

The content is the same.

test/basic017/run → test/basic017/run.shrenamed

Only the mode changed.

test/basic018/expected → test/basic018/expected.outrenamed

The content is the same.

test/basic018/run → test/basic018/run.shrenamed

Only the mode changed.

test/basic019/expected → test/basic019/expected.outrenamed

The content is the same.

test/basic019/run → test/basic019/run.shrenamed

Only the mode changed.

test/basic020/expected → test/basic020/expected.outrenamed

The content is the same.

test/basic020/run → test/basic020/run.shrenamed

Only the mode changed.

test/basic021/expected → test/basic021/expected.outrenamed

The content is the same.

test/basic021/run → test/basic021/run.shrenamed

Only the mode changed.

test/basic022/expected → test/basic022/expected.outrenamed

The content is the same.

test/basic022/run → test/basic022/run.shrenamed

Only the mode changed.

test/basic023/expected → test/basic023/expected.outrenamed

The content is the same.

test/basic023/run → test/basic023/run.shrenamed

Only the mode changed.

test/basic024/expected → test/basic024/expected.outrenamed

The content is the same.

test/basic024/input → test/basic024/input.inrenamed

The content is the same.

test/basic024/run → test/basic024/run.shrenamed+1−1
@@ -1,6 +1,6 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3−${IDRIS:-idris} $@ --quiet --port none < input
3+${IDRIS:-idris} $@ --quiet --port none < input.in
4${IDRIS:-idris} $@ basic024.idr -o basic024
4${IDRIS:-idris} $@ basic024.idr -o basic024
5
5
6./basic024
6./basic024
test/basic025/expected → test/basic025/expected.outrenamed

The content is the same.

test/basic025/input → test/basic025/input.inrenamed

The content is the same.

test/basic025/run → test/basic025/run.shrenamed+2−2
@@ -1,7 +1,7 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none < input
2+${IDRIS:-idris} $@ --quiet --port none < input.in
3${IDRIS:-idris} $@ -o basic025 basic025.idr
3${IDRIS:-idris} $@ -o basic025 basic025.idr
4
4
5−./basic025 input
5+./basic025 input.in
6
6
7rm -f basic025 *.ibc
7rm -f basic025 *.ibc
test/basic026/expected → test/basic026/expected.outrenamed

The content is the same.

test/basic026/run → test/basic026/run.shrenamed

The content is the same.

test/bignum001/expected → test/bignum001/expected.outrenamed

The content is the same.

test/bignum001/run → test/bignum001/run.shrenamed

Only the mode changed.

test/bignum002/expected → test/bignum002/expected.outrenamed

The content is the same.

test/bignum002/run → test/bignum002/run.shrenamed

Only the mode changed.

test/bignum003/expected → test/bignum003/expected.outrenamed

The content is the same.

test/bignum003/run → test/bignum003/run.shrenamed

Only the mode changed.

test/bounded001/expected → test/bounded001/expected.outrenamed

The content is the same.

test/bounded001/run → test/bounded001/run.shrenamed

Only the mode changed.

test/buffer001/expected → test/buffer001/expected.outrenamed

The content is the same.

test/buffer001/run → test/buffer001/run.shrenamed

Only the mode changed.

test/buffer002/expected → test/buffer002/expected.outrenamed

The content is the same.

test/buffer002/run → test/buffer002/run.shrenamed

Only the mode changed.

test/contrib001/expected → test/contrib001/expected.outrenamed

The content is the same.

test/contrib001/run → test/contrib001/run.shrenamed

Only the mode changed.

test/corecords001/expected → test/corecords001/expected.outrenamed

The content is the same.

test/corecords001/run → test/corecords001/run.shrenamed

Only the mode changed.

test/corecords002/expected → test/corecords002/expected.outrenamed

The content is the same.

test/corecords002/run → test/corecords002/run.shrenamed

Only the mode changed.

test/delab001/expected → test/delab001/expected.outrenamed

The content is the same.

test/delab001/input → test/delab001/input.inrenamed

The content is the same.

test/delab001/run → test/delab001/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nocolor delab001.idr < input
2+${IDRIS:-idris} $@ --quiet --port none --nocolor delab001.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/directives001/expected → test/directives001/expected.outrenamed

The content is the same.

test/directives001/run → test/directives001/run.shrenamed

Only the mode changed.

test/directives002/expected → test/directives002/expected.outrenamed

The content is the same.

test/directives002/run → test/directives002/run.shrenamed

The content is the same.

test/directives003/expected → test/directives003/expected.outrenamed

The content is the same.

test/directives003/run → test/directives003/run.shrenamed

Only the mode changed.

test/disambig002/expected → test/disambig002/expected.outrenamed

The content is the same.

test/disambig002/run → test/disambig002/run.shrenamed

Only the mode changed.

test/docs001/expected → test/docs001/expected.outrenamed+1−1
@@ -8,7 +8,7 @@ Methods:
8 m : C t => t
8 m : C t => t
9 member of interface
9 member of interface
10
10
11− The function is Total
11+ The function is: Total & public export
12Implementations:
12Implementations:
13 C A
13 C A
14 implementation of interface
14 implementation of interface
test/docs001/input → test/docs001/input.inrenamed

The content is the same.

test/docs001/run → test/docs001/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nocolor docs001.idr < input
2+${IDRIS:-idris} $@ --quiet --port none --nocolor docs001.idr < input.in
3rm *.ibc
3rm *.ibc
test/docs002/expecteddeleted−12
@@ -1,12 +0,0 @@
1−T1 : Type
2− Some documentation
3−
4− The function is Total
5−T2 : Type
6− Some other documentation
7−
8− The function is Total
9−T3 : Int
10− Some provided postulate
11−
12− The function is not yet checked for totality
test/docs002/expected.outnew file+12
@@ -0,0 +1,12 @@
1+T1 : Type
2+ Some documentation
3+
4+ The function is: Total & public export
5+T2 : Type
6+ Some other documentation
7+
8+ The function is: Total & public export
9+T3 : Int
10+ Some provided postulate
11+
12+ The function is: not yet checked for totality & public export
test/docs002/input → test/docs002/input.inrenamed

The content is the same.

test/docs002/run → test/docs002/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --nobanner --nocolor --quiet --port none docs002.idr < input
2+${IDRIS:-idris} $@ --nobanner --nocolor --quiet --port none docs002.idr < input.in
3rm *.ibc
3rm *.ibc
test/docs003/expected → test/docs003/expected.outrenamed+3−1
@@ -8,7 +8,7 @@ Methods:
8 map : Functor f => (func : a -> b) -> f a -> f b
8 map : Functor f => (func : a -> b) -> f a -> f b
9 Apply a function across everything of type 'a' in a parameterised type
9 Apply a function across everything of type 'a' in a parameterised type
10
10
11− The function is Total
11+ The function is: Total & public export
12Implementations:
12Implementations:
13 Functor (Pair a)
13 Functor (Pair a)
14 Functor List
14 Functor List
@@ -33,7 +33,9 @@ Named implementation:
33 docs003.mine : Functor List
33 docs003.mine : Functor List
34
34
35
35
36+ The function is: public export
36Named implementation:
37Named implementation:
37 docs003.another : Functor List
38 docs003.another : Functor List
38 More functors!
39 More functors!
39
40
41+ The function is: public export
test/docs003/input → test/docs003/input.inrenamed

The content is the same.

test/docs003/run → test/docs003/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nocolor docs003.idr < input
2+${IDRIS:-idris} $@ --quiet --port none --nocolor docs003.idr < input.in
3rm *.ibc
3rm *.ibc
test/docs004/expected → test/docs004/expected.outrenamed+3−3
@@ -7,12 +7,12 @@ Main.MkFoo : (bar : Nat) -> (baz : Bool) -> Foo a
7
7
8 baz : Bool -- A field baz
8 baz : Bool -- A field baz
9
9
10− The function is Total
10+ The function is: Total & public export
11Main.Foo.bar : (rec : Foo a) -> Nat
11Main.Foo.bar : (rec : Foo a) -> Nat
12 A field bar
12 A field bar
13
13
14− The function is Total
14+ The function is: Total & public export
15Main.Foo.baz : (rec : Foo a) -> Bool
15Main.Foo.baz : (rec : Foo a) -> Bool
16 A field baz
16 A field baz
17
17
18− The function is Total
18+ The function is: Total & public export
test/docs004/input → test/docs004/input.inrenamed

The content is the same.

test/docs004/run → test/docs004/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nocolor docs004.idr < input
2+${IDRIS:-idris} $@ --quiet --port none --nocolor docs004.idr < input.in
3rm *.ibc
3rm *.ibc
test/docs005/expected → test/docs005/expected.outrenamed+3−1
@@ -1,6 +1,7 @@
1Data type docs005.Foobar : Type
1Data type docs005.Foobar : Type
2 A foobar with an auto implicit
2 A foobar with an auto implicit
3
3
4+ The function is: public export
4Constructors:
5Constructors:
5 NewFoo : (xs : List String) ->
6 NewFoo : (xs : List String) ->
6 (ys : List Nat) -> {auto prf : NonEmpty ys} -> Foobar
7 (ys : List Nat) -> {auto prf : NonEmpty ys} -> Foobar
@@ -14,6 +15,7 @@ Constructors:
14
15
15 (auto implicit) prf : NonEmpty ys -- The prf
16 (auto implicit) prf : NonEmpty ys -- The prf
16
17
18+ The function is: public export
17docs005.NewFoo : (xs : List String) ->
19docs005.NewFoo : (xs : List String) ->
18 (ys : List Nat) -> {auto prf : NonEmpty ys} -> Foobar
20 (ys : List Nat) -> {auto prf : NonEmpty ys} -> Foobar
19 New Foo
21 New Foo
@@ -26,4 +28,4 @@ docs005.NewFoo : (xs : List String) ->
26
28
27 (auto implicit) prf : NonEmpty ys -- The prf
29 (auto implicit) prf : NonEmpty ys -- The prf
28
30
29− The function is Total
31+ The function is: Total & public export
test/docs005/input → test/docs005/input.inrenamed

The content is the same.

test/docs005/run → test/docs005/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nocolor docs005.idr < input
2+${IDRIS:-idris} $@ --quiet --port none --nocolor docs005.idr < input.in
3rm *.ibc
3rm *.ibc
test/docs006/expected → test/docs006/expected.outrenamed+1−1
@@ -11,6 +11,6 @@ Methods:
11 m : Foo t => t
11 m : Foo t => t
12 member of interface
12 member of interface
13
13
14− The function is Total
14+ The function is: Total & public export
15Implementations:
15Implementations:
16 <no implementations>
16 <no implementations>
test/docs006/input → test/docs006/input.inrenamed

The content is the same.

test/docs006/run → test/docs006/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nocolor docs006.idr < input
2+${IDRIS:-idris} $@ --quiet --port none --nocolor docs006.idr < input.in
3rm *.ibc
3rm *.ibc
test/dsl001/expected → test/dsl001/expected.outrenamed

The content is the same.

test/dsl001/input → test/dsl001/input.inrenamed

The content is the same.

test/dsl001/run → test/dsl001/run.shrenamed+1−1
@@ -1,5 +1,5 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2${IDRIS:-idris} $@ test001.idr -o test001 --partial-eval
2${IDRIS:-idris} $@ test001.idr -o test001 --partial-eval
3./test001
3./test001
4−${IDRIS:-idris} $@ test001.idr --partial-eval --quiet --port none < input
4+${IDRIS:-idris} $@ test001.idr --partial-eval --quiet --port none < input.in
5rm -f test001 test001.ibc
5rm -f test001 test001.ibc
test/dsl002/expected → test/dsl002/expected.outrenamed

The content is the same.

test/dsl002/run → test/dsl002/run.shrenamed

Only the mode changed.

test/dsl002/test → test/dsl002/test.inrenamed

The content is the same.

test/dsl002/test014.idr+1−1
@@ -64,6 +64,6 @@ readH fn = res (do let x = open fn Reading
64 else rputStrLn "Error")
64 else rputStrLn "Error")
65
65
66main : IO ()
66main : IO ()
67−main = run (readH "test")
67+main = run (readH "test.in")
68
68
69
69
test/dsl003/expected → test/dsl003/expected.outrenamed

The content is the same.

test/dsl003/run → test/dsl003/run.shrenamed

Only the mode changed.

test/dsl004/expected → test/dsl004/expected.outrenamed

The content is the same.

test/dsl004/run → test/dsl004/run.shrenamed

Only the mode changed.

test/effects001/expected → test/effects001/expected.outrenamed

The content is the same.

test/effects001/run → test/effects001/run.shrenamed

Only the mode changed.

test/effects001/test021.idr+1−1
@@ -31,7 +31,7 @@ readFileCount = readAcc []
31
31
32testFile : TestFileIO () ()
32testFile : TestFileIO () ()
33testFile = do
33testFile = do
34− Success <- open "testFile" Read
34+ Success <- open "testFile.in" Read
35 | (FError err) => do
35 | (FError err) => do
36 putStrLn "Error!"
36 putStrLn "Error!"
37 pure ()
37 pure ()
test/effects001/testFile → test/effects001/testFile.inrenamed

The content is the same.

test/effects002/expected → test/effects002/expected.outrenamed

The content is the same.

test/effects002/run → test/effects002/run.shrenamed

Only the mode changed.

test/effects003/expected → test/effects003/expected.outrenamed

The content is the same.

test/effects003/input → test/effects003/input.inrenamed

The content is the same.

test/effects003/run → test/effects003/run.shrenamed+1−1
@@ -1,4 +1,4 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2${IDRIS:-idris} $@ hangman.idr --nocolour -p effects -o hangman
2${IDRIS:-idris} $@ hangman.idr --nocolour -p effects -o hangman
3−./hangman < input
3+./hangman < input.in
4rm -f hangman *.ibc
4rm -f hangman *.ibc
test/effects004/expected → test/effects004/expected.outrenamed

The content is the same.

test/effects004/input → test/effects004/input.inrenamed

The content is the same.

test/effects004/run → test/effects004/run.shrenamed+1−1
@@ -1,4 +1,4 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2${IDRIS:-idris} $@ effects004.idr -o effects004 -p effects
2${IDRIS:-idris} $@ effects004.idr -o effects004 -p effects
3−./effects004 < input
3+./effects004 < input.in
4rm -f effects004 *.ibc
4rm -f effects004 *.ibc
test/effects005/expected → test/effects005/expected.outrenamed

The content is the same.

test/effects005/run → test/effects005/run.shrenamed

Only the mode changed.

test/error001/expected → test/error001/expected.outrenamed

The content is the same.

test/error001/run → test/error001/run.shrenamed

Only the mode changed.

test/error002/expected → test/error002/expected.outrenamed

The content is the same.

test/error002/run → test/error002/run.shrenamed

Only the mode changed.

test/error003/expected → test/error003/expected.outrenamed

The content is the same.

test/error003/run → test/error003/run.shrenamed

Only the mode changed.

test/error004/expected → test/error004/expected.outrenamed

The content is the same.

test/error004/run → test/error004/run.shrenamed

Only the mode changed.

test/error005/expected → test/error005/expected.outrenamed

The content is the same.

test/error005/run → test/error005/run.shrenamed

Only the mode changed.

test/error006/expected → test/error006/expected.outrenamed

The content is the same.

test/error006/run → test/error006/run.shrenamed

Only the mode changed.

test/error007/expected → test/error007/expected.outrenamed

The content is the same.

test/error007/run → test/error007/run.shrenamed

Only the mode changed.

test/error008/expected → test/error008/expected.outrenamed

The content is the same.

test/error008/run → test/error008/run.shrenamed

Only the mode changed.

test/error009/expected → test/error009/expected.outrenamed

The content is the same.

test/error009/run → test/error009/run.shrenamed

Only the mode changed.

test/ffi001/expected → test/ffi001/expected.outrenamed

The content is the same.

test/ffi001/run → test/ffi001/run.shrenamed

Only the mode changed.

test/ffi002/expected → test/ffi002/expected.outrenamed

The content is the same.

test/ffi002/run → test/ffi002/run.shrenamed

Only the mode changed.

test/ffi003/expected → test/ffi003/expected.outrenamed

The content is the same.

test/ffi003/input → test/ffi003/input.inrenamed

The content is the same.

test/ffi003/run → test/ffi003/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nocolour test024.idr --exec main < input
2+${IDRIS:-idris} $@ --quiet --port none --nocolour test024.idr --exec main < input.in
3rm -f *.ibc
3rm -f *.ibc
test/ffi004/expected → test/ffi004/expected.outrenamed

The content is the same.

test/ffi004/run → test/ffi004/run.shrenamed

Only the mode changed.

test/ffi005/expected → test/ffi005/expected.outrenamed

The content is the same.

test/ffi005/run → test/ffi005/run.shrenamed

Only the mode changed.

test/ffi006/expected → test/ffi006/expected.outrenamed

The content is the same.

test/ffi006/run → test/ffi006/run.shrenamed

Only the mode changed.

test/ffi007/expected → test/ffi007/expected.outrenamed

The content is the same.

test/ffi007/run → test/ffi007/run.shrenamed

The content is the same.

test/ffi008/expected → test/ffi008/expected.outrenamed

The content is the same.

test/ffi008/run → test/ffi008/run.shrenamed

The content is the same.

test/ffi009/expected → test/ffi009/expected.outrenamed

The content is the same.

test/ffi009/run → test/ffi009/run.shrenamed

Only the mode changed.

test/ffi010/expected → test/ffi010/expected.outrenamed

The content is the same.

test/ffi010/run → test/ffi010/run.shrenamed

Only the mode changed.

test/ffi011/expected → test/ffi011/expected.outrenamed

The content is the same.

test/ffi011/ffi011 → test/ffi011/ffi011.jsrenamed

The content is the same.

test/ffi011/run → test/ffi011/run.shrenamed+1−1
@@ -1,4 +1,4 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2${IDRIS:-idris} $@ ffi011.idr --interface -o lib.js
2${IDRIS:-idris} $@ ffi011.idr --interface -o lib.js
3−node ./ffi011
3+node ./ffi011.js
4rm -f *.ibc lib.js
4rm -f *.ibc lib.js
test/ffi012/expected → test/ffi012/expected.outrenamed

The content is the same.

test/ffi012/ffi012 → test/ffi012/ffi012.jsrenamed

The content is the same.

test/ffi012/run → test/ffi012/run.shrenamed

Only the mode changed.

test/ffi013/expected.outnew file+4
@@ -0,0 +1,4 @@
1+success
2+confirmed
3+success
4+confirmed
test/ffi013/ffi013.idrnew file+5
@@ -0,0 +1,5 @@
1+module Main
2+
3+main : IO ()
4+main = do b <- fRemove "remove.me"
5+ putStrLn $ if b then "success" else "failure"
test/ffi013/run.shnew file+17
@@ -0,0 +1,17 @@
1+#!/usr/bin/env bash
2+echo "test" > remove.me
3+${IDRIS:-idris} $@ --quiet --port none ffi013.idr -o ffi013
4+./ffi013
5+if [ -f "remove.me" ]; then
6+ echo "still exists"
7+else
8+ echo "confirmed"
9+fi
10+echo "test2" > remove.me
11+${IDRIS:-idris} $@ --quiet --port none --nocolour ffi013.idr --exec main
12+if [ -f "remove.me" ]; then
13+ echo "still exists"
14+else
15+ echo "confirmed"
16+fi
17+rm -f ffi013 remove.me *.ibc
test/folding001/expected → test/folding001/expected.outrenamed

The content is the same.

test/folding001/run → test/folding001/run.shrenamed

Only the mode changed.

test/idrisdoc001/expected → test/idrisdoc001/expected.outrenamed

The content is the same.

test/idrisdoc001/run → test/idrisdoc001/run.shrenamed

Only the mode changed.

test/idrisdoc002/expected → test/idrisdoc002/expected.outrenamed

The content is the same.

test/idrisdoc002/run → test/idrisdoc002/run.shrenamed

Only the mode changed.

test/idrisdoc003/expected → test/idrisdoc003/expected.outrenamed

The content is the same.

test/idrisdoc003/run → test/idrisdoc003/run.shrenamed

Only the mode changed.

test/idrisdoc004/expected → test/idrisdoc004/expected.outrenamed

The content is the same.

test/idrisdoc004/run → test/idrisdoc004/run.shrenamed

Only the mode changed.

test/idrisdoc005/expected → test/idrisdoc005/expected.outrenamed

The content is the same.

test/idrisdoc005/run → test/idrisdoc005/run.shrenamed

Only the mode changed.

test/idrisdoc006/expected → test/idrisdoc006/expected.outrenamed

The content is the same.

test/idrisdoc006/run → test/idrisdoc006/run.shrenamed

Only the mode changed.

test/idrisdoc007/expected → test/idrisdoc007/expected.outrenamed

The content is the same.

test/idrisdoc007/run → test/idrisdoc007/run.shrenamed

Only the mode changed.

test/idrisdoc008/expected → test/idrisdoc008/expected.outrenamed

The content is the same.

test/idrisdoc008/run → test/idrisdoc008/run.shrenamed

Only the mode changed.

test/idrisdoc009/expected → test/idrisdoc009/expected.outrenamed+2
@@ -1,10 +1,12 @@
1Data type Test.Test : Type
1Data type Test.Test : Type
2 Docs for datatype Test.
2 Docs for datatype Test.
3
3
4+ The function is: public export
4Constructors:
5Constructors:
5 MkTest : Test
6 MkTest : Test
6
7
7
8
9+ The function is: public export
8Module Test:
10Module Test:
9 Docs for module Test.
11 Docs for module Test.
10
12
test/idrisdoc009/input → test/idrisdoc009/input.inrenamed

The content is the same.

test/idrisdoc009/run → test/idrisdoc009/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --nocolour --quiet --port none Test.idr < input
2+${IDRIS:-idris} $@ --nocolour --quiet --port none Test.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interactive001/expected → test/interactive001/expected.outrenamed

The content is the same.

test/interactive001/input → test/interactive001/input.inrenamed

The content is the same.

test/interactive001/run → test/interactive001/run.shrenamed+1−1
@@ -1,5 +1,5 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3−${IDRIS:-idris} $@ --quiet --port none --indent-with 8 interactive001.idr < input
3+${IDRIS:-idris} $@ --quiet --port none --indent-with 8 interactive001.idr < input.in
4
4
5rm -f *.ibc
5rm -f *.ibc
test/interactive002/expected → test/interactive002/expected.outrenamed

The content is the same.

test/interactive002/input → test/interactive002/input.inrenamed

The content is the same.

test/interactive002/run → test/interactive002/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none interactive002.idr < input
2+${IDRIS:-idris} $@ --quiet --port none interactive002.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interactive003/expected → test/interactive003/expected.outrenamed

The content is the same.

test/interactive003/input → test/interactive003/input.inrenamed

The content is the same.

test/interactive003/run → test/interactive003/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none interactive003.idr < input
2+${IDRIS:-idris} $@ --quiet --port none interactive003.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interactive004/expected → test/interactive004/expected.outrenamed

The content is the same.

test/interactive004/input → test/interactive004/input.inrenamed

The content is the same.

test/interactive004/run → test/interactive004/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none interactive004.idr < input
2+${IDRIS:-idris} $@ --quiet --port none interactive004.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interactive005/expected → test/interactive005/expected.outrenamed+3−3
@@ -3,7 +3,7 @@ Hello, World
3Main.main : IO ()
3Main.main : IO ()
4 This is a docstring
4 This is a docstring
5
5
6− The function is Total
6+ The function is: Total & public export
7Main.main is Total
7Main.main is Total
8Hello, World
8Hello, World
9id : a -> a
9id : a -> a
@@ -27,10 +27,10 @@ Main.main : IO ()
27 is a
27 is a
28 docstring
28 docstring
29
29
30− The function is Total
30+ The function is: Total & public export
31Main.main : IO ()
31Main.main : IO ()
32 This is a docstring
32 This is a docstring
33
33
34− The function is Total
34+ The function is: Total & public export
35Nat2 : Type
35Nat2 : Type
36Invalid filename for compiler output "Test.idr"
36Invalid filename for compiler output "Test.idr"
test/interactive005/input → test/interactive005/input.inrenamed

The content is the same.

test/interactive005/run → test/interactive005/run.shrenamed+1−1
@@ -1,5 +1,5 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --nocolour --quiet --port none interactive005.idr --consolewidth 70 < input
2+${IDRIS:-idris} $@ --nocolour --quiet --port none interactive005.idr --consolewidth 70 < input.in
3rm -f *.ibc
3rm -f *.ibc
4rm -f hello.bytecode
4rm -f hello.bytecode
5rm -f hello
5rm -f hello
test/interactive006/expected → test/interactive006/expected.outrenamed

The content is the same.

test/interactive006/input → test/interactive006/input.inrenamed

The content is the same.

test/interactive006/run → test/interactive006/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --port 5000 interactive006.idr < input
2+${IDRIS:-idris} $@ --quiet --port none --port 5000 interactive006.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interactive007/expected → test/interactive007/expected.outrenamed

The content is the same.

test/interactive007/input → test/interactive007/input.inrenamed

The content is the same.

test/interactive007/run → test/interactive007/run.shrenamed+1−1
@@ -1,2 +1,2 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ -p contrib --nobanner --nocolor --port none < input | perl -pe 's-Data\\Z-Data/Z-g'
2+${IDRIS:-idris} $@ -p contrib --nobanner --nocolor --port none < input.in | perl -pe 's-Data\\Z-Data/Z-g'
test/interactive008/expected → test/interactive008/expected.outrenamed

The content is the same.

test/interactive008/input → test/interactive008/input.inrenamed

The content is the same.

test/interactive008/rundeleted−2
@@ -1,2 +0,0 @@
1−#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --nobanner --nocolor --port none < input
test/interactive008/run.shnew file+2
@@ -0,0 +1,2 @@
1+#!/usr/bin/env bash
2+${IDRIS:-idris} $@ --nobanner --nocolor --port none < input.in
test/interactive009/expected → test/interactive009/expected.outrenamed

The content is the same.

test/interactive009/input → test/interactive009/input.inrenamed

The content is the same.

test/interactive009/run → test/interactive009/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none interactive009.idr < input
2+${IDRIS:-idris} $@ --quiet --port none interactive009.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interactive010/expected → test/interactive010/expected.outrenamed

The content is the same.

test/interactive010/input → test/interactive010/input.inrenamed

The content is the same.

test/interactive010/run → test/interactive010/run.shrenamed+1−1
@@ -1,2 +1,2 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nobanner --nocolor < input
2+${IDRIS:-idris} $@ --quiet --port none --nobanner --nocolor < input.in
test/interactive011/expected → test/interactive011/expected.outrenamed

The content is the same.

test/interactive011/input → test/interactive011/input.inrenamed

The content is the same.

test/interactive011/run → test/interactive011/run.shrenamed+1−1
@@ -1,6 +1,6 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3cd src
3cd src
4−${IDRIS:-idris} "$@" --quiet --port none --indent-clause 4 Main.idr <../input
4+${IDRIS:-idris} "$@" --quiet --port none --indent-clause 4 Main.idr <../input.in
5
5
6rm -f *.ibc
6rm -f *.ibc
test/interactive012/expected → test/interactive012/expected.outrenamed

The content is the same.

test/interactive012/input → test/interactive012/input.inrenamed

The content is the same.

test/interactive012/run → test/interactive012/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --nocolour --consolewidth 70 --quiet --port none interactive012.idr < input
2+${IDRIS:-idris} $@ --nocolour --consolewidth 70 --quiet --port none interactive012.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interactive013/expected → test/interactive013/expected.outrenamed

The content is the same.

test/interactive013/input → test/interactive013/input.inrenamed

The content is the same.

test/interactive013/run → test/interactive013/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none interactive013.idr < input
2+${IDRIS:-idris} $@ --quiet --port none interactive013.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interactive014/expected → test/interactive014/expected.outrenamed

The content is the same.

test/interactive014/input → test/interactive014/input.inrenamed

The content is the same.

test/interactive014/run → test/interactive014/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none interactive014.idr < input
2+${IDRIS:-idris} $@ --quiet --port none interactive014.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interactive015/expected → test/interactive015/expected.outrenamed

The content is the same.

test/interactive015/input → test/interactive015/input.inrenamed

The content is the same.

test/interactive015/run → test/interactive015/run.shrenamed+1−1
@@ -1,7 +1,7 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3cp src/interactive015.idr .
3cp src/interactive015.idr .
4−${IDRIS:-idris} "$@" --quiet --port none interactive015.idr < input
4+${IDRIS:-idris} "$@" --quiet --port none interactive015.idr < input.in
5
5
6cat interactive015.idr
6cat interactive015.idr
7
7
test/interactive016/expected → test/interactive016/expected.outrenamed

The content is the same.

test/interactive016/input → test/interactive016/input.inrenamed

The content is the same.

test/interactive016/run → test/interactive016/run.shrenamed+1−1
@@ -1,7 +1,7 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3cp src/interactive016.idr .
3cp src/interactive016.idr .
4−${IDRIS:-idris} "$@" --quiet --port none interactive016.idr < input
4+${IDRIS:-idris} "$@" --quiet --port none interactive016.idr < input.in
5
5
6cat interactive016.idr
6cat interactive016.idr
7
7
test/interactive017/expected → test/interactive017/expected.outrenamed

The content is the same.

test/interactive017/run → test/interactive017/run.shrenamed

Only the mode changed.

test/interactive018/expected → test/interactive018/expected.outrenamed

The content is the same.

test/interactive018/input → test/interactive018/input.inrenamed

The content is the same.

test/interactive018/rundeleted−3
@@ -1,3 +0,0 @@
1−#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none Top.idr < input
3−rm -f *.ibc
test/interactive018/run.shnew file+3
@@ -0,0 +1,3 @@
1+#!/usr/bin/env bash
2+${IDRIS:-idris} $@ --quiet --port none Top.idr < input.in
3+rm -f *.ibc
test/interfaces001/expected → test/interfaces001/expected.outrenamed+3−2
@@ -8,7 +8,7 @@ Methods:
8 myShow : MyShow a => (x : a) -> String
8 myShow : MyShow a => (x : a) -> String
9 The shower
9 The shower
10
10
11− The function is Total
11+ The function is: Total & public export
12Implementation constructor:
12Implementation constructor:
13 MkMyShow : (myShow : a -> String) -> MyShow a
13 MkMyShow : (myShow : a -> String) -> MyShow a
14 Build a MyShow
14 Build a MyShow
@@ -17,6 +17,7 @@ Implementation constructor:
17
17
18 myShow : a -> String -- The shower
18 myShow : a -> String -- The shower
19
19
20+ The function is: public export
20Implementations:
21Implementations:
21 MyShow Integer
22 MyShow Integer
22MkMyShow : (myShow : a -> String) -> MyShow a
23MkMyShow : (myShow : a -> String) -> MyShow a
@@ -26,4 +27,4 @@ MkMyShow : (myShow : a -> String) -> MyShow a
26
27
27 myShow : a -> String -- The shower
28 myShow : a -> String -- The shower
28
29
29− The function is Total
30+ The function is: Total & public export
test/interfaces001/input → test/interfaces001/input.inrenamed

The content is the same.

test/interfaces001/run → test/interfaces001/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nocolour --consolewidth 70 InterfaceName.idr < input
2+${IDRIS:-idris} $@ --quiet --port none --nocolour --consolewidth 70 InterfaceName.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interfaces002/expected → test/interfaces002/expected.outrenamed

The content is the same.

test/interfaces002/run → test/interfaces002/run.shrenamed

Only the mode changed.

test/interfaces003/expected → test/interfaces003/expected.outrenamed

The content is the same.

test/interfaces003/run → test/interfaces003/run.shrenamed

Only the mode changed.

test/interfaces004/expected → test/interfaces004/expected.outrenamed

The content is the same.

test/interfaces004/run → test/interfaces004/run.shrenamed

Only the mode changed.

test/interfaces005/expected → test/interfaces005/expected.outrenamed

The content is the same.

test/interfaces005/run → test/interfaces005/run.shrenamed

Only the mode changed.

test/interfaces006/expected → test/interfaces006/expected.outrenamed

The content is the same.

test/interfaces006/run → test/interfaces006/run.shrenamed

Only the mode changed.

test/interfaces007/expected → test/interfaces007/expected.outrenamed

The content is the same.

test/interfaces007/run → test/interfaces007/run.shrenamed

Only the mode changed.

test/interfaces008/expected → test/interfaces008/expected.outrenamed

The content is the same.

test/interfaces008/run → test/interfaces008/run.shrenamed

Only the mode changed.

test/interfaces009/expected → test/interfaces009/expected.outrenamed

The content is the same.

test/interfaces009/run → test/interfaces009/run.shrenamed

Only the mode changed.

test/interfaces010/expected → test/interfaces010/expected.outrenamed

The content is the same.

test/interfaces010/run → test/interfaces010/run.shrenamed

Only the mode changed.

test/interpret001/expected → test/interpret001/expected.outrenamed

The content is the same.

test/interpret001/input → test/interpret001/input.inrenamed

The content is the same.

test/interpret001/run → test/interpret001/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nocolour double-echo.idr < input
2+${IDRIS:-idris} $@ --quiet --port none --nocolour double-echo.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interpret002/expected → test/interpret002/expected.outrenamed

The content is the same.

test/interpret002/input → test/interpret002/input.inrenamed

The content is the same.

test/interpret002/run → test/interpret002/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nocolour file-error.idr < input
2+${IDRIS:-idris} $@ --quiet --port none --nocolour file-error.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/interpret003/expected → test/interpret003/expected.outrenamed

The content is the same.

test/interpret003/input → test/interpret003/input.inrenamed

The content is the same.

test/interpret003/run → test/interpret003/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none --nocolour interpret003.idr < input
2+${IDRIS:-idris} $@ --quiet --port none --nocolour interpret003.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/io001/expected → test/io001/expected.outrenamed

The content is the same.

test/io001/run → test/io001/run.shrenamed

Only the mode changed.

test/io002/expected → test/io002/expected.outrenamed

The content is the same.

test/io002/run → test/io002/run.shrenamed

Only the mode changed.

test/io003/expected → test/io003/expected.outrenamed

The content is the same.

test/io003/run → test/io003/run.shrenamed

Only the mode changed.

test/layout001/expected → test/layout001/expected.outrenamed

The content is the same.

test/layout001/run → test/layout001/run.shrenamed

Only the mode changed.

test/literate001/expected → test/literate001/expected.outrenamed

The content is the same.

test/literate001/run → test/literate001/run.shrenamed

Only the mode changed.

test/meta001/expected → test/meta001/expected.outrenamed

The content is the same.

test/meta001/run → test/meta001/run.shrenamed

Only the mode changed.

test/meta002/expected → test/meta002/expected.outrenamed

The content is the same.

test/meta002/run → test/meta002/run.shrenamed

Only the mode changed.

test/meta003/expected → test/meta003/expected.outrenamed

The content is the same.

test/meta003/run → test/meta003/run.shrenamed

Only the mode changed.

test/meta004/expected → test/meta004/expected.outrenamed

The content is the same.

test/meta004/run → test/meta004/run.shrenamed

Only the mode changed.

test/pkg001/expected → test/pkg001/expected.outrenamed

The content is the same.

test/pkg001/run → test/pkg001/run.shrenamed

Only the mode changed.

test/pkg001/test-pkg.ipkg+3−3
@@ -12,6 +12,6 @@ license = BSD3 but see LICENSE for more information
12brief = "This is a test package."
12brief = "This is a test package."
13readme = README.md
13readme = README.md
14version = 1234
14version = 1234
15−homepage = http://www.idris-lang.org
15+homepage = https://www.idris-lang.org
16−sourceloc = http://ww.github.com/idris-lang/Idris-Dev
16+sourceloc = https://www.github.com/idris-lang/Idris-Dev
17−bugtracker = http://ww.github.com/idris-lang/Idris-Dev/issues
17+bugtracker = https://www.github.com/idris-lang/Idris-Dev/issues
test/pkg002/expected → test/pkg002/expected.outrenamed

The content is the same.

test/pkg002/run → test/pkg002/run.shrenamed

Only the mode changed.

test/pkg003/expected → test/pkg003/expected.outrenamed

The content is the same.

test/pkg003/run → test/pkg003/run.shrenamed

Only the mode changed.

test/pkg004/expected → test/pkg004/expected.outrenamed

The content is the same.

test/pkg004/run → test/pkg004/run.shrenamed

Only the mode changed.

test/pkg005/expected → test/pkg005/expected.outrenamed

The content is the same.

test/pkg005/run → test/pkg005/run.shrenamed

Only the mode changed.

test/pkg006/expected → test/pkg006/expected.outrenamed

The content is the same.

test/pkg006/run → test/pkg006/run.shrenamed

Only the mode changed.

test/pkg007/expected → test/pkg007/expected.outrenamed

The content is the same.

test/pkg007/input → test/pkg007/input.inrenamed

The content is the same.

test/pkg007/run → test/pkg007/run.shrenamed+1−1
@@ -2,6 +2,6 @@
2cd toy
2cd toy
3${IDRIS:-idris} $@ --build toy.ipkg --ibcsubdir ../ibcout
3${IDRIS:-idris} $@ --build toy.ipkg --ibcsubdir ../ibcout
4cd ../ibcout
4cd ../ibcout
5−${IDRIS:-idris} $@ --quiet < ../input
5+${IDRIS:-idris} $@ --quiet < ../input.in
6cd ..
6cd ..
7rm -rf ibcout
7rm -rf ibcout
test/pkg008/expected → test/pkg008/expected.outrenamed

The content is the same.

test/pkg008/run → test/pkg008/run.shrenamed

Only the mode changed.

test/pkg009/expected → test/pkg009/expected.outrenamed

The content is the same.

test/pkg009/run → test/pkg009/run.shrenamed

Only the mode changed.

test/pkg010/expecteddeleted−31
@@ -1,31 +0,0 @@
1−Uncaught error: user error (wrongopts.ipkg:4:1:
2− |
3−4 | <empty line>
4− | ^
5−Invalid option `-total'
6−
7−Usage: ([--nobanner] | [-q|--quiet] | [--ide-mode] | [--ide-mode-socket] |
8− [--client ARG] | [--log LEVEL] | [--logging-categories CATS] |
9− [--nobasepkgs] | [--noprelude] | [--nobuiltins] | [--check] |
10− [-o|--output FILE] | [--interface] | [--typeintype] | [--total] |
11− [--partial] | [--warnpartial] | [--warnreach] | [--warnipkg] |
12− [--nocoverage] | [--errorcontext] | [--info] | [--listlogcats] |
13− [--link] | [--listlibs] | [--libdir] | [--docdir] | [--include] | [--V2]
14− | [--V1] | [-V|--V0|--verbose] | [--ibcsubdir FILE] |
15− [-i|--idrispath ARG] | [--sourcepath ARG] | [--warn] |
16− [-p|--package ARG] | [--port PORT] | [--build IPKG] | [--install IPKG] |
17− [--repl IPKG] | [--clean IPKG] | [--mkdoc IPKG] | [--installdoc IPKG] |
18− [--checkpkg IPKG] | [--testpkg IPKG] | [--indent-with INDENT] |
19− [--indent-clause INDENT] | [--bytecode ARG] | [-S|--codegenonly] |
20− [-c|--compileonly] | [--dumpdefuns ARG] | [--dumpcases ARG] |
21− [--codegen TARGET] | [--portable-codegen TARGET] | [--cg-opt ARG] |
22− [-e|--eval EXPR] | [--execute] | [--exec EXPR] | [-X|--extension EXT] |
23− [--O3] | [--O2] | [--O1] | [--O0] | [--partial-eval] |
24− [--no-partial-eval] |
25− [--optimise-nat-like-types|--optimize-nat-like-types] |
26− [--no-optimise-nat-like-types|--no-optimize-nat-like-types] |
27− [-O|--level ARG] | [--target TRIPLE] | [--cpu CPU] | [--color|--colour]
28− | [--nocolor|--nocolour] | [--consolewidth WIDTH] | [--highlight] |
29− [--no-tactic-deprecation-warnings] |
30− [--allow-capitalized-pattern-variables]) [FILES] [-v|--version]
31−)
test/pkg010/expected.outnew file+29
@@ -0,0 +1,29 @@
1+Uncaught error: user error (wrongopts.ipkg:4:1:
2+ |
3+4 | <empty line>
4+ | ^
5+Invalid option `-total'
6+
7+Usage: [--nobanner | (-q|--quiet) | --ide-mode | --ide-mode-socket |
8+ --client ARG | --log LEVEL | --logging-categories CATS |
9+ --nobasepkgs | --noprelude | --nobuiltins | --check |
10+ (-o|--output FILE) | --interface | --typeintype | --total |
11+ --partial | --warnpartial | --warnreach | --warnipkg | --nocoverage |
12+ --errorcontext | --info | --listlogcats | --link | --listlibs |
13+ --libdir | --docdir | --include | --V2 | --V1 | (-V|--V0|--verbose) |
14+ --ibcsubdir FILE | (-i|--idrispath ARG) | --sourcepath ARG | --warn |
15+ (-p|--package ARG) | --port PORT | --build IPKG | --install IPKG |
16+ --repl IPKG | --clean IPKG | --mkdoc IPKG | --installdoc IPKG |
17+ --checkpkg IPKG | --testpkg IPKG | --indent-with INDENT |
18+ --indent-clause INDENT | --bytecode ARG | (-S|--codegenonly) |
19+ (-c|--compileonly) | --dumpdefuns ARG | --dumpcases ARG |
20+ --codegen TARGET | --portable-codegen TARGET | --cg-opt ARG |
21+ (-e|--eval EXPR) | --execute | --exec EXPR | (-X|--extension EXT) |
22+ --O3 | --O2 | --O1 | --O0 | --partial-eval | --no-partial-eval |
23+ (--optimise-nat-like-types|--optimize-nat-like-types) |
24+ (--no-optimise-nat-like-types|--no-optimize-nat-like-types) |
25+ (-O|--level ARG) | --target TRIPLE | --cpu CPU | (--color|--colour) |
26+ (--nocolor|--nocolour) | --consolewidth WIDTH | --highlight |
27+ --no-tactic-deprecation-warnings |
28+ --allow-capitalized-pattern-variables] [FILES] [-v|--version]
29+)
test/pkg010/run → test/pkg010/run.shrenamed

Only the mode changed.

test/prelude001/expected → test/prelude001/expected.outrenamed

The content is the same.

test/prelude001/run → test/prelude001/run.shrenamed

Only the mode changed.

test/primitives001/expected → test/primitives001/expected.outrenamed

The content is the same.

test/primitives001/input → test/primitives001/input.inrenamed

The content is the same.

test/primitives001/run → test/primitives001/run.shrenamed+1−1
@@ -2,5 +2,5 @@
2${IDRIS:-idris} $@ test005.idr -o test005
2${IDRIS:-idris} $@ test005.idr -o test005
3./test005
3./test005
4${IDRIS:-idris} $@ substring.idr -o substring
4${IDRIS:-idris} $@ substring.idr -o substring
5−./substring < input
5+./substring < input.in
6rm -f test005 substring *.ibc
6rm -f test005 substring *.ibc
test/primitives002/expected → test/primitives002/expected.outrenamed

The content is the same.

test/primitives002/run → test/primitives002/run.shrenamed

Only the mode changed.

test/primitives003/expected → test/primitives003/expected.outrenamed

The content is the same.

test/primitives003/run → test/primitives003/run.shrenamed

Only the mode changed.

test/primitives004-disabled/expected → test/primitives004-disabled/expected.outrenamed

The content is the same.

test/primitives004-disabled/run → test/primitives004-disabled/run.shrenamed

Only the mode changed.

test/primitives005/expected → test/primitives005/expected.outrenamed

The content is the same.

test/primitives005/run → test/primitives005/run.shrenamed

The content is the same.

test/primitives006/expected → test/primitives006/expected.outrenamed

The content is the same.

test/primitives006/run → test/primitives006/run.shrenamed

Only the mode changed.

test/proof001/expected → test/proof001/expected.outrenamed

The content is the same.

test/proof001/run → test/proof001/run.shrenamed

Only the mode changed.

test/proof002/expected → test/proof002/expected.outrenamed

The content is the same.

test/proof002/run → test/proof002/run.shrenamed

Only the mode changed.

test/proof003/expected → test/proof003/expected.outrenamed

The content is the same.

test/proof003/run → test/proof003/run.shrenamed

Only the mode changed.

test/proof004/expected → test/proof004/expected.outrenamed

The content is the same.

test/proof004/run → test/proof004/run.shrenamed

Only the mode changed.

test/proof005/expected → test/proof005/expected.outrenamed

The content is the same.

test/proof005/run → test/proof005/run.shrenamed

Only the mode changed.

test/proof006/expected → test/proof006/expected.outrenamed

The content is the same.

test/proof006/run → test/proof006/run.shrenamed

Only the mode changed.

test/proof007/expected → test/proof007/expected.outrenamed

The content is the same.

test/proof007/run → test/proof007/run.shrenamed

Only the mode changed.

test/proof008/expected → test/proof008/expected.outrenamed

The content is the same.

test/proof008/run → test/proof008/run.shrenamed

Only the mode changed.

test/proof009/expected → test/proof009/expected.outrenamed

The content is the same.

test/proof009/input → test/proof009/input.inrenamed

The content is the same.

test/proof009/run → test/proof009/run.shrenamed+1−1
@@ -1,3 +1,3 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --consolewidth 70 --quiet --port none proof009.idr < input
2+${IDRIS:-idris} $@ --consolewidth 70 --quiet --port none proof009.idr < input.in
3rm -f *.ibc
3rm -f *.ibc
test/proof010/expected → test/proof010/expected.outrenamed

The content is the same.

test/proof010/run → test/proof010/run.shrenamed

Only the mode changed.

test/proof011/expected → test/proof011/expected.outrenamed

The content is the same.

test/proof011/run → test/proof011/run.shrenamed

Only the mode changed.

test/proofsearch001/expected → test/proofsearch001/expected.outrenamed

The content is the same.

test/proofsearch001/run → test/proofsearch001/run.shrenamed

Only the mode changed.

test/proofsearch002/expected → test/proofsearch002/expected.outrenamed

The content is the same.

test/proofsearch002/run → test/proofsearch002/run.shrenamed

Only the mode changed.

test/proofsearch003/expected → test/proofsearch003/expected.outrenamed

The content is the same.

test/proofsearch003/run → test/proofsearch003/run.shrenamed

Only the mode changed.

test/pruviloj001/expected → test/pruviloj001/expected.outrenamed

The content is the same.

test/pruviloj001/run → test/pruviloj001/run.shrenamed

Only the mode changed.

test/quasiquote001/expected → test/quasiquote001/expected.outrenamed

The content is the same.

test/quasiquote001/run → test/quasiquote001/run.shrenamed

Only the mode changed.

test/quasiquote002/expected → test/quasiquote002/expected.outrenamed

The content is the same.

test/quasiquote002/run → test/quasiquote002/run.shrenamed

Only the mode changed.

test/quasiquote003/expected → test/quasiquote003/expected.outrenamed

The content is the same.

test/quasiquote003/run → test/quasiquote003/run.shrenamed

Only the mode changed.

test/quasiquote004/expected → test/quasiquote004/expected.outrenamed

The content is the same.

test/quasiquote004/run → test/quasiquote004/run.shrenamed

Only the mode changed.

test/quasiquote005/expected → test/quasiquote005/expected.outrenamed

The content is the same.

test/quasiquote005/run → test/quasiquote005/run.shrenamed

Only the mode changed.

test/quasiquote006/expected → test/quasiquote006/expected.outrenamed

The content is the same.

test/quasiquote006/run → test/quasiquote006/run.shrenamed

Only the mode changed.

test/records001/expected → test/records001/expected.outrenamed

The content is the same.

test/records001/run → test/records001/run.shrenamed

Only the mode changed.

test/records002/expected → test/records002/expected.outrenamed

The content is the same.

test/records002/run → test/records002/run.shrenamed

Only the mode changed.

test/records003/expected → test/records003/expected.outrenamed

The content is the same.

test/records003/run → test/records003/run.shrenamed

Only the mode changed.

test/records004/expected → test/records004/expected.outrenamed

The content is the same.

test/records004/run → test/records004/run.shrenamed

Only the mode changed.

test/records005/expected → test/records005/expected.outrenamed

The content is the same.

test/records005/run → test/records005/run.shrenamed

Only the mode changed.

test/reg001/expected → test/reg001/expected.outrenamed

The content is the same.

test/reg001/run → test/reg001/run.shrenamed

Only the mode changed.

test/reg002/expected → test/reg002/expected.outrenamed

The content is the same.

test/reg002/run → test/reg002/run.shrenamed

Only the mode changed.

test/reg004/expected → test/reg004/expected.outrenamed

The content is the same.

test/reg004/run → test/reg004/run.shrenamed

Only the mode changed.

test/reg005/expected → test/reg005/expected.outrenamed

The content is the same.

test/reg005/run → test/reg005/run.shrenamed

Only the mode changed.

test/reg007/expected → test/reg007/expected.outrenamed

The content is the same.

test/reg007/run → test/reg007/run.shrenamed

Only the mode changed.

test/reg013/expected → test/reg013/expected.outrenamed

The content is the same.

test/reg013/run → test/reg013/run.shrenamed

Only the mode changed.

test/reg016/expected → test/reg016/expected.outrenamed

The content is the same.

test/reg016/run → test/reg016/run.shrenamed

Only the mode changed.

test/reg017/expected → test/reg017/expected.outrenamed

The content is the same.

test/reg017/run → test/reg017/run.shrenamed

Only the mode changed.

test/reg020/expected → test/reg020/expected.outrenamed

The content is the same.

test/reg020/run → test/reg020/run.shrenamed

Only the mode changed.

test/reg024/expected → test/reg024/expected.outrenamed

The content is the same.

test/reg024/run → test/reg024/run.shrenamed

Only the mode changed.

test/reg025/expected → test/reg025/expected.outrenamed

The content is the same.

test/reg025/run → test/reg025/run.shrenamed

Only the mode changed.

test/reg027/expected → test/reg027/expected.outrenamed

The content is the same.

test/reg027/run → test/reg027/run.shrenamed

Only the mode changed.

test/reg029/expected → test/reg029/expected.outrenamed

The content is the same.

test/reg029/run → test/reg029/run.shrenamed

Only the mode changed.

test/reg031/expected → test/reg031/expected.outrenamed

The content is the same.

test/reg031/run → test/reg031/run.shrenamed

Only the mode changed.

test/reg032/expected → test/reg032/expected.outrenamed

The content is the same.

test/reg032/run → test/reg032/run.shrenamed

Only the mode changed.

test/reg039/expected → test/reg039/expected.outrenamed

The content is the same.

test/reg039/run → test/reg039/run.shrenamed

Only the mode changed.

test/reg040/expected → test/reg040/expected.outrenamed

The content is the same.

test/reg040/run → test/reg040/run.shrenamed

Only the mode changed.

test/reg041/expected → test/reg041/expected.outrenamed

The content is the same.

test/reg041/run → test/reg041/run.shrenamed

Only the mode changed.

test/reg042/expected → test/reg042/expected.outrenamed

The content is the same.

test/reg042/run → test/reg042/run.shrenamed

Only the mode changed.

test/reg045/expected → test/reg045/expected.outrenamed

The content is the same.

test/reg045/run → test/reg045/run.shrenamed

Only the mode changed.

test/reg048/expected → test/reg048/expected.outrenamed

The content is the same.

test/reg048/run → test/reg048/run.shrenamed

Only the mode changed.

test/reg051-disabled/expected → test/reg051-disabled/expected.outrenamed

The content is the same.

test/reg051-disabled/run → test/reg051-disabled/run.shrenamed

Only the mode changed.

test/reg052/expected → test/reg052/expected.outrenamed

The content is the same.

test/reg052/run → test/reg052/run.shrenamed

Only the mode changed.

test/reg067/expected → test/reg067/expected.outrenamed

The content is the same.

test/reg067/run → test/reg067/run.shrenamed

Only the mode changed.

test/reg075/expected → test/reg075/expected.outrenamed

The content is the same.

test/reg075/input → test/reg075/input.inrenamed

The content is the same.

test/reg075/rundeleted−3
@@ -1,3 +0,0 @@
1−#!/usr/bin/env bash
2−${IDRIS:-idris} $@ --quiet --port none reg075.idr < input
3−rm -f *.ibc
test/reg075/run.shnew file+3
@@ -0,0 +1,3 @@
1+#!/usr/bin/env bash
2+${IDRIS:-idris} $@ --quiet --port none reg075.idr < input.in
3+rm -f *.ibc
test/reg076/expected → test/reg076/expected.outrenamed

The content is the same.

test/reg076/input → test/reg076/input.inrenamed

The content is the same.

test/reg076/run → test/reg076/run.shrenamed

Only the mode changed.

test/reg077/expected → test/reg077/expected.outrenamed

The content is the same.

test/reg077/run → test/reg077/run.shrenamed

Only the mode changed.

test/regression001/expected → test/regression001/expected.outrenamed

The content is the same.

test/regression001/run → test/regression001/run.shrenamed

Only the mode changed.

test/regression002/expected → test/regression002/expected.outrenamed

The content is the same.

test/regression002/run → test/regression002/run.shrenamed

Only the mode changed.

test/regression003/expected → test/regression003/expected.outrenamed

The content is the same.

test/regression003/run → test/regression003/run.shrenamed

Only the mode changed.

test/sourceLocation001/expected → test/sourceLocation001/expected.outrenamed

The content is the same.

test/sourceLocation001/run → test/sourceLocation001/run.shrenamed

Only the mode changed.

test/st001/expected → test/st001/expected.outrenamed

The content is the same.

test/st001/run → test/st001/run.shrenamed

Only the mode changed.

test/st001/test001.idr+1−1
@@ -40,7 +40,7 @@ readFileCount fh cnt =
40
40
41testFile : (ConsoleIO m, File m) => ST m () []
41testFile : (ConsoleIO m, File m) => ST m () []
42testFile = with ST do
42testFile = with ST do
43− Right fileHandle <- open "testFile" Read
43+ Right fileHandle <- open "testFile.in" Read
44 | Left ferr => do putStrLn (show ferr)
44 | Left ferr => do putStrLn (show ferr)
45 pure ()
45 pure ()
46 count <- new 0
46 count <- new 0
test/st001/testFile → test/st001/testFile.inrenamed

The content is the same.

test/st002/expected → test/st002/expected.outrenamed

The content is the same.

test/st002/run → test/st002/run.shrenamed

Only the mode changed.

test/st002/test002.idr+1−1
@@ -40,7 +40,7 @@ readFileCount fh cnt =
40
40
41testFile : (ConsoleIO m, File m) => ST m () []
41testFile : (ConsoleIO m, File m) => ST m () []
42testFile = with ST do
42testFile = with ST do
43− Right fileHandle <- open "testFile" Read
43+ Right fileHandle <- open "testFile.in" Read
44 | Left ferr => do putStrLn (show ferr)
44 | Left ferr => do putStrLn (show ferr)
45 pure ()
45 pure ()
46 count <- new 0
46 count <- new 0
test/st002/testFile → test/st002/testFile.inrenamed

The content is the same.

test/st003/expected → test/st003/expected.outrenamed

The content is the same.

test/st003/run → test/st003/run.shrenamed

Only the mode changed.

test/st003/test003.idr+1−1
@@ -7,7 +7,7 @@ import Control.ST.ImplicitCall
7
7
8testFile : (ConsoleIO m, File m) => ST m () []
8testFile : (ConsoleIO m, File m) => ST m () []
9testFile = with ST do
9testFile = with ST do
10− Right str <- readFile "testFile"
10+ Right str <- readFile "testFile.in"
11 | Left ferr => do putStrLn (show ferr)
11 | Left ferr => do putStrLn (show ferr)
12 pure ()
12 pure ()
13 putStrLn str
13 putStrLn str
test/st003/testFile → test/st003/testFile.inrenamed

The content is the same.

test/st004/expected → test/st004/expected.outrenamed

The content is the same.

test/st004/run → test/st004/run.shrenamed

Only the mode changed.

test/st005/expected → test/st005/expected.outrenamed

The content is the same.

test/st005/run → test/st005/run.shrenamed

Only the mode changed.

test/st006/expected → test/st006/expected.outrenamed

The content is the same.

test/st006/run → test/st006/run.shrenamed

Only the mode changed.

test/st007/expected → test/st007/expected.outrenamed

The content is the same.

test/st007/run → test/st007/run.shrenamed

Only the mode changed.

test/sugar001/expected → test/sugar001/expected.outrenamed

The content is the same.

test/sugar001/run → test/sugar001/run.shrenamed

Only the mode changed.

test/sugar002/expected → test/sugar002/expected.outrenamed

The content is the same.

test/sugar002/run → test/sugar002/run.shrenamed

Only the mode changed.

test/sugar003/expected → test/sugar003/expected.outrenamed

The content is the same.

test/sugar003/run → test/sugar003/run.shrenamed

Only the mode changed.

test/sugar004/expected → test/sugar004/expected.outrenamed

The content is the same.

test/sugar004/run → test/sugar004/run.shrenamed

Only the mode changed.

test/sugar005/expected → test/sugar005/expected.outrenamed

The content is the same.

test/sugar005/run → test/sugar005/run.shrenamed

Only the mode changed.

test/syntax001/expected → test/syntax001/expected.outrenamed

The content is the same.

test/syntax001/run → test/syntax001/run.shrenamed

Only the mode changed.

test/syntax002/expected → test/syntax002/expected.outrenamed

The content is the same.

test/syntax002/run → test/syntax002/run.shrenamed

Only the mode changed.

test/tactics001/expected → test/tactics001/expected.outrenamed

The content is the same.

test/tactics001/run → test/tactics001/run.shrenamed

Only the mode changed.

test/totality001/expected → test/totality001/expected.outrenamed

The content is the same.

test/totality001/run → test/totality001/run.shrenamed

Only the mode changed.

test/totality002/expected → test/totality002/expected.outrenamed

The content is the same.

test/totality002/run → test/totality002/run.shrenamed

Only the mode changed.

test/totality003/expected → test/totality003/expected.outrenamed

The content is the same.

test/totality003/run → test/totality003/run.shrenamed

Only the mode changed.

test/totality004/expected → test/totality004/expected.outrenamed

The content is the same.

test/totality004/run → test/totality004/run.shrenamed

Only the mode changed.

test/totality005/expected → test/totality005/expected.outrenamed

The content is the same.

test/totality005/run → test/totality005/run.shrenamed

Only the mode changed.

test/totality006/expected → test/totality006/expected.outrenamed

The content is the same.

test/totality006/run → test/totality006/run.shrenamed

Only the mode changed.

test/totality007/expected → test/totality007/expected.outrenamed

The content is the same.

test/totality007/run → test/totality007/run.shrenamed

Only the mode changed.

test/totality008/expected → test/totality008/expected.outrenamed

The content is the same.

test/totality008/run → test/totality008/run.shrenamed

Only the mode changed.

test/totality009/expected → test/totality009/expected.outrenamed

The content is the same.

test/totality009/run → test/totality009/run.shrenamed

Only the mode changed.

test/totality010/expected → test/totality010/expected.outrenamed

The content is the same.

test/totality010/run → test/totality010/run.shrenamed

Only the mode changed.

test/totality011/expected → test/totality011/expected.outrenamed

The content is the same.

test/totality011/run → test/totality011/run.shrenamed

Only the mode changed.

test/totality012/expected → test/totality012/expected.outrenamed

The content is the same.

test/totality012/run → test/totality012/run.shrenamed

Only the mode changed.

test/totality013/expected → test/totality013/expected.outrenamed

The content is the same.

test/totality013/run → test/totality013/run.shrenamed

Only the mode changed.

test/totality014/expected → test/totality014/expected.outrenamed

The content is the same.

test/totality014/run → test/totality014/run.shrenamed

Only the mode changed.

test/totality015/expected → test/totality015/expected.outrenamed

The content is the same.

test/totality015/run → test/totality015/run.shrenamed

Only the mode changed.

test/totality016/expected → test/totality016/expected.outrenamed

The content is the same.

test/totality016/run → test/totality016/run.shrenamed

Only the mode changed.

test/totality017/expected → test/totality017/expected.outrenamed

The content is the same.

test/totality017/run → test/totality017/run.shrenamed

Only the mode changed.

test/totality018/expected → test/totality018/expected.outrenamed

The content is the same.

test/totality018/run → test/totality018/run.shrenamed

Only the mode changed.

test/totality019/expected → test/totality019/expected.outrenamed

The content is the same.

test/totality019/run → test/totality019/run.shrenamed

Only the mode changed.

test/totality020/expected → test/totality020/expected.outrenamed

The content is the same.

test/totality020/run → test/totality020/run.shrenamed

Only the mode changed.

test/totality021/expected → test/totality021/expected.outrenamed

The content is the same.

test/totality021/run → test/totality021/run.shrenamed

Only the mode changed.

test/totality022/expected → test/totality022/expected.outrenamed

The content is the same.

test/totality022/run → test/totality022/run.shrenamed

Only the mode changed.

test/totality023/expected → test/totality023/expected.outrenamed

The content is the same.

test/totality023/run → test/totality023/run.shrenamed

Only the mode changed.

test/totality024/expected → test/totality024/expected.outrenamed

The content is the same.

test/totality024/run → test/totality024/run.shrenamed

Only the mode changed.

test/totality025/expected → test/totality025/expected.outrenamed

The content is the same.

test/totality025/run → test/totality025/run.shrenamed

Only the mode changed.

test/totality026/expected → test/totality026/expected.outrenamed

The content is the same.

test/totality026/run → test/totality026/run.shrenamed

Only the mode changed.

test/tutorial001/expected → test/tutorial001/expected.outrenamed

The content is the same.

test/tutorial001/run → test/tutorial001/run.shrenamed

Only the mode changed.

test/tutorial002/expected → test/tutorial002/expected.outrenamed

The content is the same.

test/tutorial002/run → test/tutorial002/run.shrenamed

Only the mode changed.

test/tutorial003/expected → test/tutorial003/expected.outrenamed

The content is the same.

test/tutorial003/run → test/tutorial003/run.shrenamed

Only the mode changed.

test/tutorial004/expected → test/tutorial004/expected.outrenamed

The content is the same.

test/tutorial004/run → test/tutorial004/run.shrenamed

Only the mode changed.

test/tutorial005/expected → test/tutorial005/expected.outrenamed

The content is the same.

test/tutorial005/run → test/tutorial005/run.shrenamed

Only the mode changed.

test/tutorial006/expected → test/tutorial006/expected.outrenamed

The content is the same.

test/tutorial006/run → test/tutorial006/run.shrenamed

Only the mode changed.

test/tutorial007/expected → test/tutorial007/expected.outrenamed

The content is the same.

test/tutorial007/run → test/tutorial007/run.shrenamed

Only the mode changed.

test/unique001/expected → test/unique001/expected.outrenamed

The content is the same.

test/unique001/run → test/unique001/run.shrenamed

Only the mode changed.

test/unique004/expected → test/unique004/expected.outrenamed

The content is the same.

test/unique004/run → test/unique004/run.shrenamed

Only the mode changed.

test/universes001/expected → test/universes001/expected.outrenamed

The content is the same.

test/universes001/run → test/universes001/run.shrenamed

Only the mode changed.

test/universes002/expected → test/universes002/expected.outrenamed

The content is the same.

test/universes002/run → test/universes002/run.shrenamed

Only the mode changed.

test/views001/expected → test/views001/expected.outrenamed

The content is the same.

test/views001/run → test/views001/run.shrenamed

Only the mode changed.

test/views002/expected → test/views002/expected.outrenamed

The content is the same.

test/views002/run → test/views002/run.shrenamed

Only the mode changed.

test/views003/expected → test/views003/expected.outrenamed

The content is the same.

test/views003/run → test/views003/run.shrenamed

Only the mode changed.