Skip to content

Instantly share code, notes, and snippets.

> (||) <$> (putStrLn "x" >> pure True) <*> (putStrLn "y" >> pure False)
x
y
True
> let mor = \ma mb -> ma >>= \a -> if a then pure True else mb
> :t mor
mor :: Monad m => m Bool -> m Bool -> m Bool
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 961b6aca4f0..3f83c6868e7 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -735,4 +735,5 @@
./virtualisation/xe-guest-utilities.nix
./virtualisation/openstack/keystone.nix
./virtualisation/openstack/glance.nix
+ ./services/web-servers/foo.nix
]

Keybase proof

I hereby claim:

  • I am k0001 on github.
  • I am renzo (https://keybase.io/renzo) on keybase.
  • I have a public key ASA-EE5TKMJ3WFx_6BgPON5xiD8UwJwk8qceGYxYLTq5IQo

To claim this, I am signing this object:

@k0001
k0001 / shapy.hs
Last active August 10, 2017 19:47
{-# language ConstraintKinds #-}
{-# language DataKinds #-}
{-# language GADTs #-}
{-# language KindSignatures #-}
{-# language RankNTypes #-}
{-# language ScopedTypeVariables #-}
{-# language TypeOperators #-}
import Control.Monad (guard)
import Data.Proxy (Proxy(Proxy))
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE PolyKinds #-}
import Data.Kind (Type)
import GHC.TypeLits (Nat)
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeSynonymInstances #-}
import Data.Kind (Type)
import GHC.TypeLits (Nat)
class Starring ka
instance Starring Type
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
import Data.Kind
import GHC.Exts (Constraint)
import GHC.TypeLits (Nat)
type family StarMaker k :: Constraint where
StarMaker Type = ()
StarMaker (_ -> x) = StarMaker x
#! /usr/bin/env nix-shell
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/d2c451f967e344df14e63985963e57fb64a6c58d.tar.gz
#! nix-shell -i bash -p xz
# Outputs a xz tarball of all run-time and build-time dependencies
# of the given nix store paths that are provided as arguments.
function fexport()
{
set -x
nix-store --export $(nix-store -qR --include-outputs $(nix-store -qd "$@")) \
-- | How do I write inductive instances for n-arity functions? Does this have a
-- name? How can I add functional dependencies to 'MapLast'?
class MapLast s t a b where
mapLast :: (a -> b) -> (s -> t)
instance MapLast a b a b where
mapLast = ($)
instance MapLast (z -> a) (z -> b) a b where
mapLast = (.)
instance MapLast (y -> z -> a) (y -> z -> b) a b where
mapLast = (.) . (.)
asd=> CREATE TABLE foo (i int NOT NULL);
CREATE TABLE
asd=> INSERT INTO foo (i) VALUES (DEFAULT);
ERROR: null value in column "i" violates not-null constraint
DETAIL: Failing row contains (null).