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 PolyKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE StandaloneKindSignatures #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE UndecidableInstances #-} |
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 RankNTypes #-} | |
import Prelude hiding (id, (.)) | |
import Control.Category | |
import Data.Functor.Coyoneda | |
import Data.Bifunctor (first) | |
newtype Object f g = Object { runObject :: forall a. f a -> g (Object f g, a) } | |
newtype Obj f g = Obj { runObj :: forall a. f a -> Coyoneda g (Obj f g, a) } | |
to :: Object f g -> Obj f g |
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
-- Using https://hackage.haskell.org/package/squares | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} |
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 RankNTypes #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
import Data.Profunctor | |
import Data.Profunctor.Composition | |
import Data.Functor.Const |
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 StandaloneKindSignatures, GADTs, DataKinds, PolyKinds, RankNTypes, TypeOperators #-} | |
module Rift where | |
import Data.Bifunctor.Clown | |
import Data.Bifunctor.Joker | |
import Data.Profunctor | |
import Data.Profunctor.Cayley | |
import Data.Profunctor.Composition | |
import Data.Profunctor.Ran | |
import Data.Kind (Type) |
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 RankNTypes, GADTs, TypeOperators #-} | |
import Data.Profunctor | |
data Exists2 f g where | |
Exists2 :: f x -> g x -> Exists2 f g | |
data Confluence p = Confluence (forall a b c. (p a b, p a c) -> Exists2 (p b) (p c)) | |
newtype Op p a b = Op { runOp :: p b 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 TypeOperators, RankNTypes, TupleSections, GADTs, DeriveFunctor, FlexibleInstances, FlexibleContexts, MultiParamTypeClasses, TypeFamilies, AllowAmbiguousTypes, TypeApplications, ScopedTypeVariables, UndecidableInstances #-} | |
import Data.Bifunctor | |
import Data.Functor.Kan.Lan | |
import Data.Kind (Type) | |
import Data.Void (Void, absurd) | |
type f ~> g = forall a. f a -> g a | |
class Bifunctor m => Tensor m where |
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 GHC2021, GADTs, DataKinds #-} | |
{-# LANGUAGE TypeData #-} | |
module Endofunctors where | |
import Control.Comonad (Comonad(..)) | |
import Control.Comonad.Cofree (Cofree(..)) | |
import Control.Monad (join, ap, void) | |
import Control.Monad.Free (Free(..)) | |
import Data.Bifunctor (first, second, bimap) | |
import Data.Functor.Day |
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 ConstraintKinds, TypeApplications, ScopedTypeVariables, FlexibleInstances, RankNTypes, DeriveFunctor #-} | |
import Data.Functor.Compose | |
import Data.Functor.Identity | |
class Cofunctor f where | |
comap :: (f a -> f b) -> (a -> b) | |
instance Cofunctor Identity where | |
comap f = runIdentity . f . Identity |
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 #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE TypeOperators #-} | |
module StateMachine where | |
import Control.Comonad (extract) | |
import Control.Comonad.Cofree | |
import Data.Bifunctor (first, second) | |
import Data.Functor.Day |