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 DeriveDataTypeable, GeneralizedNewtypeDeriving, TemplateHaskell, FlexibleInstances #-} | |
{-# OPTIONS_GHC -Wall -fno-warn-missing-signatures #-} | |
module QQAST where | |
import Control.Applicative | |
import Control.Exception | |
import Control.Monad.State | |
import Data.Data (Data) | |
import Data.Generics (extQ) | |
import Data.IORef |
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
# Python 3 | |
import collections | |
Write = collections.namedtuple("Write", ["written"]) | |
def hello_world(): | |
yield Write("Hello, world!") | |
yield Write("Hello, world!") | |
return 1 | |
def identity(gen): |
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
(** Supporting code for the "GADTs gone mild" talk *) | |
(** Compact Arrays | |
https://blogs.janestreet.com/why-gadts-matter-for-performance/ | |
*) | |
module CompactArray = struct | |
type 'a t = | |
| Array of 'a array | |
| String of string |
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
from dataclasses import dataclass | |
from typing import Generator, TypeVar, Any, Callable, Optional, cast, NamedTuple, Dict, Type, Tuple, Generic | |
R = TypeVar("R") | |
Eff = Generator[Tuple[Any, ...], Any, R] | |
def handle_op( | |
g: Eff[R], | |
op: Tuple[Any, ...], |
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
{-# OPTIONS --postfix-projections #-} | |
module tuple where | |
------------------------------------------------------------------------------ | |
-- |
OlderNewer