Skip to content

Commit 7546490

Browse files
committed
* Drop TypeCompose as a dependency,
and use Data.Functor.Compose from base. * use hpack to generate cabal * build with Nix * bump stack to use lts-20.4 * bump version to 0.5.0.2
1 parent 22afc3e commit 7546490

14 files changed

+480
-90
lines changed

.envrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
if ! has nix_direnv_version || ! nix_direnv_version 2.2.0; then
2+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.0/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc="
3+
fi
4+
5+
nix_direnv_watch_file devenv.nix
6+
nix_direnv_watch_file devenv.lock
7+
nix_direnv_watch_file devenv.yaml
8+
use flake . --impure

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
dist
22
.stack-work
3+
.devenv

changelog.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
HEAD
2+
- Drop TypeCompose dependency
23
- Reorganize directory structure and make typed interface the central one.
34
- Add serialise instances.
45
- Drop Generic/Generic1/Typeable/Typeable1 instances for older GHCs

default.nix

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
2+
src = builtins.fetchGit ./.;
3+
}).defaultNix

flake.lock

+234
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs?ref=haskell-updates";
4+
devenv.url = "github:cachix/devenv";
5+
nix-filter.url = "github:numtide/nix-filter";
6+
};
7+
8+
outputs = { self, nixpkgs, devenv, nix-filter, ... }@inputs:
9+
with nix-filter.lib;
10+
let
11+
config = { allowBroken = true; };
12+
overlays.default = final: previous: {
13+
haskellPackages = with final.haskell.lib;
14+
previous.haskellPackages.extend (hfinal: hprevous:
15+
with hfinal; {
16+
spatial-math = callCabal2nix "spatial-math" (filter {
17+
root = self;
18+
exclude = [ "stack.yaml" (matchExt "cabal") ];
19+
}) { };
20+
});
21+
};
22+
systems = [
23+
"x86_64-linux"
24+
# "i686-linux"
25+
"x86_64-darwin"
26+
# "aarch64-linux"
27+
# "aarch64-darwin"
28+
];
29+
forAllSystems = f:
30+
builtins.listToAttrs (map (name: {
31+
inherit name;
32+
value = f name;
33+
}) systems);
34+
in {
35+
inherit overlays;
36+
packages = forAllSystems (system:
37+
let
38+
pkgs = import nixpkgs {
39+
inherit config system;
40+
overlays = [ overlays.default ];
41+
};
42+
in {
43+
default = pkgs.haskellPackages.spatial-math;
44+
});
45+
devShells = forAllSystems (system:
46+
let
47+
pkgs = import nixpkgs {
48+
inherit config system;
49+
overlays = [ overlays.default ];
50+
};
51+
in {
52+
default = devenv.lib.mkShell {
53+
inherit inputs pkgs;
54+
modules = with pkgs.haskellPackages; with pkgs; [{
55+
env = { name = "spatial-math"; };
56+
packages =
57+
[ (ghcWithPackages (p: with p; [ haskell-language-server spatial-math ])) ];
58+
scripts = {
59+
run-ghcid.exec = "${ghcid}/bin/ghcid -W -a -c 'cabal repl lib:spatial-math'";
60+
setUp.exec = ''
61+
${hpack}/bin/hpack -f package.yaml
62+
${implicit-hie}/bin/gen-hie --cabal &> hie.yaml
63+
'';
64+
};
65+
enterShell = "
66+
setUp
67+
";
68+
}];
69+
};
70+
});
71+
};
72+
}

package.yaml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: spatial-math
2+
version: 0.5.0.2
3+
synopsis: 3d math including quaternions/euler angles/dcms and utility functions
4+
license: BSD3
5+
license-file: LICENSE
6+
author: Greg Horn
7+
maintainer: [email protected]
8+
copyright: Copyright (c) 2012-2019, Greg Horn
9+
category: Math
10+
github: ghorn/spatial-math
11+
tested-with: GHC==9.2
12+
13+
extra-source-files:
14+
- README.md
15+
- changelog.txt
16+
17+
library:
18+
source-dirs: src
19+
dependencies:
20+
- base
21+
- ghc-prim
22+
- cereal
23+
- binary
24+
- serialise
25+
- linear
26+
- lens
27+
ghc-options: -Wall -Werror
28+
29+
tests:
30+
doctests:
31+
main: doctests.hs
32+
source-dirs: tests
33+
when:
34+
- condition: false
35+
other-modules: Main
36+
dependencies:
37+
- base
38+
- doctest
39+
ghc-options: -O2 -threaded -Wall -Werror
40+
build-tools: doctest-discover
41+
42+
unit-tests:
43+
main: Main.hs
44+
source-dirs: tests
45+
dependencies:
46+
- base
47+
- spatial-math
48+
- QuickCheck
49+
- test-framework
50+
- test-framework-quickcheck2
51+
ghc-options: -O2 -Wall -Werror

shell.nix

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
2+
src = builtins.fetchGit ./.;
3+
}).shellNix

0 commit comments

Comments
 (0)