This file contains hidden or 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 DataKinds, GADTs, KindSignatures #-} | |
data RedBlack :: (Bool -> *) where | |
Red :: RedBlack 'False -> RedBlack 'True | |
Black :: RedBlack a -> RedBlack b | |
Stop :: RedBlack a | |
test = Red $ Black $ Red $ Stop |
This file contains hidden or 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 TemplateHaskell #-} | |
module Card where | |
import Test.QuickCheck | |
import Control.Lens | |
data Card = Of { _rank :: Rank, _suit :: Suit } |
This file contains hidden or 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 InvertedReg where | |
import Control.Monad | |
import Control.Applicative | |
import Data.Monoid | |
data Generator s = Gen { generate :: [s] } |
This file contains hidden or 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
require 'gtk3' | |
class App | |
def self.create &block | |
@@framestack = [Gtk::Window.new] | |
@@registration_on = true | |
flow { self.instance_eval &block } |
This file contains hidden or 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
not_implemented = function () { | |
throw "Implement me!" | |
} | |
map_list = not_implemented | |
map_nullable = not_implemented | |
map_function = not_implemented | |
assert_equal = function (x, y) { |
This file contains hidden or 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 DeriveFunctor #-} | |
module AST where | |
data AST var | |
= Constant String | |
| Variable var String | |
| (:->) [var] (AST var) | |
| Call (AST var) [AST var] |
This file contains hidden or 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
let getline return = | |
getchar -> c: | |
if equal c "\n" ? | |
return "" | |
else | |
getline -> s: | |
return (+ c s); | |
let putline string next = |
This file contains hidden or 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
#lang racket | |
; await (s -> (s, parser)) | |
; yield (result, parser) | |
; stop (error) | |
(define (await state-transform) `(await ,state-transform)) | |
(define (yield result next) `(yield ,result ,next)) | |
(define (stop error) `(stop ,error)) |
This file contains hidden or 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 RankNTypes #-} | |
import Data.Traversable (for) | |
import Data.Functor.Identity | |
import Data.Functor.Constant | |
type Lens s t a b = forall f . Applicative f => (a -> f b) -> (s -> f t) |
This file contains hidden or 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
#lang racket | |
(define (partition good? list return) | |
(match list | |
[(list) | |
(return `() `())] | |
[(list head tail ...) | |
(partition good? tail (λ (accepted rejected) |