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
task classpath << { println sourceSets.main.runtimeClasspath.asPath } |
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 FlexibleContexts, FlexibleInstances, FunctionalDependencies #-} | |
module Idea where | |
class ComposeApply a b c | a b -> c where | |
(#) :: a -> b -> c | |
instance ComposeApply (a -> b) a b where | |
f # x = f x |
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
data InfiniteList a = InfiniteList a (InfiniteList a) | |
traverseForever :: Applicative m => (a -> m b) -> InfiniteList a -> m c | |
traverseForever f (InfiniteList x xs) = f x *> traverseForever f xs | |
countUpwardsFrom :: Integer -> InfiniteList Integer | |
countUpwardsFrom n = InfiniteList n (countUpwardsFrom (n + 1)) | |
forForever :: Applicative m => InfiniteList a -> (a -> m b) -> m c | |
forForever = flip traverseForever |
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
{ coreutils, writeShellScript, lib, system, glibcLocales }: | |
rec { | |
inherit (builtins) derivation; | |
inherit (lib) concatMapStringsSep; | |
standardBuildInputs = [ coreutils ]; | |
locale = { LC_ALL = "en_US.UTF-8"; LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; }; |
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
#! /usr/bin/env bash | |
set -eufo pipefail | |
nix-shell --pure --run 'ghcide --lsp' |
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
import Control.Exception.Safe | |
import Control.Concurrent | |
bracketFork | |
:: IO resource | |
-- ^ The first action; will run in the current thread | |
-> (resource -> IO a) | |
-- ^ A final action that runs in the forked thread, with async exceptions masked | |
-> (resource -> IO b) | |
-- ^ Action that runs in the forked thread, with async exceptions unmasked |
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
{ | |
services.nginx = { | |
enable = true; | |
appendHttpConfig = '' | |
types { | |
text/html html; | |
text/css css; | |
text/xml xml rss; | |
image/gif gif; |
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
{ | |
pkgs = | |
import (import ./nixpkgs.nix) {}; | |
texlive = | |
import ./texlive.nix { inherit (pkgs) texlive; }; | |
fontsForLatex = | |
[ | |
{ name = "google-fonts"; |
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
https://twitter.com/Cshearer41/status/1103717536921800704 | |
Let a, b, c be the triangles, smallest to largest. | |
Observations from the illustration about the relative triangle sizes: | |
side b = 2 * height a [observation ab] | |
side c = 2 * height b [observation bc] | |
Let w be the rectangle's width and let h be its height. |
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 LambdaCase #-} | |
import Prelude (Bool (True, False), Monad, (>>=)) | |
ifThenElseM :: Monad m => m Bool -> m a -> m a -> m a | |
ifThenElseM cond ifTrue ifFalse = | |
cond >>= \case { True -> ifTrue; False -> ifFalse } | |
ifThenElseM' :: Monad m => [(m Bool, m a)] -> m a -> m a |