Skip to the content. コモナド モナドの圏論的双対 class Functor w => Comonad w where extract :: w a -> a duplicate :: w a -> w (w a) extend :: (w b -> a) -> w b -> w a duplicate = extend id extend f = fmap f . duplicate
Skip to the content. コモナド モナドの圏論的双対 class Functor w => Comonad w where extract :: w a -> a duplicate :: w a -> w (w a) extend :: (w b -> a) -> w b -> w a duplicate = extend id extend f = fmap f . duplicate
Zipperというデータ構造について、図を使ってわかりやすく解説したいと思います。 この記事ではZipperがどういったものかは説明しますが、それがどう応用されうるかは紹介しません。 応用例については、少し長いですが以下の記事がわかりやすかったです。 Haskell/Zippers - Wikibooks また、ComonadとしてのZipperの応用例は、以下の記事がとてもわかりやすかったです。 コモナドを使った抽象化の威力をライフゲームで試してみた - Qiita ただ、Haskellは遅延評価で、PureScriptは正格評価なので、この記事とは実装がところどころ異なります。 サンプルコードはPureScriptですが読めなくても図さえ見れば理解に大きな支障はないと思います。 これは余談ですが、シンタックスハイライトの関係で```haskell ... ```でコードブロック書いてる
I took part in the Dagstuhl Seminar on Bidirectional Transformations “BX” earlier this month. It was a meeting of people from four communities—databases, graph transformations, programming languages, and software engineering—discussing their various perspectives—namely the view–update problem in databases, triple graph grammars, lenses, and model synchronization—on the common problem of “BX”. Whil
codo-notation: A notation for comonads, analogous to the do-notation for monads. A notation for comonads, analogous to the do-notation for monads. Requires the TemplateHaskell and QuasiQuotes extensions. Example 1: {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE QuasiQuotes #-} import Control.Comonad import Language.Haskell.Codo foo :: (Comonad c, Num a) => c a -> a foo = [codo| x => extract x + 1 |
The Day convolution of two functors is another functor, defined as follows: data Day f g a where Day :: (x -> y -> a) -> f x -> g y -> Day f g a There is an implementation of Day in Edward Kmett's kan-extensions package on Hackage. Day Convolution of Comonads While writing my last post, I was looking for a way to combine comonads, and found out some interesting things about Day convolution in the
by Phil Freeman on 2016/08/07 I feel like I've had a good intuition for monads for some time, but I've struggled to really get a handle on comonads until recently. I'd like to present an application of comonads which I think provides a helpful intuition, and then interpret several comonads in that setting. Introduction In PureScript, we have several user interface libraries. They are all slightly
Monads, monad transformers and free monads are commonly used and understood, but the comonadic equivalents have received a lot less attention. The goal of this talk is to discuss comonads, comonad transformers, and cofree comonads.the different perspective they provide, and how they can be used as a better abstraction for some problems. The first half of the talk will be building up the intuition
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く