File tree Expand file tree Collapse file tree 4 files changed +60
-2
lines changed Expand file tree Collapse file tree 4 files changed +60
-2
lines changed Original file line number Diff line number Diff line change 17
17
18
18
lmap :: forall a b c p. (Profunctor p) => (a -> b) -> p b c -> p a c
19
19
20
- rmap :: forall a b c p. (Profunctor p) => (b -> c) -> p a b -> p a c
20
+ rmap :: forall a b c p. (Profunctor p) => (b -> c) -> p a b -> p a c
21
+
22
+
23
+ ## Module Data.Profunctor.Choice
24
+
25
+ ### Type Classes
26
+
27
+ class (Profunctor p) <= Choice p where
28
+ left :: forall a b c. p a b -> p (Either a c) (Either b c)
29
+ right :: forall a b c. p b c -> p (Either a b) (Either a c)
30
+
31
+
32
+ ### Type Class Instances
33
+
34
+ instance choiceArr :: Choice Prim.Function
35
+
36
+
37
+ ## Module Data.Profunctor.Strong
38
+
39
+ ### Type Classes
40
+
41
+ class (Profunctor p) <= Strong p where
42
+ first :: forall a b c. p a b -> p (Tuple a c) (Tuple b c)
43
+ second :: forall a b c. p b c -> p (Tuple a b) (Tuple a c)
44
+
45
+
46
+ ### Type Class Instances
47
+
48
+ instance strongArr :: Strong Prim.Function
Original file line number Diff line number Diff line change 19
19
" bower.json" ,
20
20
" Gruntfile.js" ,
21
21
" package.json"
22
- ]
22
+ ],
23
+ "dependencies" : {
24
+ "purescript-either" : " ~0.1.4" ,
25
+ "purescript-tuples" : " ~0.2.2"
26
+ }
23
27
}
Original file line number Diff line number Diff line change
1
+ module Data.Profunctor.Choice where
2
+
3
+ import Data.Either (Either (..))
4
+ import Data.Profunctor (Profunctor )
5
+
6
+ class (Profunctor p ) <= Choice p where
7
+ left :: forall a b c. p a b -> p (Either a c ) (Either b c )
8
+ right :: forall a b c. p b c -> p (Either a b ) (Either a c )
9
+
10
+ instance choiceArr :: Choice (->) where
11
+ left a2b (Left a ) = Left $ a2b a
12
+ left _ (Right c ) = Right c
13
+
14
+ right = (<$>)
Original file line number Diff line number Diff line change
1
+ module Data.Profunctor.Strong where
2
+
3
+ import Data.Profunctor (Profunctor )
4
+ import Data.Tuple (Tuple (..))
5
+
6
+ class (Profunctor p ) <= Strong p where
7
+ first :: forall a b c. p a b -> p (Tuple a c ) (Tuple b c )
8
+ second :: forall a b c. p b c -> p (Tuple a b ) (Tuple a c )
9
+
10
+ instance strongArr :: Strong (->) where
11
+ first a2b (Tuple a c ) = Tuple (a2b a ) c
12
+ second = (<$>)
You can’t perform that action at this time.
0 commit comments