Skip to content

Commit 6a3280b

Browse files
committed
Revert "Use DmStruct2"
This reverts commit cce7f35.
1 parent bdfe1f2 commit 6a3280b

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/FSharpPlus/Control/Applicative.fs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ type Apply =
3737
static member ``<*>`` ((f: Result<_,'E> , x: Result<'T,'E> ), _output: Result<'b,'E> , [<Optional>]_mthd: Apply) = Result.apply f x : Result<'U,'E>
3838
static member ``<*>`` ((f: Choice<_,'E> , x: Choice<'T,'E> ), _output: Choice<'b,'E> , [<Optional>]_mthd: Apply) = Choice.apply f x : Choice<'U,'E>
3939
static member inline ``<*>`` ((KeyValue(a: 'Key, f), KeyValue(b: 'Key, x: 'T)), _output: KeyValuePair<'Key,'U>, [<Optional>]_mthd: Default3) : KeyValuePair<'Key,'U> = KeyValuePair (Plus.Invoke a b, f x)
40-
static member inline ``<*>`` ((_: DmStruct2<'Key, _>, _: DmStruct2<'Key, 'T>) , _output: DmStruct2<'Key,'U> , [<Optional>]_mthd: Default3) : DmStruct2<'Key,'U> = Unchecked.defaultof<DmStruct2<'Key,'U>>
40+
static member inline ``<*>`` ((f: KeyValuePair2<'Key, _>, x: KeyValuePair2<'Key, 'T>), _output: KeyValuePair2<'Key,'U>, [<Optional>]_mthd: Default3) : KeyValuePair2<'Key,'U> =
41+
let a = f.Key
42+
let b = x.Key
43+
let f = f.Value
44+
let x = x.Value
45+
KeyValuePair2 (Plus.Invoke a b, f x)
4146

4247
static member ``<*>`` ((f: Map<'Key,_> , x: Map<'Key,'T> ) , _output: Map<'Key,'U> , [<Optional>]_mthd: Apply) : Map<'Key,'U> = Map (seq {
4348
for KeyValue(k, vf) in f do
@@ -60,7 +65,7 @@ type Apply =
6065
| true, vx -> dct.Add (k, vf vx)
6166
| _ -> ()
6267
dct :> IDictionary<'Key,'U>
63-
68+
6469
static member ``<*>`` ((f: IReadOnlyDictionary<'Key,_>, x: IReadOnlyDictionary<'Key,'T>) , _output: IReadOnlyDictionary<'Key,'U> , [<Optional>]_mthd: Apply) : IReadOnlyDictionary<'Key,'U> =
6570
let dct = Dictionary ()
6671
for KeyValue(k, vf) in f do
@@ -73,7 +78,7 @@ type Apply =
7378
static member ``<*>`` ((f: Expr<'T->'U>, x: Expr<'T>), _output: Expr<'U>, [<Optional>]_mthd: Apply) = Expr.Cast<'U> (Expr.Application (f, x))
7479
#endif
7580
static member ``<*>`` ((f: ('T->'U) ResizeArray, x: 'T ResizeArray), _output: 'U ResizeArray, [<Optional>]_mthd: Apply) = ResizeArray.apply f x : 'U ResizeArray
76-
81+
7782
static member inline Invoke (f: '``Applicative<'T -> 'U>``) (x: '``Applicative<'T>``) : '``Applicative<'U>`` =
7883
let inline call (mthd : ^M, input1: ^I1, input2: ^I2, output: ^R) =
7984
((^M or ^I1 or ^I2 or ^R) : (static member ``<*>`` : (_*_)*_*_ -> _) (input1, input2), output, mthd)

src/FSharpPlus/Control/Functor.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ type Map =
8989
static member Map ((x: Result<_,'E> , f: 'T->'U), _mthd: Map) = Result.map f x
9090
static member Map ((x: Choice<_,'E> , f: 'T->'U), _mthd: Map) = Choice.map f x
9191
static member Map ((KeyValue(k, x) , f: 'T->'U), _mthd: Map) = KeyValuePair (k, f x)
92-
static member Map ((_: DmStruct2<'T, 'E> , _: 'T->'U), _mthd: Map) = Unchecked.defaultof<DmStruct2<'U, 'E>>
92+
static member Map ((x: KeyValuePair2<_, _> , f: 'T->'U), _mthd: Map) = let k, x = x.Key, x.Value in KeyValuePair2 (k, f x)
9393
static member Map ((x: Map<'Key,'T> , f: 'T->'U), _mthd: Map) = Map.map (const' f) x : Map<'Key,'U>
9494
static member Map ((x: Dictionary<_,_> , f: 'T->'U), _mthd: Map) = Dictionary.map f x : Dictionary<'Key,'U>
9595
#if !FABLE_COMPILER

src/FSharpPlus/Internals.fs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ type Either<'t,'u> =
124124
| Right of 'u
125125

126126
type DmStruct = struct end
127-
type DmStruct2<'T1, 'T2> = struct end
128127

129128
type KeyValuePair2<'TKey, 'TValue> = struct
130129
val Key : 'TKey

0 commit comments

Comments
 (0)