Skip to content

Instantly share code, notes, and snippets.

@chrisdone
chrisdone / README.md
Last active May 8, 2022 12:29
Template Haskell quickstart

Template Haskell Quick Start

Use the template haskell (abbreviated to "TH") extension in a module with:

{-# LANGUAGE TemplateHaskell #-}

There are a few key pieces of syntax:

@chrisdone
chrisdone / maintainer.txt
Created June 10, 2019 16:25
Maintainer output
$ stack exec maintainer
Downloading https://api.github.com/user/repos?per_page=100&page=1
Downloading https://api.github.com/user/repos?per_page=100&page=2
Downloading https://api.github.com/user/repos?per_page=100&page=3
Downloading https://api.github.com/user/repos?per_page=100&page=4
Downloading https://api.github.com/user/repos?per_page=100&page=5
Downloading https://api.github.com/repos/haskell-perf/checklist/issues?state=open&sort=updated&direction=asc&per_page=100&page=1
Downloading https://api.github.com/repos/fpco/halogen-form/issues?state=open&sort=updated&direction=asc&per_page=100&page=1
Downloading https://api.github.com/repos/fpco/haskell.fpcomplete.com/issues?state=open&sort=updated&direction=asc&per_page=100&page=1
Downloading https://api.github.com/repos/fpco/odbc/issues?state=open&sort=updated&direction=asc&per_page=100&page=1
(defvar server)
(progn
(delete-process server)
(let ((coding-system-for-read 'binary))
(setq server
(make-network-process
:name "image-server"
:buffer "*image-server*"
:family 'ipv4
:service 9009
@chrisdone
chrisdone / test.el
Last active June 8, 2019 11:28
Display JPEG image from POST request in *image-output* buffer
(defvar server)
(progn
(delete-process server)
(let ((coding-system-for-read 'binary))
(setq server
(make-network-process
:name "image-server"
:buffer "*image-server*"
:family 'ipv4
:service 9009
{-# LANGUAGE BangPatterns #-}
module Test (it) where
it :: Int
it = fibs Test.!! 49
fibs :: [Int]
fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
@chrisdone
chrisdone / after-boot.txt
Created May 28, 2019 14:30
prana building a regular project with stack
chris@precision:~/Work/chrisdone/prana/test-project$ stack build
array-0.5.2.0: configure
array-0.5.2.0: build
array-0.5.2.0: copy/register
test-project-0: configure (lib)
Configuring test-project-0...
test-project-0: build (lib)
Preprocessing library for test-project-0..
Building library for test-project-0..
[1 of 1] Compiling Test ( Test.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Test.o )
@chrisdone
chrisdone / race-condition.txt
Created May 28, 2019 10:27
nodejs race condition
chris@precision:~$ docker run --rm -it --network host --name graphqcurl -v`pwd`:`pwd` -w`pwd`/server/ hasura/graphql-engine-console-builder:20190515 sh
# npm install -g graphqurl
npm ERR! write after end
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-05-28T10_27_09_410Z-debug.log
#
chris@precision:~$ docker run --rm -it --network host --name graphqcurl -v`p`pwd` -w`pwd`/server/ hasura/graphql-engine-console-builder:20190515 sh
# npm install -g graphqurl
npm ERR! write after end
@chrisdone
chrisdone / timings.txt
Created May 23, 2019 17:41
Building things in prana
chris@precision:~/Work/chrisdone/prana$ time sh prana-ghc/regenerate.sh
+ stack build --test --no-run-tests
prana-interpreter-0: Test running disabled by --no-run-tests flag.
Log files have been written to: /home/chris/Work/chrisdone/prana/.stack-work/logs/
+ rm -r /home/chris/Work/chrisdone/prana/prana-dir/
+ mkdir -p /home/chris/Work/chrisdone/prana/prana-dir/packages/
+ cd /home/chris/Work/chrisdone/prana/ghc-8.4/libraries/ghc-prim/
+ PRANA_DIR=/home/chris/Work/chrisdone/prana/prana-dir/ PRANA_MODE=INSTALL time -p -- ./Setup build --ghc-options=-O0
Preprocessing library for ghc-prim-0.5.2.0..
@chrisdone
chrisdone / ArrayTest.hs
Created May 22, 2019 17:15
Prana primops demo
{-# LANGUAGE MagicHash, UnboxedTuples #-}
-- | Test some of the ops for Array# and MutableArray#.
module ArrayTest where
import GHC.Exts
import GHC.Types (IO(..))
it :: IO (Char, Int, Char)
@chrisdone
chrisdone / errors.txt
Created May 22, 2019 13:00
Hasura console errors
chris@precision:~/Work/hasura/graphql-engine$ docker run --rm -it --network host --name hasura-console -v`pwd`:`pwd` -w`pwd`/console hasura/graphql-engine-console-builder:20190515 sh
# npm install
npm install
npm WARN lifecycle [email protected]~postinstall: cannot run in wd [email protected] webpack --display-error-details --config webpack/prod.config.js (wd=/home/chris/Work/hasura/graphql-engine/console)
npm WARN [email protected] requires a peer of graphql@^0.10.0 || ^0.11.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of less@^2.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 but none is installed. You must install peer de