Free Monad
data Free f a = Pure a | Free (f (Free f a))
instance Functor f => Monad (Free f) where
return = Pure
Free x >>= f = Free (fmap (>>= f) x)
Pure x >>= f = f x
- Why free monads matter
- Freeモナドって何なのさっ!?
- そろそろFreeモナドに関して一言いっとくか
- Asymptotic Improvement of Computations over Free Monads
- Reflection without Remorse
- 自由モノイドとFreeモナド
- Free monads are free
- Free monad
- Category of monads
- What is the difference between free monads and free monoids?
- Interpreting Free Monads of Functor Sums
- Reasoning about Errors in Free Monads and Their Interpreters
- Free Monads from Functors from GADTs
- Functional Pearl: A Smart View on Datatypes
- FreeモナドとTagless FinalによるDependency InjectionのためのDSL
- Freeモナドで領域特化言語を作るとプリティミューテーション
- Freer Monads, More Extensible Effects
- Recursion Excursion
- Free and Freer Monads: Putting Monads Back into Closet
- The free-concurrent package
- A Tour Of Some Useful Recursive Types
- A Modern Architecture for FP
- van Laarhoven Free Monad
- Extensible Effects in the van Laarhoven Free Monad
- Free play, part one
- Free play, part two
- Free play, part three
- Yield for Effects
- Freer play with effects
- Free, take 2
- Applicative Effects in Free Monads
- More on Applicative Effects in Free Monads
- Free, take 2
- FreerモナドとCoyonedaについて
- [Haskell-cafe] A proof that the list monad is not a free monad
- Jeremy Mikkola - Cheatsheet: Free Monad
- Free Me — Exploring the Free Data Type
- Free Monadic Parser
- What does Free buy us?
- Free monad considered harmful
- Optimising free monad programs using Plated
- Free Monads: from the basics to the implementation of composable and effectful stream processing
- Free Monads: from the basics to the implementation of composable and effectful stream processing – Deque
- Tweag I/O - Free monads for cheap interpreters
- Oleg’s gists - Free Monad and Free Applicative using single Free type
- mtl-style-for-free
- Static Analysis of Free Monads
- Freer Monads: Too Fast, Too Free :: Reasonably Polymorphic
- Tweag I/O - Capability is about free monads. It’s a bird… It’s a plane… It’s a free monad!
- 任意の数の引数を取れる関数のデータ型を考えてたらモナドになった - Qiita
- Lysxia - Free monads of free monads
- String Diagrams for Free Monads
- What does Free buy us?
- graninas/automatic-whitebox-testing-showcase: Showcase for an approach how to make automatic white-box testing with Free monads.
- The Power of Tiny DSLs | Blog | jackkelly.name
- Hierarchical Free Monads: The Most Developed Approach In Haskell (And The Death Of Final Tagless)
- Hierarchical Free Monads: Mostly Pointless (And The Resurrection Of Final Tagless)
- Regular Effects
- 圏論におけるFreeモナド - Qiita
- Cayley Representation of… Monads? - kleczkow.ski
- Lysxia - Initial and final encodings of free monads
- Game rules with a Free Monad DSL | Rogan Murley
Coyoneda
data Coyoneda f a where
Coyoneda :: (b -> a) -> (f b) -> Coyoneda f a
instance Functor (Coyoneda f) where
fmap f (Coyoneda g fb) = Coyoneda (f . g) fb
抽象データ型からファンクタを作ることができる。Freeと組み合わせれば手軽にモナド(DSL)が手に入る。
data Proc a = Action1 a | Action2 a | Action3 a
act1 = Free $ Coyoneda id (Action1 (Pure ()))
act2 = Free $ Coyoneda id (Action2 (Pure ()))
act3 = Free $ Coyoneda id (Action3 (Pure ()))
runProc :: Free (Coyoneda Proc) () -> IO ()
runProc (Pure ()) = putStrLn "end"
runProc (Free (Coyoneda f act)) = case act of
Action1 a -> putStrLn "act1" >> runProc (f a)
Action2 a -> putStrLn "act2" >> runProc (f a)
Action3 a -> putStrLn "act3" >> runProc (f a)
proc :: Free (Coyoneda Proc) ()
proc = do
act1
act2
act3
main = runProc proc
- Step by Step / Deep explain: The Power of (Co)Yoneda (preferably in scala) through Coroutines
- Yoneda principle
- Co-Yoneda lemma
- EndによるYoneda lemma
- (Co)Yoneda reduction for free
- Co-Yoneda lemma in colimits
- Free Monads for Less (Part 2 of 3): Yoneda
- Closure Conversion as CoYoneda
newtype Natural f g = Natural (forall x. f x -> g x)
yoneda :: Functor f => f a -> Natural ((->) a) f
yoneda f = Natural $ \ax -> fmap ax f
https://twitter.com/fumieval/status/576349394724765697
Operational Monad
- operational
- Freeモナドを超えた!?operationalモナドを使ってみよう
- Operational monad
- 09. Operationalモナド
- Yoneda lemmaとOperational Monad
- Operationalモナドは任意のモナドを実装できる StateT s IO a
- Examining Hackage: operational
- 今のところ比較的簡単なモナドの作り方
Ideal Monad
- An introduction to ideal monads
- 究極のモナド「Idealモナド」を垣間見る
- 究極のモナド「Idealモナド」を垣間見る(続/その0)
- What is the correct definition of ideal monads?
Cofree
- Free for DSLs, cofree for interpreters
- Cofun with Cofree Comonads
- Marcin Szamotulski - Composing Cofree Interpreters
- The Comonad.Reader » The Cofree Comonad and the Expression Problem
- monads - What are some motivating examples for Cofree CoMonad in Haskell? - Stack Overflow
- Cofree will tear us apart - Murat Kasimov
- 最短経路問題をCofree+Nexus構成で解く - Qiita
EDSL
- Domain-specific Languages and Code Synthesis Using Haskell
- Jurriaan Hage - Making Embedded Domain Specific Languages a Practical Reality
- UoY CS - Folding Domain-Specific Languages - Prof. Jeremy Gibbons
- Writing a Search DSL, Part 1
- Haskell, Startups, and Domain Specific Languages
- Compilation as a Typed EDSL-to-EDSL Transformation
- Sharing in Haskell EDSLs
- Ryan Newton - DSL Embedding in Haskell [1/2] - YouTube
- Rewriting a Shallow DSL using a GHC Compiler Extension
- Hannah – a DSL for parsing and generating files and network traces
- AST を拡張しよう
The Expression Problem
- The Expression Problem - Philip Wadler, 12 November 1998
- The Expression Problem
- Data types à la carte
- C9 Lectures: Dr. Ralf Lämmel - Advanced Functional Programming - The Expression Problem
- The Expression Problem
- Extensible ADT (EADT)
Tagless Final
- Typed Tagless Final Interpreters
- Typed tagless-final interpretations: Lecture notes
- Reducing boilerplate in finally tagless style
- Typed Tagless Final Bioinformatics
- Free monads are very much `initial’. Compare the final approach: http://okmij.o… | Hacker News
- Optimizing Tagless Final – The Science of Code
- Introduction to Tagless Final - Serokell
- Magnus web site | Random stuff
- Tagless Final Encoding in Haskell
- Final tagless encodings have little to do with typeclasses – Foxhound Systems