All Projects → paf31 → purescript-smash

paf31 / purescript-smash

Licence: MIT license
An "extensible coeffect" system built out of comonads and Day convolution.

Programming Languages

purescript
368 projects

Labels

Projects that are alternatives of or similar to purescript-smash

my-notes
工程师的自我修养
Stars: ✭ 28 (-22.22%)
Mutual labels:  effects
habbo-downloader
⚡A tiny script to download various files directly from Habbo.
Stars: ✭ 47 (+30.56%)
Mutual labels:  effects
waveguide
An effect/IO datatype in typescript
Stars: ✭ 102 (+183.33%)
Mutual labels:  effects
xamarin-forms-statusbar
Xamarin.Forms Effect to manage the StatusBar BackgroundColor.
Stars: ✭ 16 (-55.56%)
Mutual labels:  effects
comfy-scenes
A rudimentary app for interactive Twitch scenes using Vue.js. It monitors your Twitch channel chat for !commands using Comfy.js (by instafluff and others), plays mp3 files, loads images, and interacts with Vue.js components.
Stars: ✭ 24 (-33.33%)
Mutual labels:  effects
UnityChanToonShaderVer2 VerticalDissolve
UnityChanToonShaderVer2 with VerticalDissolve
Stars: ✭ 31 (-13.89%)
Mutual labels:  effects
Axanimationchain
AXAnimationChain is a chain animation library, can be used to easily create CAAnimation based chain animation. There are two kinds of combination chain, one is called combination, the other is called link, created by the two ways above, the animation can be carried out at the same time, can also according to the time order, you can use the code to create a rich and complex animation.
Stars: ✭ 234 (+550%)
Mutual labels:  effects
images-processing
Project of computational mathematics, image processing, eliminating the noise of an image, reflection of an image and canny filter
Stars: ✭ 23 (-36.11%)
Mutual labels:  effects
Messier87
A realtime raytracing blackhole renderer
Stars: ✭ 53 (+47.22%)
Mutual labels:  effects
effector-reeffect
Concurrent effects for Effector ☄️
Stars: ✭ 56 (+55.56%)
Mutual labels:  effects
SoxSharp
.NET wrapper for SoX.
Stars: ✭ 41 (+13.89%)
Mutual labels:  effects
jeff
Effects for Java
Stars: ✭ 14 (-61.11%)
Mutual labels:  effects
UGUI-Effect
Efectos para la nueva UI
Stars: ✭ 14 (-61.11%)
Mutual labels:  effects
UnityGUI
UGUI Panel Systems for navigation, animation and more
Stars: ✭ 80 (+122.22%)
Mutual labels:  effects
palettify
Configurable JavaScript plugin to extract image primary colors and apply cool effects to it.
Stars: ✭ 18 (-50%)
Mutual labels:  effects
freedsl
Practical effect composition library based on abstract wrapping type and the free monad
Stars: ✭ 37 (+2.78%)
Mutual labels:  effects
effet
An effect system based on type classes, written in Haskell.
Stars: ✭ 36 (+0%)
Mutual labels:  effects
eruption
Realtime RGB LED Driver for Linux
Stars: ✭ 140 (+288.89%)
Mutual labels:  effects
ReduxSimple
Simple Stupid Redux Store using Reactive Extensions
Stars: ✭ 119 (+230.56%)
Mutual labels:  effects
online-training
Online Training website using ASP.Net Core 2.0 & Angular 4
Stars: ✭ 26 (-27.78%)
Mutual labels:  effects

purescript-smash

Extensible coeffects using comonads and Day convolution.

Getting Started

bower update
pulp build
pulp test

Introduction

Given a monoidal category (𝒞, ⊗, I), we can combine any non-zero number of objects in 𝒞 using the repeated application of the tensor product . We can extend this to combinations of zero objects using unit object I.

Given a row of objects in the category 𝒞, we can combine the objects in the labels, and (in most cases) use the labels as "pointers" to the original objects inside the combination.

We already have several examples of this:

  • Records are n-ary tuples, and the labels can be used to construct polymorphic lenses which identify the type of each label as part of the product type.
  • Variants (e.g. purescript-variant) are n-ary sums, and the labels can be used to construct polymorphic prisms which identify the type of each label as a summand.
  • Higher-order variants (e.g. as used in purescript-run) are n-ary functor coproducts. We could use the labels to construct "functor coproduct optics".

This library constructs a data type Smash in the same way out of the symmetric monoidal category (★ → ★, Day, Identity) of functors and Day convolution.

We can use this data type to model extensible coeffects, in much the same way that purescript-run uses higher-order variants to model extensible effects. First, note that Day convolution preserves comonadic structure, so Smash r is a comonad whenever the functors appearing in the row r are themselves comonads. So we can construct an interpreter for a combination of coeffects by combining the appropriate comonads.

Next, we can construct a monad of actions from our comonad, using Edward Kmett's monads-from-comonads constructor Co.

By starting with a comonadic interpreter instead of a monadic language, we can freely compose any coeffects, since unlike monads, comonads do compose nicely using Day convolution. However, this is not a full replacement for monad transformers and the MTL, since we cannot construct all monads in this way. There is no way to model IO, for example, or even exceptions in the style of Either.

Just like we can derive lenses and prisms from the labels in a record or variant type, we can derive optics which focus on individual comonads inside our Day convolution of comonads. The Data.Smash.Lens module implements this idea.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].