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 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 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 PolyKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module Cofreer where | |
import Data.Kind (Type) |
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 #-} | |
type Id = Int | |
data Path a where | |
P :: P a -> Path a | |
Two :: b -> b -> P (Br b) -> (P (Br b) -> P a) -> Path a | |
data Br a = Br a Id a | |
data P a = Nil | Zero (P (Br a)) | One a (P (Br 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
This is an extension of "A Very General Method of Computing Shortest Paths" to use "open matrices". | |
This is from a paper "The Open Algebraic Path Problem" by Jade Master https://arxiv.org/abs/2005.06682 | |
> {-# LANGUAGE TypeFamilies #-} | |
> {-# LANGUAGE TypeApplications #-} | |
> {-# LANGUAGE FlexibleContexts #-} | |
> {-# LANGUAGE StandaloneDeriving #-} | |
> {-# LANGUAGE AllowAmbiguousTypes #-} | |
> {-# LANGUAGE ScopedTypeVariables #-} | |
> module OpenStarSemiring 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
-- https://www.youtube.com/watch?v=YpklMn5yNA0 | |
{-# LANGUAGE RankNTypes, QuantifiedConstraints #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE GADTs #-} | |
import Prelude (id, (.), ($), Functor(..), (<$>), fst) | |
import Data.Functor.Identity (Identity(..)) | |
import Data.Void | |
import Data.Bifunctor (second) | |
class Feedback m 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
-- https://twitter.com/paf31/status/1362207106703630338 | |
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE DefaultSignatures #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE LinearTypes #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE LambdaCase #-} |
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 PolyKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE StandaloneKindSignatures #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE TypeApplications #-} |
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 PolyKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE StandaloneKindSignatures #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE UndecidableInstances #-} |
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 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 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/viercc/functor-monad/tree/main/day-comonoid | |
{-# LANGUAGE GHC2021 #-} | |
import Data.Functor.Day | |
import Control.Comonad | |
data Multi f a where | |
MZ :: a -> Multi f a | |
MS :: Multi f (b -> a) -> f b -> Multi f a | |
fromMulti :: Applicative f => Multi f a -> f a |
NewerOlder