Skip to content

Instantly share code, notes, and snippets.

Noah Luck Easterly rampion

Block or report user

Report or block rampion

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

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

View plan.cpp
#include <memory>
#include <iostream>
// TODO compare w/ operator::new
namespace plan {
template <typename A, typename B>
struct Apply {
using Target = typename A::Target;
rampion / Tree.hs
Last active Mar 2, 2018
Traversing trees
View Tree.hs
{-# 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)
View Holes.hs
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
View Temp.hs
{-# 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 ((<>))
View Day18.hs
--- Day 18: Duet ---
You discover a tablet containing some strange assembly code labeled simply
"Duet". Rather than bother the sound card with it, you decide to run the code
yourself. Unfortunately, you don't see any documentation, so you're left to
figure out what the instructions mean on your own.
It seems like the assembly is meant to operate on a set of registers that are
each named with a single letter and that can each hold a single integer. You
View Day11.hs
{-# LANGUAGE LambdaCase #-}
module Main where
--- Day 11: Hex Ed ---
Crossing the bridge, you've barely reached the other side of the stream when a
program comes up to you, clearly in distress. "It's my child process," she says,
"he's gotten lost in an infinite grid!"
Fortunately for her, you have plenty of experience with infinite grids.
View Day8.hs
{-# OPTIONS_GHC -Wno-name-shadowing #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE LambdaCase #-}
module Main where
import qualified Data.Map.Strict as M
import qualified Data.List as L
import Data.Maybe (fromMaybe)
--- Day 8: I Heard You Like Registers ---
rampion / FFunctor.hs
Created Oct 27, 2017
Alternate definition of FApplicative aka FMonoidal
View FFunctor.hs
{-# OPTIONS_GHC -Wall -Werror -Wextra #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeFamilyDependencies #-}
You can’t perform that action at this time.