Skip to content

Commit

Permalink
v0.1.2 (#37)
Browse files Browse the repository at this point in the history
* v0.1.1 (#15)

* add references to the syntax and cleanup code

* [make] add .PHONY to Makefile targets

* [parser] add parser / pretty for axiom backends

* Pairing progress

* [scoper] Add support for Axiom backends

* [parser] Fix foreign block parsing

* [ app ] adds --no-colors flag for the scope command

* [ghc] upgrade to ghc 9.2.2

* use GHC2021

* [doc] Remove out-of-date comment

* [test] Add ambiguity tests

* [scoper] Improve resolution of local symbols

* [error] WIP improving ambiguity error messages

* [ clean-up ] new lab folder for experimentation

* [ app ] ixes the lint warning

* [ Termination ] removes Alga dependency

* [error] Add message for ambiguous symbol error

* [error] Add ambiguous module message

* [scoper] Remove ErrGeneric

* [test] Add test to suite

* [test] show diff when ast's are different

* [ lab ] folder organization

* [ Makefile ] add targets with --watch option (stack cmds) and remove unused things

* [ app ] add --version flag and fixed warnings and formatting

* [test] remove fromRightIO to fix ambiguity error

* [test] Add test of shadowing public open

* [scoper] Add visibility annotation for Name

* prepare buildIntoTable

* [ Concrete ] add instance of hashable for refs.

* add InfoTableBuilder effect

* [ scoper ] add InfoTableBuilder effect

* [ CHANGELOG ] updated v0.1.1

* [ README ] org version now

Co-authored-by: Jan Mas Rovira <[email protected]>
Co-authored-by: Paul Cadman <[email protected]>

* [ package.yaml ] update version

* fix package.yaml

* fix readme

* [microjuvix] implement basic typechecker

* add simple test for MicroJuvix type checker

* fix checking for constructors apps in patterns

* [scope] Move InfoTable to a new module

* [abstract] Make Iden use references instead of Name

* [abstract] Add InfoTable for abstract syntax

* [scoper] Add function clauses to scoped InfoTable

* [abstract] Add InfoTableBuilder for scoped to abstract

* [main] Fix callsites of translateModule

* [doc] Remove empty docs

* [scoper] Update emptyInfoTable with missing field

* rename some functions

* [minihaskell] add compilation to MiniHaskell

* [microjuvix] improve wrong type message

* Add a validity predicate example written in MiniJuvix

* [typecheck] Add error infrastructure for type errors

Add a pretty error for mismatched constructor type in a pattern match

* [test] Adds negative typecheck test for constructor

* [app] Adds microjuvix subcommands for printing / typechecking

* [typecheck] Add error message for ctor match args mistmatch

* [typecheck] Add descriptive messages for remainng errors

* [typecheck] Updates to error message copy

* [typecheck] fix merge conflicts:

* [highlight] add basic support for highlighting symbols

* [minijuvix-mode] add minijuvix-mode and basic description in the readme

* [readme] improve formatting

* automatically detect the root of the project and add --show-root flag

* Adds many new features (w.i.p v0.1.2) (#28)

* add references to the syntax and cleanup code

* [make] add .PHONY to Makefile targets

* [parser] add parser / pretty for axiom backends

* Pairing progress

* [scoper] Add support for Axiom backends

* [parser] Fix foreign block parsing

* [ app ] adds --no-colors flag for the scope command

* [ghc] upgrade to ghc 9.2.2

* use GHC2021

* [doc] Remove out-of-date comment

* [test] Add ambiguity tests

* [scoper] Improve resolution of local symbols

* [error] WIP improving ambiguity error messages

* [ clean-up ] new lab folder for experimentation

* [ app ] ixes the lint warning

* [ Termination ] removes Alga dependency

* [error] Add message for ambiguous symbol error

* [error] Add ambiguous module message

* [scoper] Remove ErrGeneric

* [test] Add test to suite

* [test] show diff when ast's are different

* [ lab ] folder organization

* [ Makefile ] add targets with --watch option (stack cmds) and remove unused things

* [ app ] add --version flag and fixed warnings and formatting

* [test] remove fromRightIO to fix ambiguity error

* [test] Add test of shadowing public open

* [scoper] Add visibility annotation for Name

* prepare buildIntoTable

* [ Concrete ] add instance of hashable for refs.

* add InfoTableBuilder effect

* [ scoper ] add InfoTableBuilder effect

* [ CHANGELOG ] updated v0.1.1

* [ README ] org version now

* fix package.yaml

* fix readme

* [microjuvix] implement basic typechecker

* add simple test for MicroJuvix type checker

* fix checking for constructors apps in patterns

* [scope] Move InfoTable to a new module

* [abstract] Make Iden use references instead of Name

* [abstract] Add InfoTable for abstract syntax

* [scoper] Add function clauses to scoped InfoTable

* [abstract] Add InfoTableBuilder for scoped to abstract

* [main] Fix callsites of translateModule

* [doc] Remove empty docs

* [scoper] Update emptyInfoTable with missing field

* rename some functions

* [minihaskell] add compilation to MiniHaskell

* [microjuvix] improve wrong type message

* Add a validity predicate example written in MiniJuvix

* [typecheck] Add error infrastructure for type errors

Add a pretty error for mismatched constructor type in a pattern match

* [test] Adds negative typecheck test for constructor

* [app] Adds microjuvix subcommands for printing / typechecking

* [typecheck] Add error message for ctor match args mistmatch

* [typecheck] Add descriptive messages for remainng errors

* [typecheck] Updates to error message copy

* [typecheck] fix merge conflicts:

* [highlight] add basic support for highlighting symbols

* [minijuvix-mode] add minijuvix-mode and basic description in the readme

* [readme] improve formatting

* automatically detect the root of the project and add --show-root flag

Co-authored-by: Jan Mas Rovira <[email protected]>
Co-authored-by: Paul Cadman <[email protected]>
Co-authored-by: Paul Cadman <[email protected]>

* [ CI ] Add Haskell Github Action with Stack test and ormolu check

* [typecheck] Return all errors encountered during typechecking

Any expression that fails typechecking is assigned TypeAny so
typechecking can proceed.

* [typecheck] Wrap type errors in NonEmpty

* [typechecker] throw in expressions, collect in clauses

* [typecheck] Add the definition loc to microjuvix names

This is used in type errors

* [concrete] Adds location info to Literal

* [typecheck] Add function name to pattern type errors

* [typecheck] Add concrete name location to type error messages for expression

* [test] Add test for multiple type errors

Add test for literals

* [prelude] Remove Control.Monad from export

Control.Monad is already exported by Control.Monad.Extra

* [concrete] Add HasLoc for LiteralLoc

* [ pre-commit ] Add support and hooks

* [ hlint ] fix some hints

* [ CI ] Add hlint check

* [doc] Add docs for enabling CLI autocompletion (#31)

* Remove missused import

* setup InfoTable for parser

* define ParserResult and refactor

* [minijuvix-mode] save buffer and clear annotation before loading

* [ CI ] New jobs: ormolu and hlint

* Add action hints for autocompletion (#35)

* [ format ] AbstractToMicroJuvix

* [ CI ] fixes

* [ CI ] fixes

* [ CI ] Using GHC 9.0 for Hlint

* [ CI ] Use static-checks for Dev as well

* [app] Add action hints for autocompletion

Using `action "file"` means that the autocompletion for that part of the
command will prompt the user with a list of files.

Without these action hints the user would have to type out the whole
path to the file without autocompletion assistance.

Co-authored-by: Jonathan Prieto-Cubides <[email protected]>

* Restore correct handling of TypeAny and add positive typecheck tests (#34)

* [ format ] AbstractToMicroJuvix

* [ CI ] fixes

* [ CI ] fixes

* [ CI ] Using GHC 9.0 for Hlint

* [ CI ] Use static-checks for Dev as well

* [test] Add positive test for typechecker

* [test] Improve positive typechecker error output

* [typecheck] Restore correct handling of TypeAny

I mistakenly removed the matchTypes function in
anoma/minijuvix#22. This caused the handling
of TypeAny to break.

Literals have type TypeAny and so should be valid when matching against
any other type. The tests have been updated to reflect this.

* [test] Add positive MicroJuvix typecheck tests

* [ ormolu ] fixes

Co-authored-by: Jonathan Prieto-Cubides <[email protected]>

* wip

* add evil kbds

* fix

* Fix typo

* [emacs] Add load and goto def keybindings

* [emacs] Remove extra evil-define-key

* [emacs] Use 'evil hook instead of 'evil-maps

* [emacs] Add message if no goto information is found

* Better to use kbd

* wip

* w.i.p

* Fix compilation

* Make Ormolu happy and Hlint

* w.i.p Fixing test suite

* Fix test suite

* [minihaskell] Do not add id suffix to top-level modules and main

For minihaskell the name of the output file needs to match the module
name. So we must not add the usual '_<nameid>' suffix to top level
names.

Additionally the main function in a haskell file is the entry-point to
the haskell program. So the suffix must not be added in this case also.

* [minihaskell] Output ANSI codes only if handle supports it

This adds `ansi-terminal` dependency to the Main target but this is
already a transitive dependency of `prettyprinter-ansi-terminal`.

We want to add this support globally which we will do in https://github.com/heliaxdev/minijuvix/issues/38.

* [typecheck] Shortcircuit clause pattern check errors

In the following case:

```
module WrongConstructorArity;
  inductive T {
    A : T;
  };

  f : T → T;
  f (A i) ≔ i;
end;
```

The typechecker fails when checking the clause `f (A i) := i` because of
the extra constructor argument. However if typechecking continues then
the variable `i` on the rhs does not have a type so we must short-circuit.

* [ README ] Add badges and grammar

* w.i.p Add global option --no-color

* emacs mode: keep buffer saved after highlighting

* add generic pretty utilities

* w.i.p refactoring ansi/text pretty printer

* [test] Update VP example

* [test] Add Anoma Haskell backend for VP

* fix #29

* emacs mode: keep buffer saved after highlighting

* [test] Update VP example

* [test] Add Anoma Haskell backend for VP

* make my friends hlint and ormolu happy

* run ormolu 4

* remove undefined (#56)

* [emacs] Add copy of agda-input to minijuvix-mode (#57)

This provides agda-input method (under the name `minijuvix`) to
minijuvix-mode.

Co-authored-by: Jan Mas Rovira <[email protected]>
Co-authored-by: Paul Cadman <[email protected]>
Co-authored-by: Paul Cadman <[email protected]>
Co-authored-by: caryoscelus <[email protected]>
  • Loading branch information
5 people authored Apr 11, 2022
1 parent eee91cb commit f55112f
Show file tree
Hide file tree
Showing 175 changed files with 5,994 additions and 1,520 deletions.
204 changes: 94 additions & 110 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,125 +2,109 @@ name: MiniJuvix CI

on:
push:
branches: [ master , develop , qtt ]
branches: [ main , dev ]
pull_request:
branches: [ master ]
branches:
- main
- dev

jobs:
docs:
runs-on: macOS-latest

ormolu:
runs-on: ubuntu-latest
steps:
- name: Checkout the main repository
uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: mrkkrp/ormolu-action@v5
with:
path: main
extra-args: >-
--ghc-opt -XDerivingStrategies
--ghc-opt -XImportQualifiedPost
--ghc-opt -XMultiParamTypeClasses
--ghc-opt -XStandaloneDeriving
--ghc-opt -XTemplateHaskell
--ghc-opt -XUnicodeSyntax
hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Set up HLint'
uses: rwe/actions-hlint-setup@v1
with:
version: '3.1.6'
- name: 'Run HLint'
uses: rwe/[email protected]
with:
path: '["src/", "app/", "test/"]'
fail-on: warning

build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest , macOS-latest ]
ghc: ["9.2.2"]
steps:
- uses: actions/cache@v3
name: Cache Stack
id: cache
env:
cache-name: cache-env
with:
path: |
~/.stack
main/.stack-work
main/.hie
key: ${{ runner.os }}-build-${{ matrix.ghc }}-${{ hashFiles('main/src/**/*.hs', 'main/app/**/*.hs', 'main/test/**/*.hs', 'main/package.yaml', 'main/stack.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ matrix.ghc }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: haskell/actions/setup@v1
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'

- uses: r-lib/actions/setup-pandoc@v1
- name: Checkout our repository
uses: actions/checkout@v2
with:
pandoc-version: '2.13'
- run: echo "# Test" | pandoc -t html
path: main

- name: Generate HTML
id: html
- name: Build Haskell Project
run: |
cd main
make docs
rm docs/README.md
make build
- name: Deploy HTML to github pages
if: steps.html.outputs.cache-hit != 'true'
uses: peaceiris/actions-gh-pages@v3
- name: Download MiniJuvix-stdlib
run: |
cd main
make minijuvix-stdlib
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macOS-latest , ubuntu-latest ]
ghc: ["9.2.2"]
steps:
- uses: actions/cache@v3
id: cache-build
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: main/docs
enable_jekyll: true

# build:
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ ubuntu-latest , macOS-latest ]
# ghc: ["8.10.7"]
# agda: ["2.6.2"]

# steps:
# - uses: actions/cache@v2
# name: Caching
# id: cache
# env:
# cache-name: cache-env
# with:
# path: |
# ~/.cabal
# dist-newstyle
# main/.hie
# main/dist-newstyle
# main/cabal-dev
# main/_build/
# main/.stack-work/
# agda/
# agda2hs/
# key: ${{ runner.os }}-build-${{ matrix.agda }}-${{ matrix.ghc }}-${{ hashFiles('main/src/**') }}
# restore-keys: |
# ${{ runner.os }}-build-${{ matrix.agda }}-${{ matrix.ghc }}-
# ${{ runner.os }}-build-${{ matrix.agda }}-
# ${{ runner.os }}-

# - uses: haskell/actions/setup@v1
# name: Setup Haskell
# with:
# ghc-version: ${{ matrix.ghc }}

# - name: Add .cabal/bin into PATH
# run:
# echo "$HOME/.cabal/bin" >> $GITHUB_PATH
# shell: bash

# - uses: actions/checkout@v2
# name: Checkout Agda repository
# if: steps.cache.outputs.cache-hit != 'true'
# with:
# repository: agda/agda
# path: agda
# ref: ${{ matrix.agda }}

# - name: Install Agda
# if: steps.cache.outputs.cache-hit != 'true'
# run: |
# cd agda
# touch doc/user-manual.pdf
# cabal install --overwrite-policy=always --ghc-options='-O2 +RTS -M6G -RTS' -foptimise-heavily
# shell: bash

# - uses: actions/checkout@v2
# name: Checkout Agda2HS repository
# if: steps.cache.outputs.cache-hit != 'true'
# with:
# repository: agda/agda2hs
# path: agda2hs
# ref: ${{ matrix.agda }}

# - name: Install Agda2HS
# if: steps.cache.outputs.cache-hit != 'true'
# run: |
# cd agda2hs
# make install

# - name: Checkout our repository
# uses: actions/checkout@v2
# with:
# path: main

# - name: Verify the Agda files in it
# if: steps.cache.outputs.cache-hit != 'true'
# id: check-agda
# run: |
# cd main
# make agda

# - name: Build the Haskell project
# run: cabal update
# make cabal

# - name: Run tests
# run: cabal test all
path: |
~/.stack
main/.stack-work/
main/.hie
key: ${{ runner.os }}-build-${{ matrix.ghc }}-
- name: Checkout the main repository
uses: actions/checkout@v2
with:
path: main
- name: Test suite
id: test
run: |
cd main
make test
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "minijuvix-stdlib"]
path = minijuvix-stdlib
url = git@github.com:heliaxdev/minijuvix-stdlib.git
url = https://github.com/heliaxdev/minijuvix-stdlib.git
42 changes: 30 additions & 12 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,41 @@

- extensions:
- default: false
- name: [DeriveFunctor, GeneralizedNewtypeDeriving, OverloadedStrings]
- name: [MultiWayIf, PatternGuards, RecordWildCards]
- name: [ScopedTypeVariables]
- name: [ConstraintKinds, RankNTypes, TypeFamilies]
# - {name: nameEXT, within: [moduleName]}
- name:
- ApplicativeDo
- DataKinds
- DerivingStrategies
- GADTs
- ImportQualifiedPost
- LambdaCase
- NoImplicitPrelude
- OverloadedStrings
- QuasiQuotes
- RecordWildCards
- StandaloneKindSignatures
- TemplateHaskell
- TypeFamilyDependencies
- UndecidableInstances
- UnicodeSyntax
- GeneralizedNewtypeDeriving

- flags:
- default: false
- {name: [-Wno-incomplete-patterns, -Wno-overlapping-patterns , Wno-partial-fields]}
- name:
- -Wall
- -Wcompat
- -Wderiving-defaults
- -Widentities
- -Wincomplete-patterns
- -Wincomplete-record-updates
- -Wincomplete-uni-patterns
- -Wmissing-deriving-strategies
- -Wredundant-constraints
- -O2 -flate-specialise -fspecialise-aggressively

- modules:
# if you import Data.Set qualified, it must be as 'Set'
- {name: [Data.Set, Data.HashSet], as: Set}
- {name: [Data.Set, Data.HashSet], as: Set}
- {name: [Data.Map, Data.HashMap.Strict, Data.HashMap.Lazy], as: Map}
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely

Expand Down Expand Up @@ -51,10 +73,6 @@
# IGNORES
# --------------------------------------------------------------------------------

- ignore: {within: [MiniJuvix.Syntax.Core, MiniJuvix.Syntax.Eval]}
- ignore: {within: [MiniJuvix.Monad]}
- ignore: {within: [MiniJuvix.Pretty]}
- ignore: {name: Use let, within: [Test.All]}
- ignore: {name: Use String}
- ignore: {name: Avoid restricted flags}
- ignore: {name: Avoid restricted extensions, within: [MiniJuvix.Parsing.Language]}
- ignore: {name: Avoid restricted qualification}
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# $ pip install pre-commit
# $ pre-commit install
# $ pre-commit run --all-files
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-case-conflict
- id: mixed-line-ending

- repo: https://github.com/heliaxdev/minijuvix
rev: a54abcd6a50518476ee75b329e245c3341d02341
hooks:
- id: ormolu
- id: hlint
11 changes: 11 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- id: hlint
name: hlint
description: Run Hlint linter
entry: make hlint
language: system

- id: ormolu
name: ormolu
description: Run Ormolu linter
entry: make check-format
language: system
29 changes: 24 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
PWD=$(CURDIR)
PREFIX="$(PWD)/.stack-work/prefix"
UNAME := $(shell uname)
HLINTQUIET :=


ifeq ($(UNAME), Darwin)
THREADS := $(shell sysctl -n hw.logicalcpu)
Expand All @@ -11,7 +13,7 @@ else
endif

all:
make prepare-push
make pre-commit

.PHONY : checklines
checklines :
Expand All @@ -26,7 +28,7 @@ checklines :

.PHONY : hlint
hlint :
hlint src
@hlint src app test ${HLINTQUIET}

.PHONY : haddock
haddock :
Expand Down Expand Up @@ -65,7 +67,11 @@ test-watch:
stack test --fast --jobs $(THREADS) --file-watch

format:
find . -path './src/**/*.hs' -or -path './app/**/*.hs' -exec ormolu --mode inplace {} --ghc-opt -XStandaloneDeriving --ghc-opt -XUnicodeSyntax --ghc-opt -XDerivingStrategies --ghc-opt -XMultiParamTypeClasses --ghc-opt -XTemplateHaskell \;
@find . -name "*.hs" -exec ormolu --mode inplace {} --ghc-opt -XStandaloneDeriving --ghc-opt -XUnicodeSyntax --ghc-opt -XDerivingStrategies --ghc-opt -XMultiParamTypeClasses --ghc-opt -XTemplateHaskell --ghc-opt -XImportQualifiedPost \;

.PHONY: check-ormolu
check-ormolu:
@find . -name "*.hs" -exec ormolu --mode check {} --ghc-opt -XStandaloneDeriving --ghc-opt -XUnicodeSyntax --ghc-opt -XDerivingStrategies --ghc-opt -XMultiParamTypeClasses --ghc-opt -XTemplateHaskell --ghc-opt -XImportQualifiedPost \;

.PHONY : install
install:
Expand All @@ -78,6 +84,19 @@ install-watch:
repl:
stack ghci MiniJuvix:lib

.PHONY : install-pre-commit
install-pre-commit:
pip install pre-commit
pre-commit install

.PHONY : pre-commit
pre-commit :
pre-commit run --all-files

.PHONY : update-submodules
update-submodules :
git submodule foreach git pull origin main

prepare-push:
make checklines && make hlint && make format
.PHONY : minijuvix-stdlib
minijuvix-stdlib:
git submodule update --init minijuvix-stdlib
Loading

0 comments on commit f55112f

Please sign in to comment.