Skip to content

Instantly share code, notes, and snippets.

View rampion's full-sized avatar

Noah Luck Easterly rampion

  • Mercury Technologies
View GitHub Profile
{-# OPTIONS_GHC -Wno-name-shadowing #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeOperators #-}

WHAT hey

what ho

  1. What's a recipe?
  2. What's a target?
  3. What's a rule?
  4. What's that `.PHONY` thing?
  5. What's that `.DEFAULT_GOAL` thing?
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
@rampion
rampion / LetsGetDangerous.md
Last active January 20, 2020 05:02
Let's Get Dangerous
@rampion
rampion / Money.hs
Last active January 16, 2020 10:35
Showing how to generalize PMoney and SMoney using dependent types and singletons, follow up to https://twitter.com/alexnixon_uk/status/1217446321348661248?s=20
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ViewPatterns #-}
@rampion
rampion / README.md
Last active November 15, 2023 04:10

What is the type of \f x -> f (f x)?

#include <memory>
#include <iostream>
// TODO compare w/ operator::new
namespace plan {
template <typename A, typename B>
struct Apply {
using Target = typename A::Target;
@rampion
rampion / Tree.hs
Last active March 2, 2018 05:46
Traversing trees
{-# OPTIONS_GHC -Wno-name-shadowing #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- | All about traversing 'Tree's
module Tree where
import Control.Applicative (liftA2)
module Holes where
import Control.Applicative
newtype Holes t a = Holes { runHoles :: t (a, a -> Holes t a) }
evalHoles :: Functor t => Holes t a -> t a
evalHoles = fmap fst . runHoles
holes :: Traversable t => t a -> Holes t a
holes ta = Holes $ traverse ctx ta `runKA` Holes
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE RecordWildCards #-}
module Main where
import qualified Prelude
import Prelude hiding (words)
import Data.Char (isSpace, isSymbol)
import Data.Foldable (asum)
import Data.Maybe (fromMaybe)
import Options.Applicative
import Data.Semigroup ((<>))