]> Git — Sourcephile - tmp/julm/symantic-reify.git/commitdiff
add nix files master
authorJulien Moutinho <julm@sourcephile.fr>
Sun, 16 May 2021 04:08:03 +0000 (06:08 +0200)
committerJulien Moutinho <julm@sourcephile.fr>
Sun, 16 May 2021 04:26:04 +0000 (06:26 +0200)
12 files changed:
.envrc [new file with mode: 0644]
.gitignore [new file with mode: 0644]
Examples.hs
Makefile
SemanticAlp.hs
SemanticEval.hs
SemanticSplice.hs
cabal.project [new file with mode: 0644]
default.nix [new file with mode: 0644]
flake.nix [new file with mode: 0644]
shell.nix [new file with mode: 0644]
symantic-reify.cabal [new file with mode: 0644]

diff --git a/.envrc b/.envrc
new file mode 100644 (file)
index 0000000..324cf67
--- /dev/null
+++ b/.envrc
@@ -0,0 +1,12 @@
+use_flake() {
+  watch_file flake.nix
+  watch_file flake.lock
+  watch_file default.nix
+  watch_file shell.nix
+  profile="$(direnv_layout_dir)"/flake-profile
+  mkdir -p "$(direnv_layout_dir)"
+  eval "$(time nix print-dev-env --show-trace --profile "$profile" || echo false)" &&
+  nix-store --add-root "shell.root" --indirect --realise "$profile" &&
+  nix-env --delete-generations +1 --profile "$profile"
+}
+use flake
diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..886d3f4
--- /dev/null
@@ -0,0 +1,16 @@
+*.actual.*
+*.eventlog
+*.eventlog
+*.eventlog.html
+*.eventlog.json
+*.hi
+*.hp
+*.o
+*.prof
+*.root
+.direnv/
+.ghc.environment.*
+.stack-work/
+dist-newstyle/
+dump-core/
+result*
index 776de876a4ede5f9b220a704f76b3921a0f67f72..bbda619d5e903c1036ec588eea1658d58901a3dd 100644 (file)
@@ -7,8 +7,8 @@ module Examples where
 -- Their only constraint is to have only arguments whose type is *polymorphic*
 -- (possibly with contraints or type parameters though).
 
--- Note the beta-reductible 'w', it will be normalized-out.
-e0 = \x y z -> x / y + y + 2 * z + (\w -> y) z
+-- Note the beta-reductible '_w', it will be normalized-out.
+e0 = \x y z -> x / y + y + 2 * z + (\_w -> y) z
 
 -- Note that 'f' is a function: arguments can be functions.
 e1 = \f x -> f x
index 82149447b2b368de94df06ce6eba480905a049ac..7825d535176bdb04663135f3a30ae731446d8f1a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 all:
-       runhaskell Main.hs
-ghcid:
-       ghcid -c 'ghci Main.hs -ignore-dot-ghci -package template-haskell' --reverse-errors
+       cabal run
 ghci:
-       ghci -package template-haskell Main.hs
+       cabal repl
+ghcid:
+       ghcid -c 'cabal repl --ghc-options -ignore-dot-ghci' --reverse-errors
index ad350a3844eade1d992d7eeac10dc623f9a22401..0e22317a37c763343dc7729e32e91bff50ebcd2f 100644 (file)
@@ -1,8 +1,9 @@
+{-# OPTIONS_GHC -Wno-orphans #-}
 -- | Semantics for Alp's Expr
 module SemanticAlp where
 
 import Syntax
-import qualified Control.Monad.State.Strict as MT
+import qualified Control.Monad.Trans.State.Strict as MT
 
 -- | An untyped expression.
 -- This is only to keep Alp's initial algebra for the demo.
index a20b60504c83b9b641bb200f5b6df6f8eff3dd35..999ac74ce6bb64013432fec9210afe46107a8bb3 100644 (file)
@@ -1,3 +1,4 @@
+{-# OPTIONS_GHC -Wno-orphans #-}
 -- | Semantics for Identity (aka. R, or meta-circular representation).
 module SemanticEval where
 
index fc7f198b2e59616d7ddb23f2c9ff633ddfbc563f..f5d71d9af3b61a139f354f5e6bfd210528631682 100644 (file)
@@ -1,5 +1,6 @@
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
 -- | Semantics for TemplateHaskell
 module SemanticSplice where
 
diff --git a/cabal.project b/cabal.project
new file mode 100644 (file)
index 0000000..dc68224
--- /dev/null
@@ -0,0 +1 @@
+packages:.
diff --git a/default.nix b/default.nix
new file mode 100644 (file)
index 0000000..d2821c1
--- /dev/null
@@ -0,0 +1,27 @@
+{ pkgs ? import <nixpkgs> {}
+, ghc ? "ghc901"
+, withHoogle ? false
+}:
+let
+  haskellPackages =
+    if ghc == null
+    then pkgs.haskellPackages
+    else pkgs.haskell.packages.${ghc};
+  hs = haskellPackages.extend (with pkgs.haskell.lib; hself: hsuper:
+    {
+      symantic-reify = buildFromSdist (hself.callCabal2nix "symantic-reify" ./. {});
+    }
+  );
+in hs.symantic-reify // {
+  shell = hs.shellFor {
+    doBenchmark = true;
+    packages = p: [ p.symantic-reify ];
+    nativeBuildInputs = [
+      hs.cabal-install
+      hs.ghcid
+    ];
+    buildInputs = [
+    ];
+    inherit withHoogle;
+  };
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644 (file)
index 0000000..494305f
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,12 @@
+{
+inputs.nixpkgs.url = "flake:nixpkgs";
+inputs.flake-utils.url = "github:numtide/flake-utils";
+outputs = inputs:
+  inputs.flake-utils.lib.eachDefaultSystem (system: let
+    pkgs = inputs.nixpkgs.legacyPackages.${system};
+    in {
+      defaultPackage = import ./default.nix { inherit pkgs; };
+      devShell = (import ./default.nix { inherit pkgs; }).shell;
+    }
+  );
+}
diff --git a/shell.nix b/shell.nix
new file mode 100644 (file)
index 0000000..0d9af5e
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1 @@
+(import ./. {}).shell
diff --git a/symantic-reify.cabal b/symantic-reify.cabal
new file mode 100644 (file)
index 0000000..e6660c6
--- /dev/null
@@ -0,0 +1,32 @@
+cabal-version: 3.0
+name: symantic-reify
+version: 0.0.0
+tested-with: GHC==9.0.1
+
+executable symantic-preify
+  type: exitcode-stdio-1.0
+  default-language: Haskell98
+  ghc-options:
+    -Wall
+    -Wincomplete-uni-patterns
+    -Wincomplete-record-updates
+    -Wpartial-fields
+    -Wno-type-defaults
+    -Wno-missing-signatures
+    -fprint-potential-instances
+  main-is: Main.hs
+  other-modules:
+    Examples
+    Reify
+    SemanticAlp
+    SemanticEval
+    SemanticSplice
+    Syntax
+    Tests
+    TestsSplice
+  ghc-options:
+    -- -O2 -fno-enable-th-splice-warnings
+  build-depends:
+    base >= 4.6 && < 5,
+    template-haskell >= 2.16,
+    transformers >= 0.5