View Main.hs
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 ImportQualifiedPost #-} | |
{-# LANGUAGE DerivingVia #-} | |
module Main where | |
import Control.Foldl (Fold) | |
import Control.Foldl qualified as Fold | |
import Data.Function ((&)) | |
import Data.Profunctor | |
import Data.Semigroup |
View Label.hs
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 DataKinds #-} | |
{-# LANGUAGE DerivingStrategies #-} | |
{-# LANGUAGE LambdaCase #-} | |
module Label | |
( -- * Labels | |
Label, | |
label, | |
label', | |
getLabel, |
View Label.hs
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 DataKinds #-} | |
{-# LANGUAGE DerivingStrategies #-} | |
module Label | |
( Label, | |
label, | |
label', | |
) | |
where |
View string-builder.nix
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
let | |
list = | |
rec { | |
empty = { a = null; cons = null; }; | |
singleton = x: { a = x; cons = null; }; | |
cons = x: xs: { a = x; cons = xs; }; | |
# O(n) | |
foldr = f: zero: |
View Pretty.hs
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 #-} | |
module Pretty | |
( -- * Pretty printing for error messages | |
Err, | |
printPretty, | |
-- constructors hidden | |
prettyErrs, | |
message, | |
messageString, |
View v0.0.1.nix
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
let | |
pkgs = import ./. {}; | |
lib = pkgs.lib; | |
allOptions = (import ./nixos {}).options; | |
depot = import /home/philip/depot {}; | |
optionSchema = opt: { | |
type = simpletype opt; | |
description = opt.description.text or ""; |
View Permissions.hs
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 AllowAmbiguousTypes #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE OverloadedLabels #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeFamilies #-} |
View hlint-to-github-warnings.jq
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
# the github message format requires newlines to be escaped with the URL-style %0A | |
# see https://github.com/actions/toolkit/issues/193#issuecomment-605394935 | |
def escapeNewline: gsub("[\\n]"; "%0A"); | |
# depending on the hlint message, we want to display the | |
# headings and the bodies differently | |
def prepareTitle: | |
if .hint == "Unused LANGUAGE pragma" | |
then { heading: "Unused LANGUAGE pragma: \(.from)" | |
, suggestion: "" |
View with.fish
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
function with --description 'import all arguments as nixpkgs args and put their /bin on PATH' | |
set arg ( \ | |
printf ' | |
let pkgs = import <nixpkgs> {}; | |
in pkgs.symlinkJoin { | |
name = "extra-fish-path"; | |
paths = with pkgs; [ %s ]; | |
} | |
' \ | |
"$argv" \ |
View Incidence.hs
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
module Main where | |
import System.Random | |
import Data.Ratio | |
import Data.Bifunctor | |
-- | Returns for a bunch of people you meet , with a chance of 1/200 for each person, whether any has Covid | |
randomPeople200 :: (RandomGen gen) => Int -> gen -> (Bool, gen) | |
randomPeople200 numberOfPeople = | |
first anyHasCovid . runGeneratorNTimes numberOfPeople 0 (uniformR (1, 200::Int)) |
NewerOlder