This repository has been archived by the owner on May 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
226 additions
and
142 deletions.
There are no files selected for viewing
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 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 file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
## Module Control.Arrow | ||
|
||
Type classes and standard instances for Arrows. | ||
|
||
#### `Arrow` | ||
|
||
``` purescript | ||
class (Category a, Strong a) <= Arrow a | ||
``` | ||
|
||
The `Arrow` type class combines the operations of a `Category` with those of | ||
a `Strong` profunctor. | ||
|
||
##### Instances | ||
``` purescript | ||
instance arrowFunction :: Arrow Function | ||
``` | ||
|
||
#### `ArrowZero` | ||
|
||
``` purescript | ||
class (Arrow a) <= ArrowZero a where | ||
azero :: forall b c. a b c | ||
``` | ||
|
||
Arrows with zero morphisms | ||
|
||
#### `ArrowPlus` | ||
|
||
``` purescript | ||
class (ArrowZero a) <= ArrowPlus a where | ||
aplus :: forall b c. a b c -> a b c -> a b c | ||
``` | ||
|
||
Arrows with a monoidal operation on morphisms | ||
|
||
#### `(<+>)` | ||
|
||
``` purescript | ||
(<+>) :: forall a b c. (ArrowPlus a) => a b c -> a b c -> a b c | ||
``` | ||
|
||
An infix alias for `aplus`. | ||
|
||
|
41 changes: 9 additions & 32 deletions
41
docs/Control.Arrow.Cokleisli.md → docs/Control/Arrow/Cokleisli.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,33 @@ | ||
# Module Documentation | ||
|
||
## Module Control.Arrow.Cokleisli | ||
|
||
The `Cokleisli` arrow for a `Comonad`. | ||
|
||
#### `Cokleisli` | ||
|
||
``` purescript | ||
newtype Cokleisli w a b | ||
= Cokleisli (w a -> b) | ||
``` | ||
|
||
`Cokleisli` gives an `Arrow` instance for the Co-Kleisli category of a `Comonad`. | ||
|
||
#### `runCokleisli` | ||
|
||
``` purescript | ||
runCokleisli :: forall w a b. Cokleisli w a b -> w a -> b | ||
``` | ||
|
||
|
||
#### `semigroupoidCokleisli` | ||
Composition is defined using `=>=` with `extract` as the identity morhism. | ||
|
||
##### Instances | ||
``` purescript | ||
instance semigroupoidCokleisli :: (Extend m) => Semigroupoid (Cokleisli m) | ||
``` | ||
|
||
|
||
#### `categoryCokleisli` | ||
|
||
``` purescript | ||
instance categoryCokleisli :: (Comonad m) => Category (Cokleisli m) | ||
``` | ||
|
||
|
||
#### `profunctorCokleisli` | ||
|
||
``` purescript | ||
instance profunctorCokleisli :: (Functor f) => Profunctor (Cokleisli f) | ||
``` | ||
|
||
|
||
#### `strongCokleisli` | ||
|
||
``` purescript | ||
instance strongCokleisli :: (Comonad m) => Strong (Cokleisli m) | ||
instance arrowCokleisli :: (Comonad m) => Arrow (Cokleisli m) | ||
``` | ||
|
||
|
||
#### `arrowCokleisli` | ||
#### `runCokleisli` | ||
|
||
``` purescript | ||
instance arrowCokleisli :: (Comonad m) => Arrow (Cokleisli m) | ||
runCokleisli :: forall w a b. Cokleisli w a b -> w a -> b | ||
``` | ||
|
||
|
||
Unpack a `Cokleisli` arrow. | ||
|
||
|
45 changes: 12 additions & 33 deletions
45
docs/Control.Arrow.Kleisli.md → docs/Control/Arrow/Kleisli.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,35 @@ | ||
# Module Documentation | ||
|
||
## Module Control.Arrow.Kleisli | ||
|
||
The `Kleisli` arrow for a `Monad`. | ||
|
||
#### `Kleisli` | ||
|
||
``` purescript | ||
newtype Kleisli m a b | ||
= Kleisli (a -> m b) | ||
``` | ||
|
||
`Kleisli` gives an `Arrow` instance for the Kleisli category of a `Monad`. | ||
|
||
#### `runKleisli` | ||
|
||
``` purescript | ||
runKleisli :: forall m a b. Kleisli m a b -> a -> m b | ||
``` | ||
|
||
|
||
#### `semigroupoidKleisli` | ||
Composition is defined using `>=>` with `return` as the identity morhism. | ||
|
||
##### Instances | ||
``` purescript | ||
instance semigroupoidKleisli :: (Monad m) => Semigroupoid (Kleisli m) | ||
``` | ||
|
||
|
||
#### `categoryKleisli` | ||
|
||
``` purescript | ||
instance categoryKleisli :: (Monad m) => Category (Kleisli m) | ||
``` | ||
|
||
|
||
#### `profunctorKleisli` | ||
|
||
``` purescript | ||
instance profunctorKleisli :: (Functor f) => Profunctor (Kleisli f) | ||
instance strongKleisli :: (Functor m) => Strong (Kleisli m) | ||
instance arrowKleisli :: (Monad m) => Arrow (Kleisli m) | ||
instance arrowZeroKleisli :: (MonadPlus m) => ArrowZero (Kleisli m) | ||
instance arrowPlusKleisli :: (MonadPlus m) => ArrowPlus (Kleisli m) | ||
``` | ||
|
||
|
||
#### `strongKleisli` | ||
|
||
``` purescript | ||
instance strongKleisli :: (Monad m) => Strong (Kleisli m) | ||
``` | ||
|
||
|
||
#### `arrowKleisli` | ||
#### `runKleisli` | ||
|
||
``` purescript | ||
instance arrowKleisli :: (Monad m) => Arrow (Kleisli m) | ||
runKleisli :: forall m a b. Kleisli m a b -> a -> m b | ||
``` | ||
|
||
|
||
Unpack a `Kleisli` arrow. | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
## Module Control.Arrow.Static | ||
|
||
The `Static` arrow transformer for an `Applicative` functor. | ||
|
||
#### `Static` | ||
|
||
``` purescript | ||
newtype Static f a b c | ||
= Static (f (a b c)) | ||
``` | ||
|
||
`Static` gives an `Arrow` instance for the static arrows of an `Applicative` functor. | ||
|
||
##### Instances | ||
``` purescript | ||
instance semigroupoidStatic :: (Applicative f, Semigroupoid a) => Semigroupoid (Static f a) | ||
instance categoryStatic :: (Applicative f, Category a) => Category (Static f a) | ||
instance profunctorStatic :: (Functor f, Profunctor a) => Profunctor (Static f a) | ||
instance strongStatic :: (Functor f, Strong a) => Strong (Static f a) | ||
instance choiceStatic :: (Functor f, Choice a) => Choice (Static f a) | ||
instance arrowStatic :: (Applicative f, Arrow a) => Arrow (Static f a) | ||
``` | ||
|
||
#### `runStatic` | ||
|
||
``` purescript | ||
runStatic :: forall f a b c. Static f a b c -> f (a b c) | ||
``` | ||
|
||
Unpack a `Static` arrow. | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,54 @@ | ||
/* jshint node: true */ | ||
"use strict"; | ||
|
||
var gulp = require("gulp"); | ||
var plumber = require("gulp-plumber"); | ||
var purescript = require("gulp-purescript"); | ||
var jsvalidate = require("gulp-jsvalidate"); | ||
var rimraf = require("rimraf"); | ||
|
||
var paths = [ | ||
var sources = [ | ||
"src/**/*.purs", | ||
"bower_components/purescript-*/src/**/*.purs" | ||
]; | ||
|
||
gulp.task("make", function() { | ||
return gulp.src(paths) | ||
.pipe(plumber()) | ||
.pipe(purescript.pscMake()); | ||
}); | ||
var foreigns = [ | ||
"src/**/*.js", | ||
"bower_components/purescript-*/src/**/*.js" | ||
]; | ||
|
||
gulp.task("jsvalidate", ["make"], function () { | ||
return gulp.src("output/**/*.js") | ||
.pipe(plumber()) | ||
.pipe(jsvalidate()); | ||
gulp.task("clean-docs", function (cb) { | ||
rimraf("docs", cb); | ||
}); | ||
|
||
var docTasks = []; | ||
gulp.task("clean-output", function (cb) { | ||
rimraf("output", cb); | ||
}); | ||
|
||
var docTask = function(name) { | ||
var taskName = "docs-" + name.toLowerCase(); | ||
gulp.task(taskName, function () { | ||
return gulp.src("src/" + name.replace(/\./g, "/") + ".purs") | ||
.pipe(plumber()) | ||
.pipe(purescript.pscDocs()) | ||
.pipe(gulp.dest("docs/" + name + ".md")); | ||
}); | ||
docTasks.push(taskName); | ||
}; | ||
gulp.task("clean", ["clean-docs", "clean-output"]); | ||
|
||
["Control.Arrow", "Control.Arrow.Kleisli", "Control.Arrow.Cokleisli"].forEach(docTask); | ||
gulp.task("make", function() { | ||
return gulp.src(sources) | ||
.pipe(plumber()) | ||
.pipe(purescript.pscMake({ ffi: foreigns })); | ||
}); | ||
|
||
gulp.task("docs", docTasks); | ||
gulp.task("docs", ["clean-docs"], function () { | ||
return gulp.src(sources) | ||
.pipe(plumber()) | ||
.pipe(purescript.pscDocs({ | ||
docgen: { | ||
"Control.Arrow": "docs/Control/Arrow.md", | ||
"Control.Arrow.Kleisli": "docs/Control/Arrow/Kleisli.md", | ||
"Control.Arrow.Cokleisli": "docs/Control/Arrow/Cokleisli.md", | ||
"Control.Arrow.Static": "docs/Control/Arrow/Static.md" | ||
} | ||
})); | ||
}); | ||
|
||
gulp.task("dotpsci", function () { | ||
return gulp.src(paths) | ||
return gulp.src(sources) | ||
.pipe(plumber()) | ||
.pipe(purescript.dotPsci()); | ||
}); | ||
|
||
gulp.task("default", ["jsvalidate", "docs", "dotpsci"]); | ||
gulp.task("default", ["make", "docs", "dotpsci"]); |
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
Oops, something went wrong.