-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from zrho/master
New classes: Closed, Costrong and Cochoice
- Loading branch information
Showing
6 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Module Data.Profunctor.Closed | ||
|
||
#### `Closed` | ||
|
||
``` purescript | ||
class (Profunctor p) <= Closed p where | ||
closed :: forall a b x. p a b -> p (x -> a) (x -> b) | ||
``` | ||
|
||
The `Closed` class extends the `Profunctor` class to work with functions. | ||
|
||
##### Instances | ||
``` purescript | ||
instance closedFunction :: Closed Function | ||
``` | ||
|
||
|
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,13 @@ | ||
## Module Data.Profunctor.Cochoice | ||
|
||
#### `Cochoice` | ||
|
||
``` purescript | ||
class (Profunctor p) <= Cochoice p where | ||
unleft :: forall a b c. p (Either a c) (Either b c) -> p a b | ||
unright :: forall a b c. p (Either a b) (Either a c) -> p b c | ||
``` | ||
|
||
The `Cochoice` class provides the dual operations of the `Choice` class. | ||
|
||
|
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,13 @@ | ||
## Module Data.Profunctor.Costrong | ||
|
||
#### `Costrong` | ||
|
||
``` purescript | ||
class (Profunctor p) <= Costrong p where | ||
unfirst :: forall a b c. p (Tuple a c) (Tuple b c) -> p a b | ||
unsecond :: forall a b c. p (Tuple a b) (Tuple a c) -> p b c | ||
``` | ||
|
||
The `Costrong` class provides the dual operations of the `Strong` class. | ||
|
||
|
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,12 @@ | ||
module Data.Profunctor.Closed where | ||
|
||
import Prelude | ||
|
||
import Data.Profunctor | ||
|
||
-- | The `Closed` class extends the `Profunctor` class to work with functions. | ||
class (Profunctor p) <= Closed p where | ||
closed :: forall a b x. p a b -> p (x -> a) (x -> b) | ||
|
||
instance closedFunction :: Closed Function where | ||
closed = (<<<) |
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,11 @@ | ||
module Data.Profunctor.Cochoice where | ||
|
||
import Prelude | ||
|
||
import Data.Either (Either ()) | ||
import Data.Profunctor | ||
|
||
-- | The `Cochoice` class provides the dual operations of the `Choice` class. | ||
class (Profunctor p) <= Cochoice p where | ||
unleft :: forall a b c. p (Either a c) (Either b c) -> p a b | ||
unright :: forall a b c. p (Either a b) (Either a c) -> p b c |
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,11 @@ | ||
module Data.Profunctor.Costrong where | ||
|
||
import Prelude | ||
|
||
import Data.Tuple (Tuple ()) | ||
import Data.Profunctor | ||
|
||
-- | The `Costrong` class provides the dual operations of the `Strong` class. | ||
class (Profunctor p) <= Costrong p where | ||
unfirst :: forall a b c. p (Tuple a c) (Tuple b c) -> p a b | ||
unsecond :: forall a b c. p (Tuple a b) (Tuple a c) -> p b c |