-
-
Notifications
You must be signed in to change notification settings - Fork 504
/
Profunctor.ts
59 lines (52 loc) · 1.73 KB
/
Profunctor.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* @since 2.0.0
*/
import { Functor2, Functor2C, Functor3, Functor3C, Functor4 } from './Functor'
import { HKT, HKT2, Kind2, Kind3, Kind4, URIS2, URIS3, URIS4 } from './HKT'
// -------------------------------------------------------------------------------------
// model
// -------------------------------------------------------------------------------------
/**
* @category model
* @since 2.0.0
*/
export interface Profunctor<F> {
readonly URI: F
readonly map: <E, A, B>(fa: HKT2<F, E, A>, f: (a: A) => B) => HKT<F, B>
readonly promap: <E, A, D, B>(fea: HKT2<F, E, A>, f: (d: D) => E, g: (a: A) => B) => HKT2<F, D, B>
}
/**
* @category model
* @since 2.0.0
*/
export interface Profunctor2<F extends URIS2> extends Functor2<F> {
readonly promap: <E, A, D, B>(fea: Kind2<F, E, A>, f: (d: D) => E, g: (a: A) => B) => Kind2<F, D, B>
}
/**
* @category model
* @since 2.0.0
*/
export interface Profunctor2C<F extends URIS2, E> extends Functor2C<F, E> {
readonly promap: <A, D, B>(fea: Kind2<F, E, A>, f: (d: D) => E, g: (a: A) => B) => Kind2<F, D, B>
}
/**
* @category model
* @since 2.0.0
*/
export interface Profunctor3<F extends URIS3> extends Functor3<F> {
readonly promap: <R, E, A, D, B>(fea: Kind3<F, R, E, A>, f: (d: D) => E, g: (a: A) => B) => Kind3<F, R, D, B>
}
/**
* @category model
* @since 2.2.0
*/
export interface Profunctor3C<F extends URIS3, E> extends Functor3C<F, E> {
readonly promap: <R, A, D, B>(fea: Kind3<F, R, E, A>, f: (d: D) => E, g: (a: A) => B) => Kind3<F, R, D, B>
}
/**
* @category model
* @since 2.0.0
*/
export interface Profunctor4<F extends URIS4> extends Functor4<F> {
readonly promap: <S, R, E, A, D, B>(fea: Kind4<F, S, R, E, A>, f: (d: D) => E, g: (a: A) => B) => Kind4<F, S, R, D, B>
}