on dc88bb3 help sign in
26 files changed+456−743
since splitsnapshots
unifiedsplit
.github/workflows/ci.yaml+21−61 .gitignore−1 .travis.yml+60 .travis/attach-binary.sh+25 .travis/install-dependencies.sh+22 .travis/install-ghc.sh+16 .travis/install-ghr.sh+21 .travis/install-stack.sh+27 README.markdown+2−1 docker.nix+11−16 docs/introduction_to_the_relational_algebra.markdown+1−1 nix/sources.json−50 nix/sources.nix−171 pkgs.nix+7 project-m36.cabal+31−32 release.nix+140−16 src/bin/ProjectM36/Server/WebSocket/websocket-server.hs+9−42 src/lib/ProjectM36/Server/Config.hs−6 src/lib/ProjectM36/Server/ParseArgs.hs+14−31 src/lib/ProjectM36/Shortcuts.hs−247 stack.ghc8.10.yaml−19 stack.ghc8.6.yaml+24−24 stack.ghc8.8.yaml+24−24 test/TutorialD/InterpreterTest.hs → test/TutorialD/Interpreter.hs test/TutorialD/Interpreter/Import/ImportTest.hs → test/TutorialD/Interpreter/Import/TutorialD.hs+1−1 test/TutorialD/PrinterTest.hs → test/TutorialD/Printer.hs
.github/workflows/ci.yaml+21−61
@@ -6,64 +6,24 @@ jobs:
66 dockerimage:
77 runs-on: ubuntu-latest
88 steps:
9− - uses: actions/checkout@v2.3.1
10− - uses: cachix/install-nix-action@v12
11− with:
12− nix_path: nixpkgs=channel:nixos-unstable
13− - uses: cachix/cachix-action@v8
14− with:
15− name: project-m36
16− signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
17− - run: cachix use iohk
18− - name: docker load
19− run: docker load < $(nix-build docker.nix)
20− - name: docker login
21− if: ${{ github.ref == 'refs/heads/master' }}
22− run: echo ${{secrets.DOCKERHUB_PASSWORD}} | docker login --username ${{secrets.DOCKERHUB_USER}} --password-stdin
23− - name: docker tag with version
24− run: docker tag project-m36:latest projectm36/project-m36:$(awk '/^Version:/ {print $2}' project-m36.cabal)
25− if: ${{ github.ref == 'refs/heads/master' }}
26− - name: docker tag latest
27− run: docker tag project-m36:latest projectm36/project-m36:latest
28− if: ${{ github.ref == 'refs/heads/master' }}
29− - run: docker push projectm36/project-m36
30− if: ${{ github.ref == 'refs/heads/master' }}
31−
32− stack-build:
33− runs-on: ${{ matrix.os }}
34− strategy:
35− matrix:
36− os: [ubuntu-latest]
37− ghc:
38− - ghc8.10
39− - ghc8.8
40− - ghc8.6
41− include:
42− - os: macos-latest
43− ghc: ghc8.10
44− env:
45− STACK_YAML: stack.${{ matrix.ghc }}.yaml
46− steps:
47− - uses: actions/checkout@v2
48− - name: Cache
49− uses: actions/cache@v1
50− with:
51− path: ~/.stack
52− key: ${{ runner.os }}-build-stack-${{ matrix.ghc }}-${{ hashFiles(env.STACK_YAML) }}-${{ hashFiles('**/*.cabal') }}
53− restore-keys: |
54− ${{ runner.os }}-build-stack-${{ matrix.ghc }}-${{ hashFiles(env.STACK_YAML) }}
55− ${{ runner.os }}-build-stack-${{ matrix.ghc }}
56− - name: Fix macOS cache bug
57− run: rm -rf ~/.stack/setup-exe-cache
58− - name: Build
59− run: stack build --ghc-options -O2 --local-bin-path out --copy-bins
60− - name: Test
61− run: stack test --stack-yaml=${{ env.STACK_YAML }}
62− - name: HLint
63− run: curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s .
64− - name: Haddock
65− run: stack --no-install-ghc --system-ghc --no-haddock-deps haddock
66− - uses: actions/upload-artifact@v2
67− with:
68− name: project-m36-${{ matrix.os }}-${{ matrix.ghc }}
69− path: out/
9+ - uses: actions/checkout@v2.3.1
10+ - uses: cachix/install-nix-action@v12
11+ with:
12+ nix_path: nixpkgs=channel:nixos-unstable
13+ - uses: cachix/cachix-action@v8
14+ with:
15+ name: project-m36
16+ signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
17+ - run: cachix use iohk
18+ - name: docker load
19+ run: docker load < $(nix-build docker.nix)
20+ - name: docker login
21+ run: echo ${{secrets.DOCKERHUB_PASSWORD}} | docker login --username ${{secrets.DOCKERHUB_USER}} --password-stdin
22+ - name: docker tag with version
23+ run: docker tag project-m36:latest projectm36/project-m36:$(awk '/^Version:/ {print $2}' project-m36.cabal)
24+ if: ${{ github.ref == 'refs/heads/master' }}
25+ - name: docker tag latest
26+ run: docker tag project-m36:latest projectm36/project-m36:latest
27+ if: ${{ github.ref == 'refs/heads/master' }}
28+ - run: docker push projectm36/project-m36
29+ if: ${{ github.ref == 'refs/heads/master' }}
.gitignore−1
@@ -20,4 +20,3 @@ jupyter/build
2020juyter/dist
2121.ipynb_checkpoints
2222project-m36.nix
23−stack.yaml
.travis.ymlnew file+60
@@ -0,0 +1,60 @@
1+# For more information, see https://github.com/ChrisPenner/haskell-stack-travis-ci
2+language: c
3+sudo: false
4+
5+git:
6+ submodules: false # whether to recursively clone submodules
7+
8+cache:
9+ directories:
10+ - $HOME/.ghc
11+ - $HOME/.cabal
12+ - $HOME/.stack
13+ - .stack-work
14+ timeout: 1000
15+
16+matrix:
17+ fast_finish: true
18+ include:
19+ - env: CACHE_NAME=8.8.4 STACK_YAML=stack.ghc8.8.yaml
20+ compiler: ": #stack 8.8.4"
21+
22+ - env: CACHE_NAME=8.6.5 STACK_YAML=stack.ghc8.6.yaml
23+ compiler: ": #stack 8.6.5"
24+
25+ - env: CACHE_NAME=osx-8.6.5 STACK_YAML=stack.ghc8.6.yaml
26+ os: osx
27+ osx_image: xcode11
28+ compiler: ": #stack 8.6.5"
29+
30+before_script:
31+ - unset CC
32+ - export PATH=$HOME/.local/bin:/opt/ghc/$GHC_VERSION/bin:$PATH
33+ - ./.travis/install-ghr.sh
34+ - ./.travis/install-stack.sh
35+
36+# Here starts the actual work to be performed for the package under test;
37+# any command which exits with a non-zero exit code causes the build to fail.
38+script:
39+ - |
40+ # Run tests
41+ set -e
42+ ./.travis/install-dependencies.sh
43+ stack --no-terminal --jobs=2 --system-ghc test
44+ - |
45+ #Run HLint
46+ if [[ "$(uname)" = "Linux" ]]; then
47+ curl -sL https://raw.github.com/ndmitchell/hlint/master/misc/travis.sh | sh -s lint src test examples --cpp-define VERSION_project_m36=HLINT
48+ fi
49+ - |
50+ #Run Haddock
51+ if [[ "$(uname)" = "Linux" ]]; then
52+ stack --no-install-ghc --system-ghc --no-haddock-deps haddock
53+ fi
54+
55+after_success:
56+ - |
57+ # Build and ship binary
58+ #./.travis/attach-binary.sh
59+
60+# EOF
.travis/attach-binary.shnew file+25
@@ -0,0 +1,25 @@
1+#!/bin/sh
2+set -o errexit -o verbose
3+
4+if test ! "$BUILD_BINARY" || test ! "$TRAVIS_TAG"
5+then
6+ echo 'This is not a release build.'
7+elif test ! "$GITHUB_TOKEN"
8+then
9+ echo 'The GITHUB_TOKEN environment variable is not set!'
10+ exit 1
11+else
12+ echo "Building binary for $TRAVIS_OS_NAME to $TRAVIS_TAG..."
13+ stack build --ghc-options -O2 --pedantic
14+ echo "Attaching binary for $TRAVIS_OS_NAME to $TRAVIS_TAG..."
15+ OWNER="$(echo "$TRAVIS_REPO_SLUG" | cut -f1 -d/)"
16+ REPO="$(echo "$TRAVIS_REPO_SLUG" | cut -f2 -d/)"
17+ BIN="$(stack path --local-install-root)/bin/$REPO"
18+ BUNDLE_NAME="$REPO-$TRAVIS_TAG-$TRAVIS_OS_NAME.tar.gz"
19+ cp "$BIN" "./$REPO"
20+ chmod +x "./$REPO"
21+ tar -czf "$BUNDLE_NAME" "$REPO"
22+ echo "SHA256:"
23+ shasum -a 256 "$BUNDLE_NAME"
24+ ghr -t "$GITHUB_TOKEN" -u "$OWNER" -r "$REPO" --replace "$(git describe --tags)" "$BUNDLE_NAME"
25+fi
.travis/install-dependencies.shnew file+22
@@ -0,0 +1,22 @@
1+# Run tests
2+if [[ "$(uname)" = "Darwin" ]]; then
3+ timeout_cmd="gtimeout"
4+else
5+ timeout_cmd="timeout"
6+fi
7+$timeout_cmd 40m stack --no-terminal --jobs=2 --install-ghc --system-ghc build --only-dependencies --fast
8+ret=$?
9+case "$ret" in
10+ 0)
11+ # continue
12+ ;;
13+ 124)
14+ echo "Timed out while installing dependencies."
15+ echo "Try building again by pushing a new commit."
16+ exit 1
17+ ;;
18+ *)
19+ echo "Failed to install dependencies; stack exited with $ret"
20+ exit "$ret"
21+ ;;
22+esac
.travis/install-ghc.shnew file+16
@@ -0,0 +1,16 @@
1+#!/bin/sh
2+set -eux
3+#assume stack is installed
4+STACK=~/.local/bin/stack
5+
6+fetch_ghc_osx() {
7+ echo "Using stack to install GHC $GHC_VERSION"
8+ $STACK setup $GHC_VERSION
9+}
10+
11+if [ "$(uname)" = "Darwin" ]; then
12+ fetch_ghc_osx
13+else
14+ #installed by apt
15+ echo "Linux GHC $GHC_VERSION via APT already installed."
16+fi
.travis/install-ghr.shnew file+21
@@ -0,0 +1,21 @@
1+#!/bin/sh
2+set -o errexit -o verbose
3+
4+if test ! "$BUILD_BINARY" || test ! "$TRAVIS_TAG"
5+then
6+ echo 'This is not a release build.'
7+else
8+ if [ "$TRAVIS_OS_NAME" = "linux" ]
9+ then
10+ ARCH="linux"
11+ else
12+ ARCH="darwin"
13+ fi
14+ echo "Installing ghr"
15+ URL="https://github.com/tcnksm/ghr/releases/download/v0.5.4/ghr_v0.5.4_${ARCH}_386.zip"
16+ curl -L ${URL} > ghr.zip
17+ mkdir -p "$HOME/bin"
18+ export PATH="$HOME/bin:$PATH"
19+ unzip ghr.zip -d "$HOME/bin"
20+ rm ghr.zip
21+fi
.travis/install-stack.shnew file+27
@@ -0,0 +1,27 @@
1+#!/bin/sh
2+
3+# Adapted from https://github.com/commercialhaskell/stack
4+
5+set -eux
6+
7+travis_retry() {
8+ cmd=$*
9+ $cmd || (sleep 2 && $cmd) || (sleep 10 && $cmd)
10+}
11+
12+fetch_stack_osx() {
13+ curl -skL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;
14+}
15+
16+fetch_stack_linux() {
17+ curl -sL https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack';
18+}
19+
20+# We need stack to generate cabal files with precise bounds, even for cabal
21+# builds.
22+mkdir -p ~/.local/bin;
23+if [ "$(uname)" = "Darwin" ]; then
24+ travis_retry fetch_stack_osx
25+else
26+ travis_retry fetch_stack_linux
27+fi
README.markdown+2−1
@@ -4,6 +4,7 @@
44[![Public Domain](https://img.shields.io/badge/license-Public%20Domain-brightgreen.svg)](http://unlicense.org)
55[![Hackage](https://img.shields.io/hackage/v/project-m36.svg)](http://hackage.haskell.org/package/project-m36)
66[![Hackage dependency status](https://img.shields.io/hackage-deps/v/project-m36.svg)](http://packdeps.haskellers.com/feed?needle=project-m36)
7+[![Build status](https://travis-ci.org/agentm/project-m36.svg?branch=master)](https://travis-ci.org/agentm/project-m36)
78[![Windows Build status](https://ci.appveyor.com/api/projects/status/q7jyddd6dy1ibqdo/branch/master?svg=true)](https://ci.appveyor.com/project/agentm/project-m36)
89[![Github Workflow status](https://github.com/agentm/project-m36/workflows/CI/badge.svg)](https://github.com/agentm/project-m36/actions?query=workflow%3ACI)
910
@@ -44,7 +45,7 @@ Project:M36 supports multiple frontends which target different audiences.
4445
4546* [Developer's Blog](https://agentm.github.io/project-m36/)
4647* [Mailing List/Discussion Group](https://groups.google.com/d/forum/project-m36)
47−* IRC Channel: irc.libera.chat #project-m36 -- [Chat via Web Client](http://kiwiirc.com/nextclient/irc.libera.chat:+6697/#project-m36)
48+* IRC Channel: chat.freenode.net #project-m36
4849* [Hackage](https://hackage.haskell.org/package/project-m36)
4950* [Diogo Biazus' Project:M36 Video Tutorial](https://www.youtube.com/watch?v=_GC_lxlVEnE)
5051
docker.nix+11−16
@@ -1,18 +1,13 @@
1−{ compiler ? "ghc8104"
2−, sources ? import ./nix/sources.nix
3−, pkgs ? import sources.nixpkgs { }
4−}:
1+{ pkgs ? import ./pkgs.nix }:
52let
6− release = import ./release.nix { inherit pkgs compiler sources; };
7− static-project-m36 = pkgs.haskell.lib.dontCheck (pkgs.haskell.lib.justStaticExecutables release.project);
3+ release = import ./release.nix { inherit pkgs; };
4+ static-project-m36 = pkgs.haskell.lib.justStaticExecutables release.project;
85in
9−pkgs.dockerTools.buildImage {
10− name = "project-m36";
11− tag = "latest";
12− contents = [ static-project-m36 ];
13− # expose default project-m36 and websocket server ports
14− config = {
15− Env = [ "LC_ALL=en_US.UTF-8" ];
16− ExposedPorts = { "6543/tcp" = { }; "8000/tcp" = { }; };
17− };
18−}
6+ pkgs.dockerTools.buildImage {
7+ name = "project-m36";
8+ tag = "latest";
9+ contents = [static-project-m36];
10+ #expose default project-m36 and websocket server ports
11+ config = { Env = ["LC_ALL=en_US.UTF-8"];
12+ ExposedPorts = { "6543/tcp" = {}; "8000/tcp" = {}; }; };
13+ }
docs/introduction_to_the_relational_algebra.markdown+1−1
@@ -202,7 +202,7 @@ Join (Instructor relation)
202202
203203(Course Relation)
204204
205−|(Course Name, Course Name Type)|(Instructor Name, Instructor Name Type)|(Course Room Number, Room Number Type)|
205+|(Course Name, Course Name Type)|(Instructor, Instructor Name Type)|(Course Room Number, Room Number Type)|
206206|-------------------------------|----------------------------------|--------------------------------------|
207207|English 1|Steve|Room 104|
208208|French 2|Bob|Room 103|
nix/sources.jsondeleted−50
@@ -1,50 +0,0 @@
1−{
2− "curryer": {
3− "branch": "master",
4− "description": "Fast Haskell RPC",
5− "homepage": null,
6− "owner": "agentm",
7− "repo": "curryer",
8− "rev": "74ecaac619ad1165a4517d5c0f4e530493bda130",
9− "sha256": "1izdvzj00k0y76ixm7dfgvq2fzphb8h4nzqgwkl3p0bg0806rsn1",
10− "type": "tarball",
11− "url": "https://github.com/agentm/curryer/archive/74ecaac619ad1165a4517d5c0f4e530493bda130.tar.gz",
12− "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13− },
14− "niv": {
15− "branch": "master",
16− "description": "Easy dependency management for Nix projects",
17− "homepage": "https://github.com/nmattia/niv",
18− "owner": "nmattia",
19− "repo": "niv",
20− "rev": "1819632b5823e0527da28ad82fecd6be5136c1e9",
21− "sha256": "08jz17756qchq0zrqmapcm33nr4ms9f630mycc06i6zkfwl5yh5i",
22− "type": "tarball",
23− "url": "https://github.com/nmattia/niv/archive/1819632b5823e0527da28ad82fecd6be5136c1e9.tar.gz",
24− "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
25− },
26− "nixpkgs": {
27− "branch": "master",
28− "description": "Nix Packages collection",
29− "homepage": "",
30− "owner": "NixOS",
31− "repo": "nixpkgs",
32− "rev": "429c23aad0fce9ef38b0e60d55d7459c19d53ddc",
33− "sha256": "1nj8sh1fnxp07jdlvjkijwfd1pnsi2zj0ivy7a0dhx02g63byhg3",
34− "type": "tarball",
35− "url": "https://github.com/NixOS/nixpkgs/archive/429c23aad0fce9ef38b0e60d55d7459c19d53ddc.tar.gz",
36− "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
37− },
38− "streamly": {
39− "branch": "ac3af8749194f1788704dda8667d0b3807075cc2",
40− "description": "Beautiful Streaming, Concurrent and Reactive Composition (Haskell)",
41− "homepage": "https://hackage.haskell.org/package/streamly",
42− "owner": "composewell",
43− "repo": "streamly",
44− "rev": "ac3af8749194f1788704dda8667d0b3807075cc2",
45− "sha256": "04d8fk654vawdfs0dfidmq2awwgwi8x44iv8r7vqz70zkcsd5fij",
46− "type": "tarball",
47− "url": "https://github.com/composewell/streamly/archive/ac3af8749194f1788704dda8667d0b3807075cc2.tar.gz",
48− "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
49− }
50−}
nix/sources.nixdeleted−171
@@ -1,171 +0,0 @@
1−# This file has been generated by Niv.
2−
3−let
4−
5− #
6− # The fetchers. fetch_<type> fetches specs of type <type>.
7− #
8−
9− fetch_file = pkgs: name: spec:
10− let
11− name' = sanitizeName name + "-src";
12− in
13− if spec.builtin or true then
14− builtins_fetchurl { inherit (spec) url sha256; name = name'; }
15− else
16− pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
17−
18− fetch_tarball = pkgs: name: spec:
19− let
20− name' = sanitizeName name + "-src";
21− in
22− if spec.builtin or true then
23− builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
24− else
25− pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
26−
27− fetch_git = name: spec:
28− let
29− ref =
30− if spec ? ref then spec.ref else
31− if spec ? branch then "refs/heads/${spec.branch}" else
32− if spec ? tag then "refs/tags/${spec.tag}" else
33− abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
34− in
35− builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
36−
37− fetch_local = spec: spec.path;
38−
39− fetch_builtin-tarball = name: throw
40− ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
41− $ niv modify ${name} -a type=tarball -a builtin=true'';
42−
43− fetch_builtin-url = name: throw
44− ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
45− $ niv modify ${name} -a type=file -a builtin=true'';
46−
47− #
48− # Various helpers
49− #
50−
51− # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
52− sanitizeName = name:
53− (
54− concatMapStrings (s: if builtins.isList s then "-" else s)
55− (
56− builtins.split "[^[:alnum:]+._?=-]+"
57− ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
58− )
59− );
60−
61− # The set of packages used when specs are fetched using non-builtins.
62− mkPkgs = sources: system:
63− let
64− sourcesNixpkgs =
65− import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
66− hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
67− hasThisAsNixpkgsPath = <nixpkgs> == ./.;
68− in
69− if builtins.hasAttr "nixpkgs" sources
70− then sourcesNixpkgs
71− else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
72− import <nixpkgs> {}
73− else
74− abort
75− ''
76− Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
77− add a package called "nixpkgs" to your sources.json.
78− '';
79−
80− # The actual fetching function.
81− fetch = pkgs: name: spec:
82−
83− if ! builtins.hasAttr "type" spec then
84− abort "ERROR: niv spec ${name} does not have a 'type' attribute"
85− else if spec.type == "file" then fetch_file pkgs name spec
86− else if spec.type == "tarball" then fetch_tarball pkgs name spec
87− else if spec.type == "git" then fetch_git name spec
88− else if spec.type == "local" then fetch_local spec
89− else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
90− else if spec.type == "builtin-url" then fetch_builtin-url name
91− else
92− abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
93−
94− # If the environment variable NIV_OVERRIDE_${name} is set, then use
95− # the path directly as opposed to the fetched source.
96− replace = name: drv:
97− let
98− saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
99− ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
100− in
101− if ersatz == "" then drv else ersatz;
102−
103− # Ports of functions for older nix versions
104−
105− # a Nix version of mapAttrs if the built-in doesn't exist
106− mapAttrs = builtins.mapAttrs or (
107− f: set: with builtins;
108− listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
109− );
110−
111− # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
112− range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
113−
114− # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
115− stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
116−
117− # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
118− stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
119− concatMapStrings = f: list: concatStrings (map f list);
120− concatStrings = builtins.concatStringsSep "";
121−
122− # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
123− optionalAttrs = cond: as: if cond then as else {};
124−
125− # fetchTarball version that is compatible between all the versions of Nix
126− builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
127− let
128− inherit (builtins) lessThan nixVersion fetchTarball;
129− in
130− if lessThan nixVersion "1.12" then
131− fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
132− else
133− fetchTarball attrs;
134−
135− # fetchurl version that is compatible between all the versions of Nix
136− builtins_fetchurl = { url, name ? null, sha256 }@attrs:
137− let
138− inherit (builtins) lessThan nixVersion fetchurl;
139− in
140− if lessThan nixVersion "1.12" then
141− fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
142− else
143− fetchurl attrs;
144−
145− # Create the final "sources" from the config
146− mkSources = config:
147− mapAttrs (
148− name: spec:
149− if builtins.hasAttr "outPath" spec
150− then abort
151− "The values in sources.json should not have an 'outPath' attribute"
152− else
153− spec // { outPath = replace name (fetch config.pkgs name spec); }
154− ) config.sources;
155−
156− # The "config" used by the fetchers
157− mkConfig =
158− { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
159− , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
160− , system ? builtins.currentSystem
161− , pkgs ? mkPkgs sources system
162− }: rec {
163− # The sources, i.e. the attribute set of spec name to spec
164− inherit sources;
165−
166− # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
167− inherit pkgs;
168− };
169−
170−in
171−mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
pkgs.nixnew file+7
@@ -0,0 +1,7 @@
1+let
2+nixpkgs = builtins.fetchTarball {
3+ url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/20.09.tar.gz";
4+ sha256 = "1wg61h4gndm3vcprdcg7rc4s1v3jkm5xd7lw8r2f67w502y94gcy";
5+};
6+in
7+import nixpkgs { config.allowBroken = true; }
project-m36.cabal+31−32
@@ -2,7 +2,7 @@ Cabal-Version: 2.2
22Name: project-m36
33Version: 0.9.3
44License: MIT
5−--note that this license specification is erroneous and only labeled MIT to appease hackage which does not recognize public domain packages in cabal >2.2- Project:M36 is dedicated to the public domain
5+--note that this license specification is erroneous and only labeled MIT to appease hackage which does not recognize public domain packages in cabal >2.2- Project:M36 is dedicated to the public domain
66Build-Type: Simple
77Homepage: https://github.com/agentm/project-m36
88Bug-Reports: https://github.com/agentm/project-m36/issues
@@ -35,7 +35,7 @@ Flag haskell-scripting
3535 Default: True
3636
3737Library
38− Build-Depends: base>=4.8 && < 4.15, ghc-paths, mtl, containers, unordered-containers, hashable, haskeline, directory, MonadRandom, random-shuffle, uuid >= 1.3.12, cassava >= 0.4.5.1 && < 0.6, text, bytestring, deepseq, deepseq-generics, vector, parallel, monad-parallel, exceptions, transformers, gnuplot, filepath, zlib, directory, temporary, stm, time, hashable-time, old-locale, rset, attoparsec, either, base64-bytestring, data-interval, extended-reals, aeson >= 1.1, path-pieces, conduit, resourcet, http-api-data, semigroups, QuickCheck, quickcheck-instances, list-t, stm-containers >= 0.2.15, foldl, optparse-applicative, Glob, cryptohash-sha256, text-manipulate >= 0.2.0.1 && < 0.4, winery, curryer-rpc, network, async, vector-instances, recursion-schemes, streamly >= 0.7.2, convertible
38+ Build-Depends: base>=4.8 && < 4.15, ghc-paths, mtl, containers, unordered-containers, hashable, haskeline, directory, MonadRandom, random-shuffle, uuid >= 1.3.12, cassava >= 0.4.5.1 && < 0.6, text, bytestring, deepseq, deepseq-generics, vector, parallel, monad-parallel, exceptions, transformers, gnuplot, filepath, zlib, directory, temporary, stm, time, hashable-time, old-locale, rset, attoparsec, either, base64-bytestring, data-interval, extended-reals, aeson >= 1.1, path-pieces, conduit, resourcet, http-api-data, semigroups, QuickCheck, quickcheck-instances, list-t, stm-containers >= 0.2.15, foldl, optparse-applicative, Glob, cryptohash-sha256, text-manipulate >= 0.2.0.1 && < 0.4, winery, curryer-rpc, network, async, vector-instances, recursion-schemes, streamly >= 0.7.2
3939 if flag(haskell-scripting)
4040 Build-Depends: ghc >= 8.2 && < 8.11
4141 CPP-Options: -DPM36_HASKELL_SCRIPTING
@@ -63,7 +63,6 @@ Library
6363 ProjectM36.AtomFunction,
6464 ProjectM36.AtomFunctionError,
6565 ProjectM36.ScriptSession,
66− ProjectM36.Shortcuts,
6766 ProjectM36.DatabaseContextFunction,
6867 ProjectM36.DatabaseContextFunctionError,
6968 ProjectM36.DatabaseContextFunctionUtils,
@@ -143,7 +142,7 @@ Library
143142 Hs-Source-Dirs: ./src/lib
144143 Default-Language: Haskell2010
145144 Default-Extensions: OverloadedStrings, CPP
146− if !flag(stack)
145+ if !flag(stack)
147146 Build-Depends: deferred-folds
148147
149148Executable tutd
@@ -187,8 +186,8 @@ Executable tutd
187186 curryer-rpc,
188187 prettyprinter,
189188 cryptohash-sha256,
190− --due to decode signature change
191− base16-bytestring >= 1.0.0.0,
189+ --due to decode signature change
190+ base16-bytestring >= 1.0.0.0,
192191 http-conduit,
193192 modern-uri,
194193 http-types
@@ -270,11 +269,11 @@ Executable bigrel
270269 GHC-Prof-Options: -fprof-auto -rtsopts -threaded -Wall
271270
272271Common commontest
273− Default-Language: Haskell2010
272+ Default-Language: Haskell2010
274273 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics,parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, semigroups, parser-combinators, winery, curryer-rpc, prettyprinter, base64-bytestring, modern-uri, http-types, http-conduit, base16-bytestring,cryptohash-sha256
275274 Default-Extensions: OverloadedStrings
276275 GHC-Options: -Wall -threaded
277− Hs-Source-Dirs: test, src/bin
276+ Hs-Source-Dirs: ./src/bin, ., test/
278277
279278Benchmark basic-benchmark
280279 Default-Language: Haskell2010
@@ -287,7 +286,7 @@ Benchmark basic-benchmark
287286 if flag(profiler)
288287 GHC-Prof-Options: -fprof-auto -rtsopts -threaded -Wall
289288
290−--benchmark inserts, updates, deletes for a basic use-case to shake out any space leaks
289+--benchmark inserts, updates, deletes for a basic use-case to shake out any space leaks
291290Benchmark update-exprs
292291 Default-Language: Haskell2010
293292 Default-Extensions: OverloadedStrings
@@ -302,7 +301,7 @@ Benchmark update-exprs
302301Test-Suite test-tutoriald
303302 import: commontest
304303 type: exitcode-stdio-1.0
305− main-is: TutorialD/InterpreterTest.hs
304+ main-is: test/TutorialD/Interpreter.hs
306305 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.SchemaOperator, TutorialD.Printer
307306 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, stm-containers, list-t, project-m36, random, MonadRandom, semigroups, parser-combinators, prettyprinter
308307
@@ -310,56 +309,56 @@ Test-Suite test-tutoriald-atomfunctionscript
310309 import: commontest
311310 type: exitcode-stdio-1.0
312311 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.SchemaOperator, TutorialD.Printer
313− main-is: TutorialD/Interpreter/AtomFunctionScript.hs
312+ main-is: test/TutorialD/Interpreter/AtomFunctionScript.hs
314313
315314Test-Suite test-tutoriald-databasecontextfunctionscript
316315 import: commontest
317316 type: exitcode-stdio-1.0
318317 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.SchemaOperator, TutorialD.Printer
319− main-is: TutorialD/Interpreter/DatabaseContextFunctionScript.hs
318+ main-is: test/TutorialD/Interpreter/DatabaseContextFunctionScript.hs
320319
321320Test-Suite test-relation
322321 import: commontest
323322 type: exitcode-stdio-1.0
324− main-is: Relation/Basic.hs
323+ main-is: test/Relation/Basic.hs
325324
326325Test-Suite test-static-optimizer
327326 import: commontest
328327 type: exitcode-stdio-1.0
329− main-is: Relation/StaticOptimizer.hs
328+ main-is: test/Relation/StaticOptimizer.hs
330329
331330Test-Suite test-transactiongraph-persist
332331 import: commontest
333332 type: exitcode-stdio-1.0
334− main-is: TransactionGraph/Persist.hs
333+ main-is: test/TransactionGraph/Persist.hs
335334 Other-Modules: TutorialD.Interpreter.Base, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Printer
336335
337336Test-Suite test-relation-import-csv
338337 import: commontest
339338 type: exitcode-stdio-1.0
340− main-is: Relation/Import/CSV.hs
339+ main-is: test/Relation/Import/CSV.hs
341340
342341Test-Suite test-tutoriald-import-tutoriald
343342 import: commontest
344343 type: exitcode-stdio-1.0
345− main-is: TutorialD/Interpreter/Import/ImportTest.hs
344+ main-is: test/TutorialD/Interpreter/Import/TutorialD.hs
346345 Other-Modules: TutorialD.Interpreter.Base, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Printer
347346
348347Test-Suite test-relation-export-csv
349348 import: commontest
350349 type: exitcode-stdio-1.0
351− main-is: Relation/Export/CSV.hs
350+ main-is: test/Relation/Export/CSV.hs
352351
353352Test-Suite test-transactiongraph-merge
354353 import: commontest
355354 type: exitcode-stdio-1.0
356− main-is: TransactionGraph/Merge.hs
355+ main-is: test/TransactionGraph/Merge.hs
357356
358357
359358Test-Suite test-prettyprinter
360359 import: commontest
361360 type: exitcode-stdio-1.0
362− main-is: TutorialD/PrinterTest.hs
361+ main-is: test/TutorialD/Printer.hs
363362 Other-Modules: TutorialD.Printer, TutorialD.Interpreter.Base, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types
364363
365364benchmark bench
@@ -370,7 +369,7 @@ benchmark bench
370369Test-Suite test-server
371370 import: commontest
372371 type: exitcode-stdio-1.0
373− main-is: Server/Main.hs
372+ main-is: test/Server/Main.hs
374373
375374
376375Executable Example-SimpleClient
@@ -428,12 +427,12 @@ Executable Example-DerivingCustomTupleable
428427Test-Suite test-scripts
429428 import: commontest
430429 type: exitcode-stdio-1.0
431− main-is: scripts.hs
430+ main-is: test/scripts.hs
432431 Other-Modules: TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Printer
433432
434433Executable project-m36-websocket-server
435434 Default-Language: Haskell2010
436− Build-Depends: base, aeson, path-pieces, either, conduit, http-api-data, template-haskell, websockets, aeson, optparse-applicative, project-m36, containers, bytestring, text, vector, uuid, megaparsec, haskeline, mtl, directory, base64-bytestring, random, MonadRandom, time, semigroups, attoparsec, parser-combinators, prettyprinter, network, modern-uri, http-conduit, base16-bytestring, http-types, cryptohash-sha256, wai, wai-websockets, warp, warp-tls
435+ Build-Depends: base, aeson, path-pieces, either, conduit, http-api-data, template-haskell, websockets, aeson, optparse-applicative, project-m36, containers, bytestring, text, vector, uuid, megaparsec, haskeline, mtl, directory, base64-bytestring, random, MonadRandom, time, semigroups, attoparsec, parser-combinators, prettyprinter, network, modern-uri, http-conduit, base16-bytestring, http-types, cryptohash-sha256
437436 Main-Is: ProjectM36/Server/WebSocket/websocket-server.hs
438437 Other-Modules: ProjectM36.Client.Json, ProjectM36.Server.RemoteCallTypes.Json, ProjectM36.Server.WebSocket, TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.SchemaOperator, TutorialD.Printer
439438 GHC-Options: -Wall -threaded
@@ -443,39 +442,39 @@ Executable project-m36-websocket-server
443442Test-Suite test-websocket-server
444443 import: commontest
445444 type: exitcode-stdio-1.0
446− main-is: Server/WebSocket.hs
445+ main-is: test/Server/WebSocket.hs
447446 Other-Modules: TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.TransactionGraphOperator, ProjectM36.Client.Json, ProjectM36.Server.RemoteCallTypes.Json, ProjectM36.Server.WebSocket, TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.Types, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.SchemaOperator, TutorialD.Printer
448447
449448Test-Suite test-isomorphic-schemas
450449 import: commontest
451450 type: exitcode-stdio-1.0
452− main-is: IsomorphicSchema.hs
451+ main-is: test/IsomorphicSchema.hs
453452
454453Test-Suite test-atomable
455454 import: commontest
456455 type: exitcode-stdio-1.0
457− main-is: Relation/Atomable.hs
456+ main-is: test/Relation/Atomable.hs
458457 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.SchemaOperator, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Printer
459458
460459Test-Suite test-multiprocess-access
461460 import: commontest
462461 type: exitcode-stdio-1.0
463− main-is: MultiProcessDatabaseAccess.hs
462+ main-is: test/MultiProcessDatabaseAccess.hs
464463
465464Test-Suite test-transactiongraph-automerge
466465 import: commontest
467466 type: exitcode-stdio-1.0
468− main-is: TransactionGraph/Automerge.hs
467+ main-is: test/TransactionGraph/Automerge.hs
469468 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.SchemaOperator, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Printer
470469
471470Test-Suite test-tupleable
472471 import: commontest
473472 type: exitcode-stdio-1.0
474− main-is: Relation/Tupleable.hs
473+ main-is: test/Relation/Tupleable.hs
475474
476475Test-Suite test-client-simple
477476 import: commontest
478− Main-Is: Client/Simple.hs
477+ Main-Is: test/Client/Simple.hs
479478 type: exitcode-stdio-1.0
480479
481480-- test for file handle leaks
@@ -506,9 +505,9 @@ Executable handles
506505 HS-Source-Dirs: ./src/bin
507506 if flag(profiler)
508507 GHC-Prof-Options: -fprof-auto -rtsopts -threaded -Wall
509−
508+
510509Test-Suite test-dataframe
511510 import: commontest
512511 type: exitcode-stdio-1.0
513− Main-Is: DataFrame.hs
512+ Main-Is: test/DataFrame.hs
514513 Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.SchemaOperator, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types, TutorialD.Printer
release.nix+140−16
@@ -1,30 +1,154 @@
1−{ compiler ? "ghc8104"
2−, sources ? import ./nix/sources.nix
3−, pkgs ? import sources.nixpkgs { }
1+{ compiler ? "ghc865"
2+, pkgs ? import <nixpkgs> {}
43}:
4+
55let
6+ inherit (pkgs.lib.trivial) flip pipe;
7+ inherit (pkgs.haskell.lib) appendPatch appendConfigureFlags;
68 doJailbreak = pkgs.haskell.lib.doJailbreak;
7− needsCocoa = drv:
8− if pkgs.stdenv.isDarwin
9− then drv.overrideDerivation (old:
10− { buildInputs = [ pkgs.darwin.apple_sdk.frameworks.Cocoa ] ++ old.buildInputs; }
11− )
12− else drv;
9+ dontHaddock = pkgs.haskell.lib.dontHaddock;
10+ dontCheck = pkgs.haskell.lib.dontCheck;
11+ streamly-master = pkgs.fetchFromGitHub {
12+ owner = "composewell";
13+ repo = "streamly";
14+ rev = "ac3af8749194f1788704dda8667d0b3807075cc2";
15+ sha256 = "04d8fk654vawdfs0dfidmq2awwgwi8x44iv8r7vqz70zkcsd5fij";
16+ };
1317
18+ distProcessPkg = pkg : dontHaddock (doJailbreak (dontCheck pkg));
19+ callHackageDirectWithOptions = {pkg,ver, sha256, options}:
20+ let pkgver = "${pkg}-${ver}";
21+ in
22+ haskellPackages.callCabal2nixWithOptions pkg (pkgs.fetchzip {
23+ url = "mirror://hackage/${pkgver}/${pkgver}.tar.gz";
24+ inherit sha256;
25+ }) options;
26+
1427 haskellPackages = pkgs.haskell.packages.${compiler}.override {
1528 overrides = self: super: {
16− curryer-rpc = self.callCabal2nix "curryer-rpc" sources.curryer { };
17− streamly = doJailbreak (needsCocoa (self.callCabal2nix "streamly" sources.streamly { }));
18− project-m36 = ((self.callCabal2nixWithOptions "project-m36" ./. "-f-haskell-scripting" { }));
29+ rank1dynamic =
30+ distProcessPkg (self.callHackageDirect {
31+ pkg = "rank1dynamic";
32+ ver = "0.4.0";
33+ sha256 = "1x6p9z53s7xwp93jp4n1lq6m5xspcn6w62p461v8vqnp9600328b";
34+}{});
35+ stm-hamt =
36+ distProcessPkg(self.callHackageDirect {
37+ pkg = "stm-hamt";
38+ ver = "1.2.0.3";
39+ sha256 = "1i8j7q8nhx3l7gydrjlsyhkvllr6bppgrjf0hp38zpm7p6xcv2bb";
40+ }{});
41+
42+ stm-containers =
43+ distProcessPkg(self.callHackageDirect {
44+ pkg = "stm-containers";
45+ ver = "1.1.0.4";
46+ sha256 = "0h9z6lawdm44minx9spvdb7sp645l36ri5cnxvhrcxwzr64s7qb5";
47+ }{});
48+
49+ data-interval =
50+ distProcessPkg(self.callHackageDirect {
51+ pkg = "data-interval";
52+ ver = "2.0.1";
53+ sha256 = "085j4yjr8wimxampxqdrg47p577whwg2mjxgfdl44yfck52fb6an";
54+ }{});
55+
56+ rset = distProcessPkg super.rset;
57+
58+ curryer-rpc =
59+ distProcessPkg(self.callHackageDirect {
60+ pkg = "curryer-rpc";
61+ ver = "0.1";
62+ sha256 = "0vb7q68g4zjm20simnqpjdpvcvh4g8cwlc5b6zjdjpg1rargri41";
63+ }{});
64+
65+ streamly = distProcessPkg(self.callCabal2nix "streamly" streamly-master {});
66+
67+ fusion-plugin-types =
68+ distProcessPkg(self.callHackageDirect {
69+ pkg = "fusion-plugin-types";
70+ ver = "0.1.0";
71+ sha256 = "17211b80p4zqisghs2j8flm4dj788f9glx2id6nh8f223q4cigc9";
72+ }{});
73+
74+ winery =
75+ distProcessPkg(self.callHackageDirect {
76+ pkg = "winery";
77+ ver = "1.3.2";
78+ sha256 = "1jc7q8m0zd8bziwa3mra44j518ckc566akk7r5hqpf8x5ng0n4vv";
79+ }{});
80+
81+ barbies-th =
82+ distProcessPkg(self.callHackageDirect {
83+ pkg = "barbies-th";
84+ ver = "0.1.7";
85+ sha256 = "0gf39kcn6lwqhz888qm3iypma76yrp3zwmif1niry647qq27xp4j";
86+ }{});
87+
88+ barbies =
89+ distProcessPkg(self.callHackageDirect {
90+ pkg = "barbies";
91+ ver = "2.0.2.0";
92+ sha256 = "0753rd8pw0x1cgasz8a6633kg83jngwzncp9khbimllvcdqzardh";
93+ }{});
94+
95+ prettyprinter =
96+ distProcessPkg(self.callHackageDirect {
97+ pkg = "prettyprinter";
98+ ver = "1.7.0";
99+ sha256 = "17byy08brwcsl5rqdhibq3pcpgx085shizb2ap6s4xy3izdia3cc";
100+ }{});
101+
102+ prettyprinter-ansi-terminal =
103+ distProcessPkg(self.callHackageDirect {
104+ pkg = "prettyprinter-ansi-terminal";
105+ ver = "1.1.2";
106+ sha256 = "0lwcqndppw3jc55rlnn6sp76zmjx2yzl21g9jhg27k2rdnjwd7md";
107+ }{});
108+
109+ http2 = distProcessPkg super.http2;
110+
111+ cryptohash-sha256 =
112+ distProcessPkg(self.callHackageDirect {
113+ pkg = "cryptohash-sha256";
114+ ver = "0.11.101.0";
115+ sha256 = "02n4s1fm4kivi5cjzbwkzjs31h5sw8zrv0vv2qyz3413zp3g6010";
116+ }{});
117+
118+ cryptohash-md5 =
119+ distProcessPkg(self.callHackageDirect {
120+ pkg = "cryptohash-md5";
121+ ver = "0.11.100.1";
122+ sha256 = "1l9l3c5x4759pa0ah48skzrkakb5738n6cw60ksj8pmzf68f428a";
123+ }{});
124+
125+ cryptohash-sha1 =
126+ distProcessPkg(self.callHackageDirect {
127+ pkg = "cryptohash-sha1";
128+ ver = "0.11.100.1";
129+ sha256 = "0k3q9sraq7s5y8i01p5a2b3cvbdvslz9kv494vh83jrvsamj7dcx";
130+ }{});
131+
132+ base16-bytestring =
133+ distProcessPkg(self.callHackageDirect {
134+ pkg = "base16-bytestring";
135+ ver = "1.0.1.0";
136+ sha256 = "0wvsjhg301qxikarvnvrbhdadrs892z4v8w9bq4na4gwdlf4aw6z";
137+ }{});
138+
139+ project-m36 = dontCheck (self.callCabal2nixWithOptions "project-m36" ./. "-f-haskell-scripting" { });
140+
19141 };
20142 };
143+
144+ project = haskellPackages.project-m36;
21145in
22146{
23− project = haskellPackages.project-m36;
147+ project = project;
24148
25149 shell = haskellPackages.shellFor {
26− packages = p: [
27− p.project-m36
150+ packages = p: with p; [
151+ project
28152 ];
29153 buildInputs = [
30154 haskellPackages.ghcid
@@ -33,4 +157,4 @@ in
33157 ];
34158 withHoogle = true;
35159 };
36−}
160+}
src/bin/ProjectM36/Server/WebSocket/websocket-server.hs+9−42
@@ -1,40 +1,23 @@
11{-# LANGUAGE CPP #-}
2−
2+import ProjectM36.Server.WebSocket
3+import ProjectM36.Server.Config
4+import ProjectM36.Server.ParseArgs
5+import ProjectM36.Server
36import Control.Concurrent
7+import qualified Network.WebSockets as WS
48import Control.Exception
5−import Control.Monad (when)
6−import Data.Maybe (isJust)
7−import Data.String (fromString)
8−import Network.HTTP.Types (status400)
99import Network.Socket
10−import Network.Wai (Application, responseLBS)
11−import Network.Wai.Handler.Warp
12−import Network.Wai.Handler.WarpTLS (runTLS, tlsSettings)
13−import qualified Network.Wai.Handler.WebSockets as WS
14−import Network.WebSockets (defaultConnectionOptions)
15−import ProjectM36.Server
16−import ProjectM36.Server.Config
17−import ProjectM36.Server.ParseArgs
18−import ProjectM36.Server.WebSocket
1910
2011main :: IO ()
2112main = do
2213 -- launch normal project-m36-server
2314 addressMVar <- newEmptyMVar
24− wsConfig <- parseWSConfigWithDefaults (defaultServerConfig {bindPort = 8000, bindHost = "127.0.0.1"})
25−
15+ serverConfig <- parseConfigWithDefaults (defaultServerConfig { bindPort = 8000, bindHost = "127.0.0.1" })
2616 --usurp the serverConfig for our websocket server and make the proxied server run locally
27− let serverConfig = wsServerConfig wsConfig
28− wsHost = bindHost serverConfig
17+ let wsHost = bindHost serverConfig
2918 wsPort = bindPort serverConfig
3019 serverHost = "127.0.0.1"
3120 serverConfig' = serverConfig {bindPort = 0, bindHost = serverHost}
32− configCertificateFile = tlsCertificatePath wsConfig
33− configKeyFile = tlsKeyPath wsConfig
34−
35− when (isJust configCertificateFile /= isJust configKeyFile) $
36− throwIO $ ErrorCall "TLS_CERTIFICATE_PATH and TLS_KEY_PATH must be set in tandem"
37−
3821 _ <- forkFinally (launchServer serverConfig' (Just addressMVar) >> pure ()) (either throwIO pure)
3922 --wait for server to be listening
4023 addr <- takeMVar addressMVar
@@ -42,22 +25,6 @@ main = do
4225 case addr of
4326 SockAddrInet port' _ -> fromIntegral port'
4427 _ -> error "unsupported socket address (IPv4 only currently)"
45− wsApp = websocketProxyServer port serverHost
46− waiApp = WS.websocketsOr defaultConnectionOptions wsApp backupApp
47− settings = warpSettings wsHost (fromIntegral wsPort)
48−
49− case (configCertificateFile, configKeyFile) of
50− (Just certificate, Just key) -> runTLS (tlsSettings certificate key) settings waiApp
51− _ -> runSettings settings waiApp
52−
53−backupApp :: Application
54−backupApp _ respond = respond $ responseLBS status400 [] "Not a WebSocket request"
28+ --this built-in server is apparently not meant for production use, but it's easier to test than starting up the wai or snap interfaces
29+ WS.runServer wsHost (fromIntegral wsPort) (websocketProxyServer port serverHost)
5530
56−warpSettings :: HostName -> Port -> Settings
57−warpSettings host port =
58− setHost (fromString host)
59− . setPort port
60− . setServerName "project-m36"
61− . setTimeout 3600
62− . setGracefulShutdownTimeout (Just 5)
63− $ defaultSettings
src/lib/ProjectM36/Server/Config.hs−6
@@ -12,12 +12,6 @@ data ServerConfig = ServerConfig { persistenceStrategy :: PersistenceStrategy,
1212 }
1313 deriving (Show)
1414
15−data WebsocketServerConfig = WebsocketServerConfig { wsServerConfig :: ServerConfig,
16− tlsCertificatePath :: Maybe String,
17− tlsKeyPath :: Maybe String
18− }
19− deriving (Show)
20−
2115defaultServerConfig :: ServerConfig
2216defaultServerConfig = ServerConfig { persistenceStrategy = NoPersistence,
2317 checkFS = True,
src/lib/ProjectM36/Server/ParseArgs.hs+14−31
@@ -17,14 +17,14 @@ parseArgsWithDefaults defaults = ServerConfig <$>
1717 many parseGhcPkgPath <*>
1818 parseTimeout (perRequestTimeout defaults) <*>
1919 parseTestMode
20−
20+
2121parsePersistenceStrategy :: Parser PersistenceStrategy
2222parsePersistenceStrategy = CrashSafePersistence <$> (dbdirOpt <* fsyncOpt) <|>
2323 MinimalPersistence <$> dbdirOpt <|>
2424 pure NoPersistence
25− where
26− dbdirOpt = strOption (short 'd' <>
27− long "database-directory" <>
25+ where
26+ dbdirOpt = strOption (short 'd' <>
27+ long "database-directory" <>
2828 metavar "DIRECTORY" <>
2929 showDefaultWith show
3030 )
@@ -34,60 +34,43 @@ parsePersistenceStrategy = CrashSafePersistence <$> (dbdirOpt <* fsyncOpt) <|>
3434
3535parseTestMode :: Parser Bool
3636parseTestMode = flag True False (long "test-mode" <> hidden)
37−
38−parseCheckFS :: Parser Bool
37+
38+parseCheckFS :: Parser Bool
3939parseCheckFS = flag True False (long "disable-fscheck" <>
4040 help "Disable filesystem check for journaling.")
41−
41+
4242parseDatabaseName :: Parser DatabaseName
4343parseDatabaseName = strOption (short 'n' <>
4444 long "database" <>
4545 metavar "DATABASE_NAME")
4646
47−parseHostname :: Hostname -> Parser Hostname
47+parseHostname :: Hostname -> Parser Hostname
4848parseHostname defHostname = strOption (short 'h' <>
4949 long "hostname" <>
5050 metavar "HOST_NAME" <>
5151 value defHostname)
52−
52+
5353parsePort :: Port -> Parser Port
5454parsePort defPort = option auto (short 'p' <>
5555 long "port" <>
5656 metavar "PORT_NUMBER" <>
5757 value defPort)
58−
58+
5959parseGhcPkgPath :: Parser String
6060parseGhcPkgPath = strOption (long "ghc-pkg-dir" <>
6161 metavar "GHC_PACKAGE_DIRECTORY")
62−
63−parseTimeout :: Int -> Parser Int
62+
63+parseTimeout :: Int -> Parser Int
6464parseTimeout defTimeout = option auto (long "timeout" <>
6565 metavar "MICROSECONDS" <>
6666 value defTimeout)
6767
6868parseConfig :: IO ServerConfig
6969parseConfig = parseConfigWithDefaults defaultServerConfig
70−
70+
7171parseConfigWithDefaults :: ServerConfig -> IO ServerConfig
7272parseConfigWithDefaults defaults = execParser (info (parseArgsWithDefaults defaults <**> helpOption) idm)
7373
74−parseWSConfigWithDefaults :: ServerConfig -> IO WebsocketServerConfig
75−parseWSConfigWithDefaults defaults = execParser (info (parseWSArgsWithDefaults defaults <**> helpOption) idm)
76−
77−parseWSArgsWithDefaults :: ServerConfig -> Parser WebsocketServerConfig
78−parseWSArgsWithDefaults defaults = WebsocketServerConfig <$>
79− parseArgsWithDefaults defaults <*>
80− parseTlsCertificatePath <*>
81− parseTlsKeyPath
82−
83−
84−parseTlsCertificatePath :: Parser (Maybe String)
85−parseTlsCertificatePath = optional $ strOption (long "tls-certificate-path" <>
86− metavar "TLS_CERTIFICATE_PATH")
87−
88−parseTlsKeyPath :: Parser (Maybe String)
89−parseTlsKeyPath = optional $ strOption (long "tls-key-path" <>
90− metavar "TLS_KEY_PATH")
9174
9275helpOption :: Parser (a -> a)
9376helpOption = abortOption helpText $ mconcat
@@ -97,6 +80,6 @@ helpOption = abortOption helpText $ mconcat
9780 where
9881#if MIN_VERSION_optparse_applicative(0,16,0)
9982 helpText = ShowHelpText Nothing
100−#else
83+#else
10184 helpText = ShowHelpText
10285#endif
src/lib/ProjectM36/Shortcuts.hsdeleted−247
@@ -1,247 +0,0 @@
1−{-# OPTIONS_GHC -fno-warn-orphans #-}
2−{-# LANGUAGE ScopedTypeVariables #-}
3−{-# LANGUAGE TypeApplications #-}
4−{-# LANGUAGE FlexibleInstances #-}
5−{-# LANGUAGE MultiParamTypeClasses #-}
6−{-# LANGUAGE TypeFamilies #-}
7−{-# LANGUAGE ExtendedDefaultRules #-}
8−{-# LANGUAGE ExistentialQuantification #-}
9−{-# LANGUAGE FlexibleContexts #-}
10−{-# LANGUAGE GADTs #-}
11−{-# LANGUAGE UndecidableInstances #-}
12−module ProjectM36.Shortcuts where
13−-- users need OverloadedLabels, OverloadedLists, and default(Int,Text) to use these shortcuts.
14−import Data.Text hiding (foldl, map)
15−import ProjectM36.Base
16−import ProjectM36.Relation
17−import ProjectM36.Atomable
18−import Prelude hiding ((!!))
19−import Data.Proxy
20−import GHC.OverloadedLabels
21−import GHC.TypeLits hiding (Text)
22−import qualified Data.Text as T
23−import qualified Data.Map as M
24−import qualified Data.Set as S
25−import GHC.Exts (IsList(..))
26−import Data.Convertible
27−
28−default (Text)
29−
30−instance IsList (AttributeNamesBase ()) where
31− type Item (AttributeNamesBase ()) = AttributeName
32− fromList = AttributeNames . S.fromList
33− toList (AttributeNames ns) = S.toList ns
34− toList _ = error "needs AttributeNames"
35−
36−instance IsList (TupleExprsBase ()) where
37− type Item TupleExprs = TupleExpr
38− fromList ts = TupleExprs () ts
39− toList (TupleExprs _ ts) = ts
40−
41−instance IsList TupleExpr where
42− type Item TupleExpr = (AttributeName, AtomExpr)
43− fromList attributeValues = TupleExpr (M.fromList attributeValues)
44− toList (TupleExpr attributeValues) = M.toList attributeValues
45−
46−
47−-- #xxx :: Text
48−instance KnownSymbol x => IsLabel x Text where
49− fromLabel = T.pack $ symbolVal @x Proxy
50−
51−-- #relvarName :: RelationalExpr
52−instance KnownSymbol x => IsLabel x RelationalExpr where
53− fromLabel = RelationVariable (T.pack $ symbolVal @x Proxy) ()
54−
55−-- *Main> #a Int :: AttributeExpr
56−-- NakedAttributeExpr (Attribute "a" IntAtomType)
57−-- *Main> #a (Attr @[Int]) :: AttributeExpr
58−-- NakedAttributeExpr (Attribute "a" (ConstructedAtomType "List" (fromList [("a",IntAtomType)])))
59−-- can't offer a Relation atomtype -- don't know how to express a Relation type in haskell type. Maybe something a HList of (Text, a) ?
60−--
61−-- ps. I don't understand the usage of "AttributeAndTypeNameExpr AttributeName TypeConstructor a"
62−instance (KnownSymbol x, Atomable a)=> IsLabel x (HaskAtomType a -> AttributeExpr) where
63− fromLabel = (NakedAttributeExpr . Attribute name) . toAtomType''
64− where name = T.pack $ symbolVal @x Proxy
65−
66−-- (#a 1) :: ExtendTupleExpr
67−-- no need for :=
68−instance (Convertible a AtomExpr, KnownSymbol x) => IsLabel x (a -> ExtendTupleExpr) where
69− fromLabel x = AttributeExtendTupleExpr name (convert x)
70− where name = T.pack $ symbolVal @x Proxy
71−
72−-- #name AtomExpr
73−-- ex. tuple [ #name 3 ]
74−-- default(Text) is needed in client code to avoid `no Atomable Char`
75−instance (Convertible a AtomExpr, KnownSymbol x) => IsLabel x (a -> (AttributeName, AtomExpr)) where
76− fromLabel = \x -> (name, convert x)
77− where name = T.pack $ symbolVal @x Proxy
78−
79−-- *Main> #a [1] :: AtomExpr
80−-- FunctionAtomExpr "a" [NakedAtomExpr (IntegerAtom 1)] ()
81−--
82−-- This usage is not working in RestrictionPredicateExpr and AttributeExtendTupleExpr. Use f "a" [1] instead.
83−instance (KnownSymbol x, Convertible a AtomExpr) => IsLabel x ([a] -> AtomExpr) where
84− fromLabel = \as' -> FunctionAtomExpr name (map convert as') ()
85− where name = T.pack $ symbolVal @x Proxy
86−
87−instance (KnownSymbol x) => IsLabel x AtomExpr where
88− fromLabel = AttributeAtomExpr name
89− where name = T.pack $ symbolVal @x Proxy
90−
91−
92−data HaskAtomType a where
93− Int :: HaskAtomType Int
94− Integer :: HaskAtomType Integer
95− Double :: HaskAtomType Double
96− Text :: HaskAtomType Text
97−-- Day :: HaskAtomType Day
98−-- DateTime :: HaskAtomType DateTime
99−-- ByteString :: HaskAtomType ByteString
100− Bool :: HaskAtomType Bool
101− Attr :: Atomable a => HaskAtomType a -- a Proxy-like value for type application.
102−
103−toAtomType'' :: Atomable a => HaskAtomType a -> AtomType
104−toAtomType'' (_ :: HaskAtomType a) = toAtomType (Proxy @a)
105−
106−-- usage: relation [tuple [#a 1, #b "b"], tuple [#a 2, #b "b"]]
107−relation :: [TupleExpr] -> RelationalExpr
108−relation ts = MakeRelationFromExprs Nothing (TupleExprs () ts)
109−
110−relation' :: [AttributeExprBase ()] -> [TupleExpr] -> RelationalExpr
111−relation' as' ts = MakeRelationFromExprs (Just as') (TupleExprs () ts)
112−
113−-- usage: tuple [#name "Mike",#age 6]
114−tuple :: [(AttributeName, AtomExpr)] -> TupleExprBase ()
115−tuple as' = TupleExpr (M.fromList as')
116−
117−-- #a rename [#b `as` #c]
118−rename :: RelationalExpr -> [(AttributeName,AttributeName)] -> RelationalExpr
119−rename relExpr renameList = case renameList of
120− [] -> Restrict TruePredicate relExpr
121− renames ->
122− foldl (\acc (old,new) -> Rename old new acc) relExpr renames
123−
124−--project !!
125−-- #a !! [#b,#c]
126−infix 9 !!
127−(!!) :: RelationalExpr -> AttributeNames -> RelationalExpr
128−relExpr !! xs = Project xs relExpr
129−
130−--join ><
131−-- #a >< #b
132−(><) :: RelationalExpr -> RelationalExpr -> RelationalExpr
133−a >< b = Join a b
134−
135−allBut :: AttributeNames -> AttributeNames
136−allBut (AttributeNames ns) = InvertedAttributeNames ns
137−allBut _ = error "give allBut something other than attribute names."
138−
139−allFrom :: RelationalExpr -> AttributeNames
140−allFrom = RelationalExprAttributeNames
141−
142−as :: AttributeNames -> AttributeName -> (AttributeNames, AttributeName)
143−as = (,)
144−
145−-- #a `group` ([#b,#c] `as` #d)
146−group :: RelationalExpr -> (AttributeNames, AttributeName) -> RelationalExpr
147−group relExpr (aNames, aName) = Group aNames aName relExpr
148−
149−-- #a `ungroup` #b
150−ungroup :: RelationalExpr -> AttributeName -> RelationalExpr
151−ungroup relExpr aName = Ungroup aName relExpr
152−
153−-- *Main> #a #:= true #: ( #b (f "count" [1,2]))
154−-- Assign "a" (Extend (AttributeExtendTupleExpr "b" (FunctionAtomExpr "count" [NakedAtomExpr (IntegerAtom 1),NakedAtomExpr (IntegerAtom 2)] ())) (ExistingRelation (Relation attributesFromList [] (RelationTupleSet {asList = [RelationTuple attributesFromList [] []]}))))
155−(#:) :: RelationalExpr -> ExtendTupleExpr -> RelationalExpr
156−a #: b = Extend b a
157−infix 8 #:
158−
159−instance Convertible AtomExpr AtomExpr where
160− safeConvert n = Right n
161−
162−instance Convertible RelVarName AtomExpr where
163− safeConvert n = Right $ RelationAtomExpr (RelationVariable n ())
164−
165−instance Convertible RelationalExpr AtomExpr where
166− safeConvert relExpr = Right $ RelationAtomExpr relExpr
167−
168−instance Convertible RelVarName RelationalExpr where
169− safeConvert n = Right $ RelationVariable n ()
170−
171−-- @ in tutd
172−-- (@@) "aaa"
173−(@@) :: AttributeName -> AtomExpr
174−(@@) = AttributeAtomExpr
175−
176−-- works in RestrictedPredicateExpr and AttributeExtendTupleExpr
177−-- usage: f "gte" [1]
178−f :: Convertible a AtomExpr => AtomFunctionName -> [a] -> AtomExpr
179−f n as' = FunctionAtomExpr n (map convert as') ()
180−
181−-- DatabaseContextExpr
182−-- define
183−(#::) :: RelVarName -> [AttributeExpr] -> DatabaseContextExpr
184−s #:: xs = Define s xs
185−infix 5 #::
186−
187−-- assign
188−(#:=) :: RelVarName -> RelationalExpr -> DatabaseContextExpr
189−s #:= r = Assign s r
190−infix 5 #:=
191−
192−class Boolean a b where
193− (&&&) :: a -> b -> RestrictionPredicateExpr
194− infixl 6 &&&
195− (|||) :: a -> b -> RestrictionPredicateExpr
196− infixl 5 |||
197−
198−-- where: @~ mimics the restriction symbol in algebra
199−-- usage: true #: (#a 1) @~ #a ?= 1 &&& not' false ||| (f "gte" [1])
200−(@~) :: Convertible a RestrictionPredicateExpr => RelationalExpr -> a -> RelationalExpr
201−(@~) relExpr resPreExpr = Restrict (convert resPreExpr) relExpr
202−infix 4 @~
203−
204−true :: RelationalExpr
205−true = ExistingRelation relationTrue
206−
207−false :: RelationalExpr
208−false = ExistingRelation relationFalse
209−
210−trueP :: RestrictionPredicateExprBase a
211−trueP = TruePredicate
212−
213−falseP :: RestrictionPredicateExprBase a
214−falseP = NotPredicate TruePredicate
215−
216−(?=) :: Convertible a AtomExpr => AttributeName -> a -> RestrictionPredicateExpr
217−(?=) name a = AttributeEqualityPredicate name (convert a)
218−infix 9 ?=
219−
220−not' :: Convertible a RestrictionPredicateExpr => a -> RestrictionPredicateExpr
221−not' = NotPredicate . convert
222−
223−instance (Convertible a RestrictionPredicateExpr, Convertible b RestrictionPredicateExpr) => Boolean a b where
224− a &&& b = AndPredicate (convert a) (convert b)
225− a ||| b = OrPredicate (convert a) (convert b)
226−
227−instance {-# Incoherent #-} Atomable a => Convertible a RestrictionPredicateExpr where
228− safeConvert n = Right $ AtomExprPredicate $ toAtomExpr . toAtom $ n
229−
230−instance {-# Incoherent #-} Convertible RelationalExpr RestrictionPredicateExpr where
231− safeConvert a = Right $ RelationalExprPredicate a
232−
233−instance {-# Incoherent #-} Convertible AtomExpr RestrictionPredicateExpr where
234− safeConvert a = Right $ AtomExprPredicate a
235−
236−instance {-# Incoherent #-} Convertible RestrictionPredicateExpr RestrictionPredicateExpr where
237− safeConvert a = Right a
238−
239−instance {-# Incoherent #-} Atomable a => Convertible a AtomExpr where
240− safeConvert n = Right $ toAtomExpr . toAtom $ n
241−
242−toAtomExpr :: Atom -> AtomExpr
243−toAtomExpr (ConstructedAtom n _ xs) = ConstructedAtomExpr n (toAtomExpr <$> xs) ()
244−toAtomExpr a = NakedAtomExpr a
245−
246−
247−
stack.ghc8.10.yamldeleted−19
@@ -1,19 +0,0 @@
1−resolver: lts-17.13
2−packages:
3− - "."
4−
5−extra-deps:
6− - git: https://github.com/agentm/curryer.git
7− commit: 74ecaac619ad1165a4517d5c0f4e530493bda130
8− - git: https://github.com/composewell/streamly.git
9− commit: ac3af8749194f1788704dda8667d0b3807075cc2
10− - fast-builder-0.1.2.1
11− - rset-1.0.0
12− - winery-1.3.2
13− - barbies-th-0.1.8
14− - base16-bytestring-1.0.1.0
15−
16−flags:
17− project-m36:
18− stack: true
19−# allow-newer: true
stack.ghc8.6.yaml+24−24
@@ -6,32 +6,32 @@ resolver: lts-14.27
66
77# Local packages, usually specified by relative directory name
88packages:
9− - "."
9+- '.'
1010# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
1111extra-deps:
12− - git: https://github.com/agentm/curryer.git
13− commit: 74ecaac619ad1165a4517d5c0f4e530493bda130
14− - git: https://github.com/composewell/streamly.git
15− commit: ac3af8749194f1788704dda8667d0b3807075cc2
16− - fast-builder-0.1.2.1
17− - winery-1.3.2
18− - barbies-2.0.2.0
19− - barbies-th-0.1.7
20− - extended-reals-0.2.3.0
21− - data-interval-2.0.1
22− - stm-containers-1.1.0.4
23− - stm-hamt-1.2.0.4
24− - rset-1.0.0
25− - hashable-time-0.2.0.2
26− - network-transport-tcp-0.6.0
27− - megaparsec-7.0.5
28− - prettyprinter-1.7.0
29− - prettyprinter-ansi-terminal-1.1.2
30− - fusion-plugin-types-0.1.0
31− - base16-bytestring-1.0.1.0
32− - modern-uri-0.3.4.0
33− - cryptohash-sha256-0.11.102.0
34− - http-types-0.12.3
12+- git: https://github.com/agentm/curryer.git
13+ commit: 28ff1d031078af4a17fa326d43340474571df0c3
14+- git: https://github.com/composewell/streamly.git
15+ commit: ac3af8749194f1788704dda8667d0b3807075cc2
16+- fast-builder-0.1.2.1
17+- winery-1.3.2
18+- barbies-2.0.2.0
19+- barbies-th-0.1.7
20+- extended-reals-0.2.3.0
21+- data-interval-2.0.1
22+- stm-containers-1.1.0.4
23+- stm-hamt-1.2.0.4
24+- rset-1.0.0
25+- hashable-time-0.2.0.2
26+- network-transport-tcp-0.6.0
27+- megaparsec-7.0.5
28+- prettyprinter-1.7.0
29+- prettyprinter-ansi-terminal-1.1.2
30+- fusion-plugin-types-0.1.0
31+- base16-bytestring-1.0.1.0
32+- modern-uri-0.3.4.0
33+- cryptohash-sha256-0.11.102.0
34+- http-types-0.12.3
3535
3636# Override default flag values for local packages and extra-deps
3737flags:
stack.ghc8.8.yaml+24−24
@@ -6,32 +6,32 @@ resolver: lts-16.4
66
77# Local packages, usually specified by relative directory name
88packages:
9− - "."
9+- '.'
1010# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
1111extra-deps:
12− - git: https://github.com/agentm/curryer.git
13− commit: 74ecaac619ad1165a4517d5c0f4e530493bda130
14− - git: https://github.com/composewell/streamly.git
15− commit: ac3af8749194f1788704dda8667d0b3807075cc2
16− - fast-builder-0.1.2.1
17− - winery-1.3.2
18− - barbies-2.0.2.0
19− - barbies-th-0.1.7
20− - extended-reals-0.2.3.0
21− - data-interval-2.0.1
22− - stm-containers-1.1.0.4
23− - stm-hamt-1.2.0.4
24− - rset-1.0.0
25− - hashable-time-0.2.0.2
26− - network-transport-tcp-0.7.0
27− - megaparsec-7.0.5
28− - network-2.8.0.1
29− - primitive-extras-0.8
30− - primitive-unlifted-0.1.3.0
31− - prettyprinter-1.7.0
32− - prettyprinter-ansi-terminal-1.1.2
33− - base16-bytestring-1.0.1.0
34− - modern-uri-0.3.4.0
12+- git: https://github.com/agentm/curryer.git
13+ commit: 28ff1d031078af4a17fa326d43340474571df0c3
14+- git: https://github.com/composewell/streamly.git
15+ commit: ac3af8749194f1788704dda8667d0b3807075cc2
16+- fast-builder-0.1.2.1
17+- winery-1.3.2
18+- barbies-2.0.2.0
19+- barbies-th-0.1.7
20+- extended-reals-0.2.3.0
21+- data-interval-2.0.1
22+- stm-containers-1.1.0.4
23+- stm-hamt-1.2.0.4
24+- rset-1.0.0
25+- hashable-time-0.2.0.2
26+- network-transport-tcp-0.7.0
27+- megaparsec-7.0.5
28+- network-2.8.0.1
29+- primitive-extras-0.8
30+- primitive-unlifted-0.1.3.0
31+- prettyprinter-1.7.0
32+- prettyprinter-ansi-terminal-1.1.2
33+- base16-bytestring-1.0.1.0
34+- modern-uri-0.3.4.0
3535
3636# Override default flag values for local packages and extra-deps
3737flags:
test/TutorialD/InterpreterTest.hs → test/TutorialD/Interpreter.hsrenamed

The content is the same.

test/TutorialD/Interpreter/Import/ImportTest.hs → test/TutorialD/Interpreter/Import/TutorialD.hsrenamed+1−1
@@ -31,7 +31,7 @@ testTutdFileImport = TestCase $
3131 Assign "y" (MakeRelationFromExprs Nothing
3232 $ TupleExprs () [TupleExpr (M.fromList [("b", NakedAtomExpr (TextAtom "漢字"))])])]
3333 --on Windows, the file URI should not include the drive letter "/c/Users..." -> "/Users"
34− let uri = "file://" <> map (\c -> if c == '\\' then '/' else c) ( joinDrive "/" (dropDrive tempPath))
34+ let uri = "file://" <> map (\c -> if c == '\\' then '/' else c) ( joinDrive "/" (dropDrive (tempPath)))
3535 fileURI <- mkURI (T.pack uri)
3636 imported <- importTutorialDFromFile fileURI Nothing
3737 assertEqual "import tutd" (Right expectedExpr) imported
test/TutorialD/PrinterTest.hs → test/TutorialD/Printer.hsrenamed

The content is the same.