Skip to content

Commit 9b97e94

Browse files
committed
Merge pull request #7 from purescript/0.7
Readable names for class members
2 parents 11ad6c2 + 3c621ac commit 9b97e94

8 files changed

Lines changed: 29 additions & 17 deletions

File tree

docs/Control.Biapply.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,19 @@ the style of `Applicative`:
1515
bipure f g <<$>> x <<*>> y
1616
```
1717

18+
#### `(<<*>>)`
19+
20+
``` purescript
21+
(<<*>>) :: forall w a b c d. (Biapply w) => w (a -> b) (c -> d) -> w a c -> w b d
22+
```
23+
24+
An infix version of `biapply`.
25+
1826
#### `Biapply`
1927

2028
``` purescript
2129
class (Bifunctor w) <= Biapply w where
22-
(<<*>>) :: forall a b c d. w (a -> b) (c -> d) -> w a c -> w b d
30+
biapply :: forall a b c d. w (a -> b) (c -> d) -> w a c -> w b d
2331
```
2432

2533
`Biapply` captures type constructors of two arguments which support lifting of

src/Control/Biapply.purs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ infixl 4 *>>
1616
(<<$>>) :: forall a b. (a -> b) -> a -> b
1717
(<<$>>) = id
1818

19+
-- | An infix version of `biapply`.
20+
(<<*>>) :: forall w a b c d. (Biapply w) => w (a -> b) (c -> d) -> w a c -> w b d
21+
(<<*>>) = biapply
22+
1923
-- | `Biapply` captures type constructors of two arguments which support lifting of
2024
-- | functions of one or more arguments, in the sense of `Apply`.
2125
class (Bifunctor w) <= Biapply w where
22-
(<<*>>) :: forall a b c d. w (a -> b) (c -> d) -> w a c -> w b d
26+
biapply :: forall a b c d. w (a -> b) (c -> d) -> w a c -> w b d
2327

2428
-- | Keep the results of the second computation
2529
(*>>) :: forall w a b c d. (Biapply w) => w a b -> w c d -> w c d

src/Data/Bifunctor/Clown.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ runClown :: forall f a b. Clown f a b -> f a
1111
runClown (Clown fa) = fa
1212

1313
instance clownBifunctor :: (Functor f) => Bifunctor (Clown f) where
14-
bimap f _ = Clown <<< ((<$>) f) <<< runClown
14+
bimap f _ = Clown <<< map f <<< runClown
1515

1616
instance clownFunctor :: Functor (Clown f a) where
17-
(<$>) _ = Clown <<< runClown
17+
map _ = Clown <<< runClown
1818

1919
instance clownBiapply :: (Apply f) => Biapply (Clown f) where
20-
(<<*>>) (Clown fg) (Clown xy) = Clown (fg <*> xy)
20+
biapply (Clown fg) (Clown xy) = Clown (fg <*> xy)
2121

2222
instance clownBiapplicative :: (Applicative f) => Biapplicative (Clown f) where
2323
bipure a _ = Clown (pure a)

src/Data/Bifunctor/Flip.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ runFlip :: forall p a b. Flip p a b -> p b a
1212
runFlip (Flip pba) = pba
1313

1414
instance flipBifunctor :: (Bifunctor p) => Bifunctor (Flip p) where
15-
bimap f g = Flip <<< (bimap g f) <<< runFlip
15+
bimap f g = Flip <<< bimap g f <<< runFlip
1616

1717
instance flipFunctor :: (Bifunctor p) => Functor (Flip p a) where
18-
(<$>) f = Flip <<< lmap f <<< runFlip
18+
map f = Flip <<< lmap f <<< runFlip
1919

2020
instance flipBiapply :: (Biapply p) => Biapply (Flip p) where
21-
(<<*>>) (Flip fg) (Flip xy) = Flip (fg <<*>> xy)
21+
biapply (Flip fg) (Flip xy) = Flip (fg <<*>> xy)
2222

2323
instance flipBiapplicative :: (Biapplicative p) => Biapplicative (Flip p) where
2424
bipure a b = Flip (bipure b a)

src/Data/Bifunctor/Join.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ runJoin :: forall p a. Join p a -> p a a
1313
runJoin (Join paa) = paa
1414

1515
instance joinFunctor :: (Bifunctor p) => Functor (Join p) where
16-
(<$>) f = Join <$> bimap f f <<< runJoin
16+
map f = Join <$> bimap f f <<< runJoin
1717

1818
instance joinApply :: (Biapply p) => Apply (Join p) where
19-
(<*>) (Join f) (Join a) = Join (f <<*>> a)
19+
apply (Join f) (Join a) = Join (f <<*>> a)
2020

2121
instance joinApplicative :: (Biapplicative p) => Applicative (Join p) where
2222
pure a = Join (bipure a a)

src/Data/Bifunctor/Joker.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ runJoker :: forall g a b. Joker g a b -> g b
1111
runJoker (Joker gb) = gb
1212

1313
instance jokerBifunctor :: (Functor g) => Bifunctor (Joker g) where
14-
bimap _ g = Joker <<< ((<$>) g) <<< runJoker
14+
bimap _ g = Joker <<< map g <<< runJoker
1515

1616
instance jokerFunctor :: (Functor g) => Functor (Joker g a) where
17-
(<$>) g = Joker <<< ((<$>) g) <<< runJoker
17+
map g = Joker <<< map g <<< runJoker
1818

1919
instance jokerBiapply :: (Apply g) => Biapply (Joker g) where
20-
(<<*>>) (Joker fg) (Joker xy) = Joker (fg <*> xy)
20+
biapply (Joker fg) (Joker xy) = Joker (fg <*> xy)
2121

2222
instance jokerBiapplicative :: (Applicative g) => Biapplicative (Joker g) where
2323
bipure _ b = Joker (pure b)

src/Data/Bifunctor/Product.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ instance productBifunctor :: (Bifunctor f, Bifunctor g) => Bifunctor (Product f
1111
bimap f g (Pair x y) = Pair (bimap f g x) (bimap f g y)
1212

1313
instance productBiapply :: (Biapply f, Biapply g) => Biapply (Product f g) where
14-
(<<*>>) (Pair w x) (Pair y z) = Pair (w <<*>> y) (x <<*>> z)
14+
biapply (Pair w x) (Pair y z) = Pair (biapply w y) (biapply x z)
1515

1616
instance productBiapplicative :: (Biapplicative f, Biapplicative g) => Biapplicative (Product f g) where
1717
bipure a b = Pair (bipure a b) (bipure a b)

src/Data/Bifunctor/Wrap.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ unwrap :: forall p a b. Wrap p a b -> p a b
1313
unwrap (Wrap pab) = pab
1414

1515
instance wrapBifunctor :: (Bifunctor p) => Bifunctor (Wrap p) where
16-
bimap f g = Wrap <<< (bimap f g) <<< unwrap
16+
bimap f g = Wrap <<< bimap f g <<< unwrap
1717

1818
instance wrapFunctor :: (Bifunctor p) => Functor (Wrap p a) where
19-
(<$>) f = Wrap <<< rmap f <<< unwrap
19+
map f = Wrap <<< rmap f <<< unwrap
2020

2121
instance wrapBiapply :: (Biapply p) => Biapply (Wrap p) where
22-
(<<*>>) (Wrap fg) (Wrap xy) = Wrap (fg <<*>> xy)
22+
biapply (Wrap fg) (Wrap xy) = Wrap (fg <<*>> xy)
2323

2424
instance wrapBiapplicative :: (Biapplicative p) => Biapplicative (Wrap p) where
2525
bipure a b = Wrap (bipure a b)

0 commit comments

Comments
 (0)