I hereby claim:
- I am tel on github.
- I am tel (https://keybase.io/tel) on keybase.
- I have a public key whose fingerprint is C8D6 8612 BD85 2998 F35E 5339 0675 90FD 6502 8C09
To claim this, I am signing this object:
data Zipper t a = Zipper { diff :: D t a, here :: a } | |
deriving instance Diff t => Functor (Zipper t) | |
class (Functor t, Functor (D t)) => Diff t where | |
data D t :: * -> * | |
inTo :: t a -> t (Zipper t a) | |
outOf :: Zipper t a -> t a | |
instance Diff ((,) x) where |
{-# LANGUAGE GADTs #-} | |
{- | |
Consider the standard "finally tagless" de Bruijn encoded lambda | |
calculus. | |
-} | |
class Db r where |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE UndecidableInstances, DeriveFunctor, TypeOperators #-} | |
{-# LANGUAGE FlexibleContexts, StandaloneDeriving, ScopedTypeVariables #-} | |
{-# LANGUAGE TypeFamilies, RankNTypes, GADTs, DefaultSignatures #-} | |
module Zippers where | |
import Control.Applicative | |
class Functor f => Comonad f where |
{-# LANGUAGE GADTs, RankNTypes #-} | |
import Control.Applicative | |
import Control.Category | |
import Data.List (foldl') | |
import Data.Profunctor | |
import Prelude hiding ((.), id) | |
-- | Explicit state-passing Moore machine | |
data Moore i o where |
I hereby claim:
To claim this, I am signing this object:
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE GADTs #-} | |
data Sv u where | |
E :: u -> Sv u | |
S :: u -> Sv u | |
data Sf (coupled :: Bool) |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module TransformerExample where | |
{- | |
We'll layer StateT and IO together in order to track the most recent | |
response received in interactive communication with the user. |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE OverloadedLists #-} | |
module ListT where | |
import Control.Applicative | |
import Control.Monad | |
import Control.Monad.Trans | |
import Data.Monoid |
data Ty = Bool | Arr Ty Ty deriving (Eq, Show) | |
data IExpr c i | |
= Var Int | |
| App i c | |
| Annot c Ty | |
| If c i i | |
| ETrue | |
| EFalse |
-- We'll use the instance of Applicative for ((->) a) below | |
instance Num b => Num (a -> b) where | |
(+) = liftA2 (+) | |
(*) = liftA2 (*) | |
(-) = liftA2 (-) | |
negate = fmap negate | |
signum = fmap signum | |
abs = fmap abs |