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 DeriveFunctor #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
module Huff 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 RankNTypes #-} | |
{-# LANGUAGE GADTs #-} | |
module FreeCat where | |
import Control.Category | |
import Prelude hiding ((.), id) | |
data Cat p a b where | |
Inj :: p a b -> Cat p a 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
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TypeOperators #-} | |
type b <~ a = forall c . (b -> c) -> a -> c | |
back :: (a -> b) -> (b <~ a) | |
back f = (. f) | |
fwd :: (b <~ a) -> (a -> b) | |
fwd g = g id |
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 TypeFamilies #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE DataKinds #-} | |
module HetComp where | |
type family as ++ bs :: [k] 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 RankNTypes #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
module Tesser where | |
import Data.List (foldl') | |
import Data.Profunctor | |
import Data.Bifunctor |
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 RankNTypes #-} | |
{-# LANGUAGE LambdaCase #-} | |
-- Code obviously based on <http://andrej.com/plzoo/html/levy.html> | |
-- This is right now *not really* CBPV. In particular, the Rec binder | |
-- is both less well-behaved and far more complex than it ought to | |
-- be. Instead of passing a computation back (which should never be | |
-- possible as variables do not have computation types) it should pass | |
-- back a thunk. |
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 RankNTypes #-} | |
{-# LANGUAGE LambdaCase #-} | |
-- Code obviously based on <http://andrej.com/plzoo/html/levy.html> | |
module CBPV where | |
import Control.Applicative | |
import Control.Monad |
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 RankNTypes, LiberalTypeSynonyms, DeriveFunctor, LambdaCase #-} | |
module Pp where | |
import Data.Monoid | |
class Profunctor p where | |
dimap :: (a -> b) -> (s -> t) -> p b s -> p a t | |
class Profunctor p => Strong p 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
module Opt = struct | |
module Core = struct | |
type 'a t = 'a option | |
let pure a = Some a | |
let map f = function | |
| None -> None | |
| Some a -> Some (f a) |
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 StringLike = struct | |
type t = string | |
let of_string : string -> t = fun s -> String.lowercase s | |
let to_string : t -> string = fun s -> s | |
let compare : t -> t -> int = String.compare | |
end | |
module Tag = struct |