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 GADTs, FlexibleContexts, TemplateHaskell #-} | |
import Control.Monad.State | |
import qualified Data.IntMap as M | |
import Control.Lens | |
data Field = Field String (M.IntMap Chara) deriving (Show) | |
data Chara = Chara String deriving (Show) | |
updateField f (Field s m) = Field (f s) m | |
updateChara f (Chara s) = Chara (f s) |
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 Rank2Types #-} | |
import Control.Comonad | |
data Saucer e a = Saucer a (forall x. e x -> (x, Saucer e a)) | |
instance Functor (Saucer e) where | |
fmap f (Saucer a h) = Saucer (f a) (fmap (fmap f) . h) | |
instance Comonad (Saucer e) where | |
extract (Saucer a h) = a |
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 ViewPatterns #-} | |
module Source where | |
import Control.Applicative | |
import Control.Comonad | |
import qualified Data.Sequence as Seq | |
import Control.Monad.Identity | |
type Time = Double | |
data Source f a = Source !a (Time -> f (Source f a)) |
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
-- https://github.com/ekmett/free/tree/35467bea6916a2efdd7182d071751af685344b1a | |
import Control.Monad.Identity | |
import qualified Control.Monad.Trans.Iter as I | |
import qualified Control.Monad.Trans.Iter.Reflection as R | |
import Control.Monad.State | |
import Data.IORef | |
destruct :: I.IterT IO a -> IO a | |
destruct m = do |
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
export PS1="$PS1\nββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ " |
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 MultiWayIf, ExistentialQuantification, OverloadedStrings #-} | |
import FreeGame | |
import qualified Data.IntMap as IM | |
import Control.Lens | |
import Control.Monad.State | |
import Control.Applicative | |
import Control.Monad | |
import Control.Monad.Identity | |
import qualified Data.Traversable as T |
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 GADTs, FlexibleInstances, FlexibleContexts, Rank2Types #-} | |
import Prelude hiding (getChar, putChar) | |
import Control.Monad.Operational.Mini | |
import qualified System.IO as IO | |
class Monad m => MonadCharIO m where | |
getChar :: m Char | |
putChar :: Char -> m () |
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
import Data.Functor.Yoneda | |
import Control.Comonad.Cofree | |
import Control.Comonad | |
type Coprogram t = Cofree (Yoneda t) | |
data Hole = Hole | |
alone :: Coprogram t a -> t a | |
alone (_ :< Yoneda f) = f extract |
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 GADTs, Rank2Types #-} | |
import Control.Lens | |
data Chronik f s where | |
Hexaemeron :: s -> Chronik f s | |
Inschrift :: f a -> a -> Chronik f s -> Chronik f s | |
_Chrono :: (f a -> Getting a s a) -> f a -> Lens' (Chronik f s) a | |
_Chrono getter field f (Hexaemeron s) = fmap (\a' -> Inschrift field a' (Hexaemeron s)) |
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 GADTs, Rank2Types #-} | |
import Control.Comonad | |
import Control.Lens.Internal.Context | |
import Control.Lens | |
data Chronik s where | |
Hexaemeron :: s -> Chronik s | |
Inschriftγ:: Context' a (Chronik s) -> Chronik s |