Skip to content

Commit

Permalink
Merge pull request #13 from zrho/master
Browse files Browse the repository at this point in the history
New classes: Closed, Costrong and Cochoice
  • Loading branch information
paf31 committed Jan 3, 2016
2 parents 862bde8 + e562587 commit 933a71c
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/Data/Profunctor/Closed.md
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
```


13 changes: 13 additions & 0 deletions docs/Data/Profunctor/Cochoice.md
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.


13 changes: 13 additions & 0 deletions docs/Data/Profunctor/Costrong.md
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.


12 changes: 12 additions & 0 deletions src/Data/Profunctor/Closed.purs
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 = (<<<)
11 changes: 11 additions & 0 deletions src/Data/Profunctor/Cochoice.purs
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
11 changes: 11 additions & 0 deletions src/Data/Profunctor/Costrong.purs
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

0 comments on commit 933a71c

Please sign in to comment.