Skip to content

Instantly share code, notes, and snippets.

View bennofs's full-sized avatar
🎯
Focusing

Benno Fünfstück bennofs

🎯
Focusing
View GitHub Profile
@bennofs
bennofs / Setup.hs
Last active August 29, 2015 14:01
Cabal multiple dependencies with same version
import Distribution.Simple
main = defaultMain
@bennofs
bennofs / gist:b79304aebcd9c4d61568
Last active August 29, 2015 14:04 — forked from narayandesai/gist:5de29170207396c98108
Use '' and not " to quote the string. This allows to use " inside without escaping
{stdenv, bash, jre, spark} :
stdenv.mkDerivation rec {
name = "mesos-spark-${version}";
version = "1";
unpackPhase = "true";
installPhase = ''
set -x
import Control.Exception
import Control.Monad
import Control.DeepSeq
main = forM_ (permute "laeioslaeioslaeios") putStrLn
leet :: Char -> String
leet 'e' = "e3"
leet 'a' = "a4"
leet 'A' = "A4"
@bennofs
bennofs / cabal repl v2 log
Created August 21, 2014 10:47
Source repo: https://github.com/jwiegley/hnix Cabal version 1.20.0.2 cabal-install 1.20.0.3
$ cabal clean
$ cabal repl -v2
Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/ghc --numeric-version
looking for tool ghc-pkg near compiler in
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin
found ghc-pkg in
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/ghc-pkg
/nix/store/dbrx6x3238hr8j07ys5n5jcy8012q9n3-ghc-7.8.3-wrapper/bin/ghc-pkg --version
@bennofs
bennofs / Foo.hs
Created August 21, 2014 10:56
cabal repl always builds library
module Foo where
foo :: IO ()
foo = putStrLn "bar"
@bennofs
bennofs / default.nix
Created August 26, 2014 10:04
create file in nix store in builder
with (import <nixpkgs> {});
derivation {
name = "b";
builder = "${bash}/bin/bash";
args = ["-c" "echo 3 > /nix/store/foo; read foo < /nix/store/foo; echo $foo > $out"];
system = "${builtins.currentSystem}";
}
{-# LANGUAGE OverloadedStrings #-}
module Downloader where
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Resource
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as C8
import Data.Conduit
import qualified Data.Conduit.Binary as CB
@bennofs
bennofs / default.nix
Last active August 29, 2015 14:10 — forked from JLimperg/default.nix
# This file was auto-generated by cabal2nix. Please do NOT edit manually!
{ cabal, convertible, exceptions, HDBC, HDBCSqlite3, monadHdbc, mtl
, options, text, time, transformers
}:
cabal.mkDerivation (self: {
pname = "scrumgr";
version = "0.1.0.0";
src = ./.;
@bennofs
bennofs / Compiling
Last active August 29, 2015 14:15
Concurrency and the FFI
$ gcc -c -o cbit.o cbit.c
$ ghc -threaded --make ffi.hs cbit.o -rtsopts
@bennofs
bennofs / shell.nix
Last active August 29, 2015 14:20
HaskellNG: override hakyll without patch
let
nixpkgs = import <nixpkgs> {};
haskellNg = nixpkgs.pkgs.haskell-ng;
# hopefully temporary, but ghc 7.8 fails because of non-deterministic builds (of GHC)
ghc710 = haskellNg.packages.ghc7101;
fixedHakyll = ghc710.hakyll.override { inherit (ghc710) mkDerivation; };
pkg = ghc710.callPackage ./. {
hakyll = fixedHakyll;
};
in nixpkgs.lib.overrideDerivation pkg.env (old:{