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
#include <stdio.h> | |
/* BEGIN HACKERY */ | |
typedef struct field { | |
enum { | |
TABLE_NAME, | |
TABLE_FIELD, | |
TABLE_TERMINATOR | |
} tag; |
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
import Control.Applicative | |
import Data.List | |
import qualified Data.Map as M | |
import Control.Arrow ((&&&), (***)) | |
import Data.Char(isAlpha, toLower) | |
unscramble = curry $ fmap unwords | |
. uncurry mapM | |
. ( ( ( fmap head .) | |
. flip M.lookup |
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
data Eq a = Eq { | |
eq :: a -> a -> Bool, | |
neq :: a -> a -> Bool | |
} | |
(==) :: (?eq :: Eq a) => a -> a -> Bool | |
(==) = eq ?eq | |
(/=) :: (?eq :: Eq a) => a -> a -> Bool | |
(/=) = neq ?eq |
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 GADTs, DataKinds, KindSignatures, FlexibleInstances, ScopedTypeVariables #-} | |
import Test.QuickCheck | |
import Test.QuickCheck.Gen | |
import Control.Applicative | |
import Data.List | |
-- Peano naturals (used on value and type level) | |
data Nat = Zero | Suc Nat |
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 OverloadedStrings #-} | |
module Main where | |
import Data.Yaml | |
import System.Environment | |
import Control.Applicative | |
data Whatever = Foo { courses :: [String], required :: Int } deriving Show | |
instance FromJSON Whatever where |
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
// needs -fnested-functions. Can be done without, but makes the whole thing a lot more cumbersome | |
// and less useful. | |
#include <stdio.h> | |
#define my_data_alts ( void (*A)(int) , void (*B)(int, int) , void (*C)(char, int) ) | |
#define make_my_data(n) void n my_data_alts | |
typedef void (*my_data) my_data_alts; | |
void show(my_data match) { |
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 GADTs, KindSignatures #-} | |
module FakeWebFramework (add , notActuallyAWebFramework, get, Handler', link) where | |
import UrlPath | |
import Control.Monad.Writer | |
import Data.Maybe | |
maybeRead :: (Read a) => String -> Maybe a | |
maybeRead s = case reads s of | |
[(x, "")] -> Just x |
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
;;; 2048.el --- play 2048 in Emacs (updated graphical version) | |
;; A mild extension for graphical improvements on the 2048-game.el | |
;; by Liam O'Connor to the game 2048 implemented in emacs by | |
;; Zachary Kafner | |
;; Copyright 2014 Zachary Kanfer | |
;; Author: Zachary Kanfer <[email protected]> | |
;; Version: 2014.03.27 |
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
Tests | |
basics | |
arbitrary instance: wf(l): OK (0.04s) | |
+++ OK, passed 5000 tests. | |
take, drop | |
take | |
commutativity: take n ∘ take m ≡ take m ∘ take n: OK (1.57s) | |
+++ OK, passed 5000 tests. | |
accumulativity: take m ∘ take n ≡ take (m ⊓ n): OK (1.54s) | |
+++ OK, passed 5000 tests. |
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 bugreport where | |
open import Data.Nat | |
open import Data.Bool hiding (_≟_) | |
open import Relation.Nullary | |
⸤_⸥ : {A : Set} → Dec A → Bool | |
⸤ yes _ ⸥ = true | |
⸤ no _ ⸥ = false |
OlderNewer