mirror of
https://github.com/maciej-bendkowski/generic-boltzmann-brain.git
synced 2024-11-22 10:51:19 +03:00
Compare commits
3 Commits
dcaed6a163
...
23f9f07c3a
Author | SHA1 | Date | |
---|---|---|---|
|
23f9f07c3a | ||
|
986eb9766b | ||
|
135133db2c |
22
default.nix
Normal file
22
default.nix
Normal file
@ -0,0 +1,22 @@
|
||||
{ mkDerivation, base, containers, mtl, multiset, process
|
||||
, lib, tasty, tasty-hunit
|
||||
# python package needed at test and run time, undeclared in .cabal file
|
||||
, paganini-hs, paganini
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "generic-boltzmann-brain";
|
||||
version = "0.2.0.0";
|
||||
src = ./.;
|
||||
libraryHaskellDepends = [
|
||||
base containers mtl multiset process tasty tasty-hunit
|
||||
];
|
||||
testHaskellDepends = [
|
||||
base
|
||||
tasty
|
||||
tasty-hunit
|
||||
paganini-hs
|
||||
paganini
|
||||
];
|
||||
homepage = "https://github.com/maciej-bendkowski/generic-boltzmann-brain#readme";
|
||||
license = lib.licenses.bsd3;
|
||||
}
|
95
flake.lock
Normal file
95
flake.lock
Normal file
@ -0,0 +1,95 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1605370193,
|
||||
"narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5021eac20303a61fafe17224c087f5519baed54d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1676150441,
|
||||
"narHash": "sha256-Nfeua9Ua/dGHOQpzOjLtkyMyW/ysQCvZJ9Dd74QQSNk=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6d87734c880d704f6ee13e5c0fe835b98918c34e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1676060830,
|
||||
"narHash": "sha256-OZJKL08qbLW2xMPNPTgidbC25MrkllUonoFs/JOX4y8=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9943fcc75d4e43c3116b408b0f93e682927ffbb4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"paganini-hs": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1676297967,
|
||||
"narHash": "sha256-uN0uDqErRwPkmSQd2Guu6b01HldI8n5KAhdjR0ETEew=",
|
||||
"owner": "maciej-bendkowski",
|
||||
"repo": "paganini-hs",
|
||||
"rev": "214013fdc8aa274d2e92d50484bc0f840bf77f18",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "maciej-bendkowski",
|
||||
"repo": "paganini-hs",
|
||||
"rev": "214013fdc8aa274d2e92d50484bc0f840bf77f18",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"paganini-hs": "paganini-hs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
108
flake.nix
Normal file
108
flake.nix
Normal file
@ -0,0 +1,108 @@
|
||||
{
|
||||
description = "Generic Boltzmann Brain";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
paganini-hs.url = "github:maciej-bendkowski/paganini-hs/214013fdc8aa274d2e92d50484bc0f840bf77f18";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self
|
||||
, nixpkgs
|
||||
, flake-utils
|
||||
, paganini-hs
|
||||
, ...
|
||||
}@inputs:
|
||||
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
|
||||
let
|
||||
|
||||
name = "generic-boltzmann-brain";
|
||||
compiler = "ghc925";
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowBroken = true;
|
||||
allowUnsupportedSystem = true;
|
||||
};
|
||||
};
|
||||
|
||||
optas = p: with p;
|
||||
(
|
||||
buildPythonPackage rec {
|
||||
pname = "optas";
|
||||
version = "1.0.3";
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-92aaW9ZxvRy/dfYhw7IS+lfDAP2UuBuJhNDNTW7Xkzc=";
|
||||
};
|
||||
doCheck = false;
|
||||
}
|
||||
);
|
||||
|
||||
paganini = p: with p;
|
||||
(
|
||||
buildPythonPackage rec {
|
||||
pname = "paganini";
|
||||
version = "1.5.0";
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-hsDqONhBPQlgQHKBh5tdp/pzoXynUz7ztXXILrGgslo=";
|
||||
};
|
||||
doCheck = false;
|
||||
propagatedBuildInputs = [
|
||||
pkgs.python3Packages.numpy
|
||||
pkgs.python3Packages.sympy
|
||||
pkgs.python3Packages.scipy
|
||||
pkgs.python3Packages.networkx
|
||||
pkgs.python3Packages.cvxpy
|
||||
(optas p)
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
pythonPackages = p: with p; [
|
||||
(optas p)
|
||||
(paganini p)
|
||||
];
|
||||
|
||||
haskellPackages = pkgs.haskell.packages.${compiler}.override {
|
||||
overrides = self: super: {
|
||||
"${name}" = (self.callCabal2nix "generic-boltzmann-brain" ./. {}).overrideAttrs(
|
||||
old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [
|
||||
(pkgs.python3.withPackages pythonPackages)
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
paganini-hs = pkgs.haskell.lib.dontCheck (
|
||||
super.callCabal2nix "paganini-hs" paganini-hs {});
|
||||
};
|
||||
};
|
||||
|
||||
devShell = haskellPackages.shellFor {
|
||||
withHoogle = true; # Provides docs, optional.
|
||||
packages = p: [
|
||||
p.generic-boltzmann-brain
|
||||
];
|
||||
buildInputs = [
|
||||
haskellPackages.stack
|
||||
haskellPackages.haskell-language-server
|
||||
haskellPackages.hlint
|
||||
haskellPackages.fourmolu
|
||||
(pkgs.python3.withPackages pythonPackages)
|
||||
];
|
||||
};
|
||||
|
||||
defaultPackage = haskellPackages."${name}";
|
||||
derive = import ./.;
|
||||
|
||||
in
|
||||
{
|
||||
inherit derive defaultPackage devShell;
|
||||
});
|
||||
}
|
@ -5,7 +5,7 @@ cabal-version: 2.0
|
||||
-- see: https://github.com/sol/hpack
|
||||
|
||||
name: generic-boltzmann-brain
|
||||
version: 0.1.0.0
|
||||
version: 0.2.0.0
|
||||
synopsis: Analytic sampler framework for algebraic data types
|
||||
description: Please see the README on GitHub at <https://github.com/maciej-bendkowski/generic-boltzmann-brain#readme>
|
||||
category: Data, Generic, Random
|
||||
|
@ -281,7 +281,7 @@ mkSamplerExp typ = do
|
||||
caseExp <- mkCaseConstr typ
|
||||
|
||||
ub' <- lift $ mkPat "ub"
|
||||
ub <- lift $ pure $ ConP 'MkUpperBound [BangP ub']
|
||||
ub <- lift $ pure $ ConP 'MkUpperBound [] [BangP ub']
|
||||
exp <- lift [|$(pure choiceExp) >>= ($(pure caseExp))|]
|
||||
|
||||
pure $
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: generic-boltzmann-brain
|
||||
version: 0.1.0.0
|
||||
version: 0.2.0.0
|
||||
github: "maciej-bendkowski/generic-boltzmann-brain"
|
||||
license: BSD3
|
||||
author: "Maciej Bendkowski"
|
||||
|
18
stack.yaml
18
stack.yaml
@ -1,21 +1,7 @@
|
||||
resolver:
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/16.yaml
|
||||
|
||||
compiler: ghc-9.0.2
|
||||
|
||||
setup-info:
|
||||
ghc:
|
||||
linux64-tinfo6:
|
||||
9.0.2:
|
||||
url: "https://downloads.haskell.org/ghc/9.0.2/ghc-9.0.2a-x86_64-fedora27-linux.tar.xz"
|
||||
|
||||
resolver: lts-20.11
|
||||
packages:
|
||||
- .
|
||||
|
||||
extra-deps:
|
||||
- criterion-1.5.12.0
|
||||
- testing-feat-1.1.0.0
|
||||
- git: https://github.com/maciej-bendkowski/paganini-hs
|
||||
commit: f6f4f8d26c30544d17eab63583d4ff5e9158d2d9
|
||||
- git: https://github.com/OctopiChalmers/BinderAnn
|
||||
commit: 8f082b23ebd4e79e86e934f41ddfcba59652fadd
|
||||
commit: 214013fdc8aa274d2e92d50484bc0f840bf77f18
|
||||
|
@ -5,45 +5,19 @@
|
||||
|
||||
packages:
|
||||
- completed:
|
||||
pantry-tree:
|
||||
sha256: 92034e3e490c5fe0eab10277f6e35534b37dc0962347025630380c7d37d99ca1
|
||||
size: 2323
|
||||
hackage: criterion-1.5.12.0@sha256:f9c8c0cff7d6796702849258b22df103cde5baa5ee1f085b6b59f37074ec303f,5273
|
||||
original:
|
||||
hackage: criterion-1.5.12.0
|
||||
- completed:
|
||||
pantry-tree:
|
||||
sha256: 444f3c68a4f4fa1488fbbe9e8d9bbcc5f226b12a5027ee93683d5f95bf0ece28
|
||||
size: 790
|
||||
hackage: testing-feat-1.1.0.0@sha256:7c7629c5014edf06aefbf30a061d1ee64c6ee15f438d868e34749fb22208ab0b,2466
|
||||
original:
|
||||
hackage: testing-feat-1.1.0.0
|
||||
- completed:
|
||||
commit: 214013fdc8aa274d2e92d50484bc0f840bf77f18
|
||||
git: https://github.com/maciej-bendkowski/paganini-hs
|
||||
name: paganini-hs
|
||||
pantry-tree:
|
||||
sha256: 0216477ed9bf54790ecfae68d9d28df7e541e03fac1fe600ac7caff72d210cee
|
||||
size: 947
|
||||
commit: f6f4f8d26c30544d17eab63583d4ff5e9158d2d9
|
||||
git: https://github.com/maciej-bendkowski/paganini-hs
|
||||
version: 0.4.0.0
|
||||
sha256: 9450d27c60084eca27044b06e7f7b160a0d23186f9623ff57ae0ecff26cfefef
|
||||
size: 946
|
||||
version: 0.5.0.0
|
||||
original:
|
||||
commit: f6f4f8d26c30544d17eab63583d4ff5e9158d2d9
|
||||
commit: 214013fdc8aa274d2e92d50484bc0f840bf77f18
|
||||
git: https://github.com/maciej-bendkowski/paganini-hs
|
||||
- completed:
|
||||
name: BinderAnn
|
||||
pantry-tree:
|
||||
sha256: 2e2b0b9828f0bd3698344940c4da689947b4530ae75ccc51b03c77db171244e3
|
||||
size: 1631
|
||||
commit: 8f082b23ebd4e79e86e934f41ddfcba59652fadd
|
||||
git: https://github.com/OctopiChalmers/BinderAnn
|
||||
version: 0.1.0.0
|
||||
original:
|
||||
commit: 8f082b23ebd4e79e86e934f41ddfcba59652fadd
|
||||
git: https://github.com/OctopiChalmers/BinderAnn
|
||||
snapshots:
|
||||
- completed:
|
||||
sha256: cdead65fca0323144b346c94286186f4969bf85594d649c49c7557295675d8a5
|
||||
size: 586286
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/16.yaml
|
||||
original:
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/16.yaml
|
||||
sha256: adbc602422dde10cc330175da7de8609e70afc41449a7e2d6e8b1827aa0e5008
|
||||
size: 649342
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/11.yaml
|
||||
original: lts-20.11
|
||||
|
Loading…
Reference in New Issue
Block a user