Skip to content

Instantly share code, notes, and snippets.

View hkailahi's full-sized avatar
:shipit:
Y = λf. (λx. f (x x)) (λx. f(x x))

Heneli Kailahi hkailahi

:shipit:
Y = λf. (λx. f (x x)) (λx. f(x x))
View GitHub Profile
@hkailahi
hkailahi / UnsafeFirst.hs
Last active August 2, 2023 21:23
Anti-Instance Doctest Example
-- Uses `Unsatisfiable` for anti-instance, doctest for statically-checked counterexample, and quickcheck-classes-base for testing of laws
-- See https://www.heneli.dev/blog/anti-instances for more context
{-# LANGUAGE GHC2021, DataKinds #-}
module UnsafeFirst where
import Data.Semigroup (First (..))
import GHC.TypeError (ErrorMessage (Text), Unsatisfiable)
import Test.QuickCheck
Wheeler graphs
Gagie, Manzini, Siren
Theoretical Computer Science, 2017
https://www.sciencedirect.com/science/article/pii/S0304397517305285
Notes of a whiteboard presentation to the Bonsai team in Lille.
These notes largely follow the paper.
Rayan Chikhi, 2019
@hkailahi
hkailahi / Glassery.md
Created September 3, 2018 05:07 — forked from phadej/Glassery.md
title author
Glassery
Oleg Grenrus

After I have improved the raw performance of optika – a JavaScript optics library, it's time to make the library (feature-)complete and sound. Gathering and classifying all possible optic types, gives us a reference point

@hkailahi
hkailahi / KVStore.hs
Created March 24, 2018 11:50 — forked from vaibhavsagar/KVStore.hs
A simple key-value store.
#!/usr/bin/env stack
{- stack --resolver lts-7 --install-ghc runghc
--package aeson
--package servant-server
--package text
--package transformers
--package unordered-containers
--package warp
-}

Take-home functional programming interview

This document is licensed CC0.

These are some questions to give a sense of what you know about FP. This is more of a gauge of what you know, it's not necessarily expected that a single person will breeze through all questions. For each question, give your answer if you know it, say how long it took you, and say whether it was 'trivial', 'easy', 'medium', 'hard', or 'I don't know'. Give your answers in Haskell for the questions that involve code.

Please be honest, as the interviewer may do some spot checking with similar questions. It's not going to look good if you report a question as being 'trivial' but a similar question completely stumps you.

Here's a bit more guidance on how to use these labels:

@hkailahi
hkailahi / GameBoard.java
Last active March 18, 2017 21:46
TicTacToe implementation: TicTacToe.java holds the main(). GameBoard composed of 9 GameSpaces. Player 1 and Player 2 take turns calling a capture method on available GameSpaces.
public class GameBoard {
private GameSpace[] spaces = {new GameSpace(1), new GameSpace(2), new GameSpace(3),
new GameSpace(4), new GameSpace(5), new GameSpace(6),
new GameSpace(7), new GameSpace(8), new GameSpace(9)};
public GameBoard() {}
public GameSpace getGameSpace(int index) {
return spaces[index];
@hkailahi
hkailahi / Guitar.java
Created March 4, 2017 00:56
Guitar Notes
import java.util.ArrayList;
import java.util.List;
public class Guitar {
private Note[][] guitar;
private int numFrets;
private int numStrings;
public Guitar(int numFrets, int numStrings) {