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
module Main where
import Control.Monad
import Data.List (find)
import Data.Maybe
import Data.Text.Encoding
import Data.ByteString (ByteString)
import Data.Maybe
import Network.URI (parseURI, URI)
import Network.HTTP
@bennofs
bennofs / Error message
Created July 12, 2013 10:18
Template Haskell: Generate unique data type names
ghci -ddump-splices test2.hs 12:17:44
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 2] Compiling THTest ( THTest.hs, interpreted )
[2 of 2] Compiling Test ( test2.hs, interpreted )
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
@bennofs
bennofs / gist:6663255
Created September 22, 2013 20:02
emacs config
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; environment
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(add-to-list 'load-path "~/.emacs.d/plugins")
(require 'sticky-windows)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
{ cabal, Cabal, doctest, filepath, hackageDb, HTTP, mtl, regexPosix
}:
cabal.mkDerivation (self: {
pname = "cabal2nix";
version = "1.58";
src = "./.";
isLibrary = false;
isExecutable = true;
buildDepends = [ Cabal filepath hackageDb HTTP mtl regexPosix ];
@bennofs
bennofs / profunctors.lhs
Created April 11, 2014 19:06
Profunctor lenses
Profunctor lenses
=================
First, we enable the RankNTypes extension which gives us 'forall' and also import some modules:
> {-# LANGUAGE RankNTypes #-}
> module ProfunctorLenses where
> import Data.Profunctor
> import Data.Tagged
> import Data.Bifunctor
@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"