You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Right-to-left composition of functors. The composition of applicative functors is always applicative, but the composition of monads is not always a monad.
/// <summary> The Const functor, defined as Const<'T, 'U> where 'U is a phantom type. Useful for: Lens getters Its applicative instance plays a fundamental role in Lens.
9
+
/// <para/> Useful for: Lens getters.
10
+
/// <para/> Its applicative instance plays a fundamental role in Lens. </summary>
11
+
[<Struct>]
12
+
typeConst<'t,'u>= Const of'twith
13
+
14
+
// Monoid
15
+
static member inlineget_Zero()= Const (getZero ()): Const<'T, 'U>
16
+
static member inline(+)(Const x:Const<'T,'U>,Const y:Const<'T,'U>):Const<'T,'U>= Const (plus x y)
17
+
18
+
/// Basic operations on Const
19
+
[<RequireQualifiedAccess>]
20
+
moduleConst =
21
+
letrun(Const t)= t
22
+
letmap(_:'T ->'U)(Const x:Const<_,'T>):Const<'C,'U>= Const x
23
+
let inlineapply(Const f:Const<'C,'T->'U>)(Const x:Const<'C,'T>):Const<'C,'U>= Const (plus f x)
24
+
25
+
typeConst<'t,'u>with
26
+
27
+
// Functor
28
+
static memberMap(Const x:Const<_,'T>,_:'T ->'U):Const<'C,'U>= Const x
29
+
30
+
/// <summary>Lifts a function into a Const. Same as map.
31
+
/// To be used in Applicative Style expressions, combined with <*>
32
+
/// </summary>
33
+
/// <category index="1">Functor</category>
34
+
static member(<!>)(_:'T ->'U,Const x:Const<_,'T>):Const<'C,'U>= Const x
35
+
36
+
// Applicative
37
+
static member inlineReturn(_:'U)= Const (getZero ()): Const<'T, 'U>
38
+
static member inline(<*>)(Const f:Const<'C,'T->'U>,Const x:Const<'C,'T>):Const<'C,'U>= Const (plus f x)
39
+
40
+
/// <summary>
41
+
/// Sequences two Consts left-to-right, discarding the value of the first argument.
42
+
/// </summary>
43
+
/// <category index="2">Applicative</category>
44
+
static member inline(*>)(Const x:Const<'C,'T>,Const y:Const<'C,'U>):Const<'C,'U>= Const (plus x y)
45
+
46
+
/// <summary>
47
+
/// Sequences two Consts left-to-right, discarding the value of the second argument.
48
+
/// </summary>
49
+
/// <category index="2">Applicative</category>
50
+
static member inline(<*)(Const x:Const<'C,'U>,Const y:Const<'C,'T>):Const<'C,'U>= Const (plus x y)
51
+
52
+
static member inlineLift2(_:'T ->'U ->'V,Const x:Const<'C,'T>,Const y:Const<'C,'U>):Const<'C,'V>= Const (plus x y)
53
+
static member inlineLift3(_:'T ->'U ->'V ->'W,Const x:Const<'C,'T>,Const y:Const<'C,'U>,Const z:Const<'C,'V>):Const<'C,'W>= Const (x ++ y ++ z)
54
+
55
+
// Contravariant
56
+
static memberContramap(Const x:Const<'C,'T>,_:'U ->'T):Const<'C,'U>= Const x
/// <summary> The Const functor, defined as Const<'T, 'U> where 'U is a phantom type. Useful for: Lens getters Its applicative instance plays a fundamental role in Lens.
46
-
/// <para/> Useful for: Lens getters.
47
-
/// <para/> Its applicative instance plays a fundamental role in Lens. </summary>
48
-
[<Struct>]
49
-
typeConst<'t,'u>= Const of'twith
50
-
51
-
// Monoid
52
-
static member inlineget_Zero()= Const (getZero ()): Const<'T,'U>
53
-
static member inline(+)(Const x:Const<'T,'U>,Const y:Const<'T,'U>)= Const (plus x y): Const<'T,'U>
54
-
55
-
/// Basic operations on Const
56
-
[<RequireQualifiedAccess>]
57
-
moduleConst =
58
-
letrun(Const t)= t
59
-
letmap(_:'T ->'U)(Const x:Const<_,'T>):Const<'C,'U>= Const x
60
-
let inlineapply(Const f:Const<'C,'T->'U>)(Const x:Const<'C,'T>):Const<'C,'U>= Const (plus f x)
61
-
62
-
typeConst<'t,'u>with
63
-
64
-
// Functor
65
-
static memberMap(Const x:Const<_,'T>,_:'T->'U)= Const x : Const<'C,'U>
66
-
67
-
/// <summary>Lifts a function into a Const. Same as map.
68
-
/// To be used in Applicative Style expressions, combined with <*>
69
-
/// </summary>
70
-
/// <category index="1">Functor</category>
71
-
static member(<!>)(_:'T->'U,Const x:Const<_,'T>):Const<'C,'U>= Const x
72
-
73
-
// Applicative
74
-
static member inlineReturn(_:'U)= Const (getZero ()): Const<'T,'U>
75
-
static member inline(<*>)(Const f:Const<'C,'T->'U>,Const x:Const<'C,'T>)= Const (plus f x): Const<'C,'U>
76
-
77
-
/// <summary>
78
-
/// Sequences two Consts left-to-right, discarding the value of the first argument.
79
-
/// </summary>
80
-
/// <category index="2">Applicative</category>
81
-
static member inline(*>)(Const x:Const<'C,'T>,Const y:Const<'C,'U>):Const<'C,'U>= Const (plus x y)
82
-
83
-
/// <summary>
84
-
/// Sequences two Consts left-to-right, discarding the value of the second argument.
85
-
/// </summary>
86
-
/// <category index="2">Applicative</category>
87
-
static member inline(<*)(Const x:Const<'C,'U>,Const y:Const<'C,'T>):Const<'C,'U>= Const (plus x y)
88
-
89
-
static member inlineLift2(_:'T->'U->'V,Const x:Const<'C,'T>,Const y:Const<'C,'U>)= Const (plus x y): Const<'C,'V>
90
-
static member inlineLift3(_:'T->'U->'V->'W,Const x:Const<'C,'T>,Const y:Const<'C,'U>,Const z:Const<'C,'V>)= Const (x ++ y ++ z): Const<'C,'W>
91
-
92
-
// Contravariant
93
-
static memberContramap(Const x:Const<'C,'T>,_:'U->'T)= Const x : Const<'C,'U>
let(_:'``Functor<Const<'T2,'U2>>``)= map (Unchecked.defaultof<'U2 -> Const<'T2,'U2>>) a
110
-
()
111
-
(Const :_-> Const<'T2,'U2>)<!> f x
112
-
113
-
114
-
#endif
115
-
116
42
/// Option<'T> monoid returning the leftmost non-None value.
117
43
[<Struct>]
118
44
typeFirst<'t>= First ofOption<'t>with
@@ -136,63 +62,4 @@ type Mult<'a> = Mult of 'a with
136
62
static member inlineget_Zero()= Mult one
137
63
static member inline(+)(Mult (x:'n),Mult (y:'n))= Mult (x * y)
138
64
139
-
140
-
openFSharpPlus.Control
141
-
142
-
/// Right-to-left composition of functors. The composition of applicative functors is always applicative, but the composition of monads is not always a monad.
/// Sequences two composed applicatives left-to-right, discarding the value of the first argument.
163
-
/// </summary>
164
-
/// <category index="2">Applicative</category>
165
-
static member inline(*>)(x:'``FunctorF<'FunctorG<'T>>``, y: '``FunctorF<'FunctorG<'U>>``):'``FunctorF<'FunctorG<'U>>`` =((fun(_: 'T)(k: 'U)-> k)<!> x : '``FunctorF<'FunctorG<'U->'U>>``)<*> y
166
-
167
-
/// <summary>
168
-
/// Sequences two composed applicatives left-to-right, discarding the value of the second argument.
169
-
/// </summary>
170
-
/// <category index="2">Applicative</category>
171
-
static member inline(<*)(x:'``FunctorF<'FunctorG<'U>>``, y: '``FunctorF<'FunctorG<'T>>``):'``FunctorF<'FunctorG<'U>>`` =((fun(k: 'U)(_: 'T)-> k )<!> x : '``FunctorF<'FunctorG<'T->'U>>``)<*> y
172
-
173
-
static member inlineLift2(f:'T ->'U ->'V,Compose (x:'``ApplicativeF<'ApplicativeG<'T>``),Compose (y:'``ApplicativeF<'ApplicativeG<'U>``))=
174
-
Compose (Lift2.Invoke (Lift2.Invoke f: '``ApplicativeG<'T>``-> '``ApplicativeG<'U>``-> '``ApplicativeG<'V>``) x y: '``ApplicativeF<'ApplicativeG<'V>``)
175
-
176
-
static member inlineLift3(f:'T ->'U ->'V ->'W,Compose (x:'``ApplicativeF<'ApplicativeG<'T>``),Compose (y:'``ApplicativeF<'ApplicativeG<'U>``),Compose (z:'``ApplicativeF<'ApplicativeG<'V>``))=
177
-
Compose (Lift3.Invoke (Lift3.Invoke f: '``ApplicativeG<'T>``-> '``ApplicativeG<'U>``-> '``ApplicativeG<'V>``-> '``ApplicativeG<'W>``) x y z: '``ApplicativeF<'ApplicativeG<'W>``)
178
-
179
-
// Alternative
180
-
static member inlineget_Empty()= Compose (getEmpty ()): Compose<'``AlternativeF<'ApplicativeG<'T>``>
181
-
static member inline(<|>)(Compose x,Compose y)= Compose (x <|> y): Compose<'``AlternativeF<'ApplicativeG<'T>``>
182
-
183
-
// ZipApplicative
184
-
static member inline(<.>)(Compose (f:'``ApplicativeF<'ApplicativeG<'T->'U>``),Compose (x:'``ApplicativeF<'ApplicativeG<'T>``))=
0 commit comments