Notes aren’t a record of my thinking process. They are my thinking process. – Richard Feynman
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE NumericUnderscores #-} | |
module Main where | |
import Database.PostgreSQL.Simple | |
import Control.Monad | |
import qualified Data.Text as Text | |
import Data.Time | |
import qualified GHC.Clock as Clock |
haskell-mode-minimal.el:
(require 'use-package)
(setq eval-expression-print-length 100)
(use-package haskell-interactive-mode)
(use-package haskell-mode
:mode "\\.hs\\'"
:hook
(haskell-mode . interactive-haskell-mode)
I get output like:
/tmp $ stack exec --resolver lts-17.5 --package resource-pool --package stm --package hslogger --package time --package concurrent-output -- ghc -O2 -threaded -fwarn-unused-imports testpool.hs && ./testpool
acquire 0 - .81428
acquire 1 - .81431
acquire 2 - .81438
acquire 3 - .81440
acquire 4 - .81448
ThreadId 8: processing 1 - .82460
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM haskell:8.10 | |
RUN apt-get update && apt-get install --yes libpq-dev | |
ARG USER=haskell | |
RUN useradd --create-home "$USER" | |
USER $USER |
There are numerous options for using nix with Haskell, which themselves have numerous options:
generate with cabal2nix per 15.9.3.1. How to build a stand-alone project
Sadly, there aren’t instructions on adding a source override for this method and it instead switches to using developPackage
use developPackage
per 15.9.4.4. How to specify source overrides for your Haskell package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Command | |
# nix-build diagrams-builder.nix | |
# Error | |
# | |
# Setup: Encountered missing or private dependencies: | |
# haskell-src-exts ==1.22.* | |
# builder for '/nix/store/9mwklkck5gjjd0adk2jdkrm5zbhyy16b-haskell-src-exts-simple-1.22.0.0.drv' failed with exit code 1 | |
# cannot build derivation '/nix/store/iw613czqivarhr12xbgj8rri7j4m0w8x-diagrams-builder.drv': 1 dependencies couldn't be built |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run with: | |
# export HOME=$(pwd) | |
# nix-shell --pure emacs.nix --keep HOME --run "env HOME=$HOME emacs --eval='(load \"$HOME/init.el\")'" | |
{ pkgs ? (builtins.fetchGit { | |
name = "nixpkgs-unstable-2020-04-14"; | |
url = "https://github.com/NixOS/nixpkgs.git"; | |
ref = "nixpkgs-unstable"; | |
rev = "7e07846d99bed4bd7272b1626038e77a78aa36f6"; | |
}) | |
{ overlays = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Interaction.getUserTeams :: MonadMongo p => Gluon.UserExternalId -> p [Gluon.SavedTeam] | |
WebInteraction.getUserTeams :: MonadMongo p => Gluon.EnterpriseGrantExternalId -> Gluon.UserExternalId -> p [Gluon.SavedTeam] | |
WebInteraction.getUserTeams = if hasAccess eGrantId then Interaction.getUserTeams | |
-- vs | |
Interaction.getUserTeams :: MonadMongo p => Gluon.UserExternalId -> p [Gluon.SavedTeam] | |
Interaction.webGetUserTeams :: MonadMongo p => Gluon.EnterpriseGrantExternalId -> Gluon.UserExternalId -> p [Gluon.SavedTeam] | |
WebInteraction.getUserTeams = if hasAccess eGrantId then Interaction.getUserTeams |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Package configs | |
(require 'package) | |
(setq package-enable-at-startup nil) | |
(setq package-archives '(("org" . "http://orgmode.org/elpa/") | |
("gnu" . "http://elpa.gnu.org/packages/") | |
("melpa" . "https://melpa.org/packages/"))) | |
(package-initialize) | |
;; Bootstrap `use-package` | |
(unless (package-installed-p 'use-package) |
NewerOlder