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
module type Functor = sig | |
type 'a t | |
val map : ('a -> 'b) -> ('a t -> 'b t) | |
end | |
module Iso = struct | |
type ('a, 'b) t = { fwd : 'a -> 'b; bck : 'b -> 'a } | |
let fwd i = i.fwd | |
let bck i = i.bck |
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
/// PRELIMINARIES | |
/** | |
* Generalized "products" of any size. For gluing things together. A tuple is a | |
* "2"-meet. | |
* | |
* The type `Meet a b c d ...` indicates a `Meet` of the given size with values | |
* at each type in the sequence. | |
*/ |
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
function Cont(contHandler) { | |
this.contHandler = contHandler; | |
}; | |
Cont.unit = function(value) { | |
return new Cont(function (continue) { return continue(value); }); | |
}; | |
Cont.prototype.run = function(resume) { | |
return this.contHandler(resume); |
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
const IdModule = { | |
fmap: (fn) => (x) => fn(x), | |
} | |
const ConstModule = { | |
fmap: (fn) => (x) => 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
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module PipeLog where | |
import Control.Applicative | |
import Data.Functor.Identity | |
import Pipes | |
import qualified Pipes.Prelude as P | |
newtype LogT l m 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
import scala.language.higherKinds | |
object Lenses { | |
trait Profunctor[P[_, _]] { | |
def dimap[A, B, C, D](f: C => A, g: B => D)(p: P[A, B]): P[C, D] | |
} | |
object Profunctor { |
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 Rel | |
DecProofType : {a:Type} -> Dec a -> Type | |
DecProofType {a} (Yes _) = a | |
DecProofType {a} (No _) = a -> _|_ | |
decProof : {a:Type} -> (dec : Dec a) -> DecProofType dec | |
decProof (Yes x) = x | |
decProof (No x) = 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
{-# LANGUAGE GADTs #-} | |
module Lib where | |
import qualified Data.HashMap.Lazy as M | |
import Data.Hashable | |
import Data.Typeable | |
-- this is what we know about all things from Java | |
data Val 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
-- Example code | |
example :: (Context m, MonadLog m, AreaDao m) => [Actor] -> m () | |
example list = | |
forM list $ \actor -> do | |
logInfo $ "Actor being read: " ++ actorCode actor | |
areaList <- getArea actor | |
case areaList of | |
[] -> return () -- do nothing | |
(area : _) -> do |