Instantly share code, notes, and snippets.

View .spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
View .spacemacs
;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
View configuration.nix
{ config, pkgs, lib, ...}:
{
services.hydra.package = pkgs.hydra.overrideAttrs (o: { src = (pkgs.fetchFromGitHub {
owner = "nixos";
repo = "hydra";
rev = "e0f204f3da6245fbaf5cb9ef59568b775ddcb929";
sha256 = "66002da8d68027b8a5edaf03bd81dd8b6327397311d71398776e1d3ef1ec96e1";
});
});
imports = [
View traverseConcurrentlyWith.hs
traverseConcurrentlyWith :: Traversable f => Int -> (a -> IO b) -> f a -> IO (f b)
traverseConcurrentlyWith count f t0 = do
(queue, t1) <- atomically $ do
queueDList <- newTVar id
t1 <- for t0 $ \x -> do
res <- newEmptyTMVar
modifyTVar queueDList (((x, res):) .)
pure . atomically $ takeTMVar res
dlist <- readTVar queueDList
queue <- newTVar $ dlist []
View ghcopts.cabal
# ghc-options:
# - -Weverything
# - -Wno-missing-exported-signatures # missing-exported-signatures turns off the more strict -Wmissing-signatures. See https://ghc.haskell.org/trac/ghc/ticket/14794#ticket
# - -Wno-missing-import-lists # Requires explicit imports of _every_ function (e.g. '$'); too strict
# - -Wno-missed-specialisations # When GHC can't specialize a polymorphic function. No big deal and requires fixing underlying libraries to solve.
# - -Wno-all-missed-specialisations # See missed-specialisations
# - -Wno-unsafe # Don't use Safe Haskell warnings
# - -Wno-missing-local-signatures # Warning for polymorphic local bindings. Don't think this is an issue
# - -Wno-monomorphism-restriction # Don't warn if the monomorphism restriction is used
View default.nix
# default.nix
{}:
(import ./reflex-platform{}).project ({ pkgs, ... }:
{
packages = {
common = ./common;
backend = ./backend;
frontend = ./frontend;
View dataFamiliesVsTypeFamiliesVsGADTs.md

To your other, more general question, "the uses of data families as distinct from type families and GADTs". Here's the space of possibilities: ​

  1. Is the type constructor generative and injective, and can it be partially applied?
  2. Is there a runtime tag passed along with the value to pattern match on?
  3. Can it be closed, can it be open? ​ And here's where GADTs and type/data families lie in this space: ​
View keybase.md

Keybase proof

I hereby claim:

  • I am o1lo01ol1o on github.
  • I am o1lo01ol1o (https://keybase.io/o1lo01ol1o) on keybase.
  • I have a public key ASAohfPzXdT8Wyi8YU0niXf89Jq--Mei5gg4FDVPwtKnbAo

To claim this, I am signing this object:

View gadtgraph.hs
--Pragmas are needed additionally for the project in which this snippet is included
{-# LANGUAGE TypeInType, DataKinds, PolyKinds, ScopedTypeVariables,
FlexibleInstances, FlexibleContexts, GADTs, TypeFamilies,
RankNTypes, LambdaCase, TypeOperators, TemplateHaskell,
ConstraintKinds, PolyKinds, NoImplicitPrelude,
UndecidableInstances, MultiParamTypeClasses, GADTSyntax,
AllowAmbiguousTypes, InstanceSigs, DeriveFunctor,
FunctionalDependencies #-}
-- Algebra.Graph is from the algebraic-graphs package