$ ls
Makefile
$ make me a sandwich
What? Make it yourself.
$ ls
Makefile
$ sudo make me a sandwich
Okay.
$ ls
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 RebindableSyntax #-} | |
import Control.Arrow | |
import Control.Monad | |
import Data.Function | |
import Data.Monoid | |
import Prelude | |
import System.IO | |
main :: IO () |
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
if := { | |
|True t _| t() | |
|False _ e| e() | |
} | |
point := {|x y| { | |
; Multiple constants in a pattern are a parse error. I’d like to write: | |
; |Has X| True | |
; |Has Y| True |
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 #-} | |
{-# LANGUAGE RankNTypes #-} | |
module Main where | |
import Control.Monad (forM_, join) | |
import Control.Monad.Free (Free(..), liftF) | |
import System.Random (randomRIO) | |
data Hide g r 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
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
module Main where | |
import Control.Monad (forM_, join) | |
import Control.Monad.Free (Free(..), liftF) |
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
1 10 range \even filter \(^ 2) map \say each | |
+---+----+----------+-----------+---------+ | |
| 1 | 10 | +------+ | +-------+ | +-----+ | | |
+---+----+ | even | | | _ ^ 2 | | | say | | | |
| range | +------+ | +-------+ | +-----+ | | |
+--------+----------+ | | | |
| filter | | | | |
+-------------------+-----------+ | | |
| map | | |
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 FlexibleContexts, FlexibleInstances, MultiParamTypeClasses #-} | |
import Data.Set (Set) | |
import qualified Data.Set as Set | |
class Unit m a where | |
unit :: a -> m a | |
class (Unit m a, Unit m b) => Bind m a b where | |
bind :: m a -> (a -> m b) -> m b |
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.Monad | |
import System.Random | |
class Roll k r where | |
roll :: k -> IO r | |
instance Roll Int Int where | |
roll = pure | |
instance (Roll k r, Random a, Integral a) => Roll (a -> k) r 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
// A constraint could be sugar for a permission: | |
// | |
// “where (foo<T>)” → “+Defined(foo<T>)” | |
// “where (<A, B> map<F<_>, A, B>)” → “+Defined(<A, B> map<F<_>, A, B>)” | |
// | |
// It looks like effects and coeffects can both be represented with permissions because all terms are functions. | |
trait (<)<T> (T, T -> Bool) | |
trait zero<T> (-> T) | |
trait neg<T> (T -> T) |
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 Atom = Atom { _element :: String, _point :: Point } | |
type Atom: | |
case mkatom: | |
_element as (Text) | |
_point as (Point) | |
// data Point = Point { _x :: Double, _y :: Double } | |
type Point: | |
case mkpoint: | |
_x as (Float64) |