Skip to content

Instantly share code, notes, and snippets.

➜ sandbox stack new exp-eval simple
Downloading template "simple" to create project "exp-eval" in exp-eval/ ...
The following parameters were needed by the template but not provided: category, copyright, github-username
You can provide them in /home/wizek/.stack/config.yaml, like this:
templates:
params:
category: value
copyright: value
github-username: value
Or you can pass each one as parameters like this:
@Wizek
Wizek / gist:c8e5e3ee473bd8e07e55
Created February 8, 2016 15:40
haskell stack: hspec trace prof bug
➜ foo-proj git:(master) ✗ stack test --trace
foo-proj-0.1.0: test (suite: spec, args: " +RTS " " -xc " )
spec: unexpected argument ` +RTS '
Try `spec --help' for more information.
Test suite failure for package foo-proj-0.1.0
spec: exited with: ExitFailure 1
Logs printed to console
➜ syntax-example-json-1.0.0.0 ll -a
total 32K
drwxrwxr-x 3 wizek wizek 4,0K jan 24 09:50 .
drwxrwxr-x 4 wizek wizek 4,0K jan 22 22:53 ..
-rw-rw-r-- 1 wizek wizek 1,4K jan 22 23:03 cabal.sandbox.config
drwxr-xr-x 2 wizek wizek 4,0K jan 22 22:57 dist
-rw-rw-r-- 1 wizek wizek 1,1K jan 22 22:53 LICENSE
-rw-rw-r-- 1 wizek wizek 3,9K jan 22 22:53 Main.hs
-rw-rw-r-- 1 wizek wizek 46 jan 22 22:53 Setup.hs
-rw-rw-r-- 1 wizek wizek 1,2K jan 22 22:53 syntax-example-json.cabal
@Wizek
Wizek / .hs
Last active January 21, 2016 11:36
main = do
putStrLn "main"
middleware handler
middleware cont = do
putStrLn "middleware"
let a = 123
cont
handler = do

How to install stack on FreeBSD?

Just build from source. Really, it works quite well, try it.

git clone ...
cd ...
pkg install hs-cabal-install
cabal install
~/.cabal/bin/stack --version
@Wizek
Wizek / value.js
Last active October 20, 2015 17:32
consumerreports.org calculate $/points for each item in the row, to see which item provides the most value for the buck
// ==UserScript==
// @name Consumer Reports -- most value for the money
// @namespace http://your.homepage/
// @version 0.1
// @description enter something useful
// @author You
// @match http://www.consumerreports.org/cro/*
// @grant none
// ==/UserScript==
@Wizek
Wizek / firebase_copy.js
Last active August 2, 2016 21:42 — forked from katowulf/firebase_copy.js
Move or copy a Firebase path to a new location
function copyFbRecord(oldRef, newRef) {
oldRef.once('value', function(snap) {
newRef.set( snap.value(), function(error) {
if( error && typeof(console) !== 'undefined' && console.error ) { console.error(error); }
});
});
}
@Wizek
Wizek / cabal-install-save
Last active August 29, 2015 14:27
`npm install --save package-name` functionality for `cabal`. Usage: `cabal-install-save package-name`
#!/bin/zsh
name=$1
function latestVersionOfPackage () {
cabal info "$1" \
| grep -Pzo 'Versions available:(.|\n)*?:' \
| head -n-1 \
| tail -n1 \
| sed -r 's/.*? ([0-9.]+)\s*(\(and [0-9]+ others\))?\s*?/\1/'
@Wizek
Wizek / rc.js
Last active August 29, 2015 14:27
.jsrc
function c () {
console.log.apply(console, arguments)
return arguments[arguments.length-1]
}
var unboundSlice = Array.prototype.slice
var slice = Function.prototype.call.bind(unboundSlice)
@Wizek
Wizek / decision.user.js
Last active May 14, 2016 09:38
Advanced Pro-Con Decision helper for WorkFlowy; decision, workflowy, score summary, hierarchical data binding, searches for matching {{ decisionCount(children) }}, with radius and confidence%
// ==UserScript==
// @name Advanced Pro-Con Decision helper for WorkFlowy
// @description If you write `{{ decisionCount(children) }}` somewhere, this script will sum up `(+)`s, `(-)`s `(+2.3)`s and similar in all children, helping you weigh pros vs cons.
// @match https://workflowy.com/*
// @version v0.3.1
// @grant none
// @namespace https://gist.github.com/Wizek/d35c16ec23bff0dd2fb1
// @downloadURL https://gist.github.com/Wizek/d35c16ec23bff0dd2fb1/raw/decision.user.js
// @require https://cdnjs.cloudflare.com/ajax/libs/ramda/0.17.1/ramda.min.js