Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some sketches of Fathom’s core in Idris 2 #391

Draft
wants to merge 47 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
5bc6398
Add some sketches of Fathom’s core in Idris 2
brendanzab Aug 24, 2022
02bace9
Experiment with custom IR universes
brendanzab Aug 25, 2022
315acb1
Spelling fixes
brendanzab Aug 25, 2022
6d0dc18
Begin reproducing Opentype difficulties
brendanzab Aug 25, 2022
6be0640
Add rlwrap to devShell
brendanzab Aug 25, 2022
711c66a
Adjust multiplicities on singleton types
brendanzab Aug 25, 2022
6487cea
Switch to using records for singletons
brendanzab Aug 25, 2022
9f0cd55
Move refinement and singleton types into modules
brendanzab Aug 25, 2022
6511e44
Add some more notes about the Idris sketch
brendanzab Aug 30, 2022
01a2852
Add name hints for streams
brendanzab Aug 30, 2022
93055a4
Implement a simpler singleton type
brendanzab Aug 30, 2022
505f286
Simplify the encoder type
brendanzab Aug 30, 2022
6e8660a
Add support for do notation
brendanzab Aug 30, 2022
53d50c6
Make Decode type match Source more closely
brendanzab Aug 30, 2022
7289176
Try a different FormatOf representation
brendanzab Aug 30, 2022
9e15d99
Add more type aliases for encoder/decoder pairs
brendanzab Aug 31, 2022
e0c52d7
Add more encoding targets
brendanzab Aug 31, 2022
305a0ce
Various cleanups
brendanzab Aug 31, 2022
0d5fa66
Experiment with bit and word definitions
brendanzab Aug 31, 2022
41832aa
Add some more formats
brendanzab Aug 31, 2022
9bf5144
Try out the opentype issue with indexed types
brendanzab Aug 31, 2022
7299eaa
More work on styles of format description
brendanzab Aug 31, 2022
6ea96ed
Define isomorphisms between Formats and FormatOfs
brendanzab Sep 1, 2022
b5b4439
Get OpenType examples to work for all approaches
brendanzab Sep 1, 2022
ed44595
Use the Subset type from the Idris base library
brendanzab Sep 1, 2022
11d58fc
Add constructors for building non-indexed formats
brendanzab Sep 1, 2022
ef54092
Begin constructors for wrapper index formats
brendanzab Sep 1, 2022
098bbf7
Try to construct OpenType things using wrappers
brendanzab Sep 1, 2022
e961d7f
Move experiments into a different module
brendanzab Sep 1, 2022
acabfc1
Make better use of namespaces
brendanzab Sep 2, 2022
152fb8a
Forwar encode/decode functions via wrapper formats
brendanzab Sep 2, 2022
aaa95c9
Clean up some state passing with do notation
brendanzab Sep 2, 2022
8f5a720
Rename ‘skip’ formats to ‘ignore’
brendanzab Sep 2, 2022
457f25f
Move typeOf function
brendanzab Sep 9, 2022
e129a83
Ponder compilation a bit
brendanzab Sep 8, 2022
4e01ddc
Encode/decode cleanups
brendanzab Sep 9, 2022
8c0dc84
Add field syntax for inductive-recursive reps
brendanzab Sep 9, 2022
0d01ee2
Move format descriptions under single path
brendanzab Sep 9, 2022
0f475d3
Add pair formats
brendanzab Sep 9, 2022
d11c5d4
Enable applicative notation for decoders
brendanzab Sep 3, 2022
a082638
Add u32 formats
brendanzab Sep 12, 2022
1599762
Play around with heterogeneous sequences
brendanzab Sep 12, 2022
1c37a1c
Create a hetrogeneous repetition format with HVect
brendanzab Sep 12, 2022
9fbf359
Rename to `hrepeat` to `tuple`
brendanzab Sep 12, 2022
348f7fd
Move compiler experiments
brendanzab Sep 12, 2022
1cc1602
Implement tuple in other format decription styles
brendanzab Sep 12, 2022
bac5789
Choice formats
brendanzab Sep 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
uses: cachix/install-nix-action@v17

- name: cargo check
run: nix develop .#${{ matrix.rust-toolchain }} --command cargo check
run: nix develop .#rust-${{ matrix.rust-toolchain }} --command cargo check
- name: cargo build
run: nix develop .#${{ matrix.rust-toolchain }} --command cargo build
run: nix develop .#rust-${{ matrix.rust-toolchain }} --command cargo build
- name: cargo test
run: nix develop .#${{ matrix.rust-toolchain }} --command cargo test
run: nix develop .#rust-${{ matrix.rust-toolchain }} --command cargo test

cargo-fmt:
runs-on: ubuntu-latest
Expand All @@ -42,7 +42,7 @@ jobs:
uses: cachix/install-nix-action@v17

- name: Run cargo fmt
run: nix develop .#${{ matrix.rust-toolchain }} --command cargo fmt
run: nix develop .#rust-${{ matrix.rust-toolchain }} --command cargo fmt

cargo-clippy:
runs-on: ubuntu-latest
Expand All @@ -62,7 +62,7 @@ jobs:
run: rm --recursive --force --verbose ~/.cargo/bin

- name: Run cargo clippy
run: nix develop .#${{ matrix.rust-toolchain }} --command cargo clippy -- --deny warnings
run: nix develop .#rust-${{ matrix.rust-toolchain }} --command cargo clippy -- --deny warnings

nixpkgs-fmt:
runs-on: ubuntu-latest
Expand All @@ -74,4 +74,4 @@ jobs:
uses: cachix/install-nix-action@v17

- name: Run nixpkgs-fmt
run: nix develop --command nixpkgs-fmt --check .
run: nix develop .#nix --command nixpkgs-fmt --check .
1 change: 1 addition & 0 deletions experiments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ In rough chronological order:
5. [rust-prototype-v2](./rust-prototype-v2) (@brendanzab)
6. [makam-spec](./makam-spec) (@brendanzab)
7. [rust-prototype-v3](./rust-prototype-v3) (@brendanzab)
8. [idris](./idris) (@brendanzab)

The following repositories also provided us with valuable experience along the way:

Expand Down
1 change: 1 addition & 0 deletions experiments/idris/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
27 changes: 27 additions & 0 deletions experiments/idris/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Core language experiments in Idris 2

Some sketches of Fathom’s core language using Idris as a logical framework.

> **Note:**
>
> Idris 2 does not yet support cumulatively or full totality checking, so the
> definitions here may depend on inconsistency. We also don’t aim to prove any
> properties of these definitions, this is more intended for experimentation.

## Development setup

Depends on the following:

- [Idris 2](https://github.com/idris-lang/Idris2/blob/main/INSTALL.md)
- [rlwrap](https://github.com/hanslub42/rlwrap) (optional - as a workaround for
[idris-lang/Idris2#54](https://github.com/idris-lang/Idris2/issues/54))

If you use NixPkgs the above is installed as part of the default development
shell in the [flake.nix](../../flake.nix) provided.

## Usage

```command
$ rlwrap idris2 --repl experiments/idris/fathom.ipkg
Main> :load "src/Playground.idr"
```
62 changes: 62 additions & 0 deletions experiments/idris/fathom.ipkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package fathom
-- version =
-- authors =
-- maintainers =
-- license =
-- brief =
-- readme =
-- homepage =
-- sourceloc =
-- bugtracker =

-- packages to add to search path
depends = contrib

-- modules to install
modules = Fathom

, Fathom.Base
, Fathom.Data.Bit
, Fathom.Data.Iso
, Fathom.Data.Sing
, Fathom.Data.Word
, Fathom.Format.IndexedInductive
, Fathom.Format.IndexedInductiveCustom
, Fathom.Format.InductiveRecursive
, Fathom.Format.InductiveRecursiveCustom
, Fathom.Format.Record

, Playground
, Playground.Extraction
, Playground.HeterogeneousSequences
, Playground.OpenType.IndexedInductive
, Playground.OpenType.InductiveRecursive
, Playground.OpenType.Record

-- main file (i.e. file to load at REPL)
-- main =

-- name of executable
-- executable =
-- opts =
sourcedir = "src"
builddir = "build"
outputdir = "build/exec"

-- script to run before building
-- prebuild =

-- script to run after building
-- postbuild =

-- script to run after building, before installing
-- preinstall =

-- script to run after installing
-- postinstall =

-- script to run before cleaning
-- preclean =

-- script to run after cleaning
-- postclean =
7 changes: 7 additions & 0 deletions experiments/idris/src/Fathom.idr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
||| A sketch of core Fathom in Idris 2

import public Fathom.Base
import public Fathom.Format.IndexedInductive
import public Fathom.Format.InductiveRecursive
import public Fathom.Format.InductiveRecursiveCustom
import public Fathom.Format.Record
Loading