Skip to content

Instantly share code, notes, and snippets.

@k0001
k0001 / handwavy.md
Created June 23, 2023 21:53
k0001's handwavy guide to high quality software

k0001's handwavy guide to high quality software

This is a work in progress where I try to convey what high quality software means to me, and how to build it. Be warned: This is a very opinionated and handwavy guide.

Copyright Renzo Carbonara, 2016. This work is licensed under a Creative Commons Attribution 4.0 International License.

nix-env -iA ormolu -f https://github.com/google/ormolu/tarball/f16c62c18db1b328ee481c781171ea61f354ff70
nix-env -iA ormolu -f https://github.com/k0001/ormolu/tarball/f16c62c18db1b328ee481c781171ea61f354ff70
{- To be clear, I mean exporting this: -}
data family Sing (a :: k)
class SingI (a :: k) where
sing :: Sing a
data SomeSing k where
SomeSing :: Sing (a :: k) -> SomeSing k
@k0001
k0001 / Aoc_3.hs
Last active December 5, 2019 11:23
Aoc_3.hs
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Aoc_3 where
import Numeric.Natural (Natural)
import Control.Applicative (liftA2)
import Control.Monad (join)
import qualified Data.List as List
@k0001
k0001 / Aoc2_1.hs
Last active December 3, 2019 16:51
-- This enables the `\case` syntax, which is not standard Haskell.
{-# LANGUAGE LambdaCase #-}
-- | Solution for https://adventofcode.com/2019/day/2
module Aoc2_1 where
-- We like Natural numbers. Kind of.
import Numeric.Natural
-- We redefine `drop` below, so we hide its original implementation
@k0001
k0001 / Aoc1.hs
Last active December 8, 2019 14:51
AdventOfCode2019
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Aoc1 where
import Data.Foldable
import Data.Monoid (Sum(..))
import Data.Ratio
inoremap <up> <Esc><right><up>
inoremap <down> <Esc><right><down>
inoremap <left> <Esc>
inoremap <right> <Esc><right><right>
inoremap <insert> <Esc><right><insert>
inoremap <delete> <Esc><right><delete>
inoremap <home> <Esc><right><home>
inoremap <end> <Esc><right><end>
inoremap <PageDown> <Esc><right><PageDown>
inoremap <PageUp> <Esc><right><PageUp>
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedLists #-}
module Main where
import qualified Data.ByteString as BS
import Data.HashMap.Strict (HashMap)
import Data.Text (Text)
import qualified Xmlbf as X
import qualified Xmlbf.Xeno as Xx
@k0001
k0001 / ollie.txt
Last active January 18, 2018 12:53
I've done something like this in the past: I installed the test executables
somewhere in $out (although presumably one could use an output different
than $out). You will need to change `testTarget` and/or `checkPhase` as well,
so as to prevent the tests from being run with Nix. Then, once the thing is
installed, you just execute /nix/store/whatever/libexec/tests/foo-tests.
postInstall = ''
if [ "$doCheck" = "1" ]; then
mkdir -p $out/libexec/tests
cp ./dist/build/foo-tests $out/libexec/tests/foo-tests