Skip to content

Commit 2011924

Browse files
committed
Fix tests
1 parent d68e3a5 commit 2011924

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

tests/FSharpPlus.Tests/ComputationExpressions.fs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ module ComputationExpressions =
139139

140140
SideEffects.reset ()
141141

142-
let threeElements: ReaderT<string, list<_>> = monad.plus {
142+
let threeElements: ReaderT<string, list<__>, _> = monad.plus {
143143
let! s = ask
144144
for i in 1 .. 3 do
145145
SideEffects.add (sprintf "processing %i" i)
@@ -440,7 +440,7 @@ module ComputationExpressions =
440440
// Monad transformers are delayed if at least one of the layers is lazy.
441441
SideEffects.reset ()
442442

443-
let readerToptionM : ReaderT<unit,unit option> = monad {
443+
let readerToptionM : ReaderT<unit, __ option, unit> = monad {
444444
use enum = toDebugEnum (SideEffects.add "using"; testSeq.GetEnumerator ())
445445
while (SideEffects.add "moving"; enum.MoveNext ()) do
446446
SideEffects.add (sprintf "--> %i" enum.Current) }
@@ -451,7 +451,7 @@ module ComputationExpressions =
451451

452452
SideEffects.reset ()
453453

454-
let readerTfuncM: ReaderT<unit,unit->unit> = monad {
454+
let readerTfuncM: ReaderT<unit, (unit -> __), unit> = monad {
455455
use enum = toDebugEnum (SideEffects.add "using"; testSeq.GetEnumerator ())
456456
while (SideEffects.add "moving"; enum.MoveNext ()) do
457457
SideEffects.add (sprintf "--> %i" enum.Current) }
@@ -464,7 +464,7 @@ module ComputationExpressions =
464464

465465
SideEffects.reset ()
466466

467-
let readerTtaskM: ReaderT<unit,Task<unit>> = monad {
467+
let readerTtaskM: ReaderT<unit, Task<__>, unit> = monad {
468468
use enum = toDebugEnum (SideEffects.add "using"; testSeq.GetEnumerator ())
469469
while (SideEffects.add "moving"; enum.MoveNext ()) do
470470
SideEffects.add (sprintf "--> %i" enum.Current) }
@@ -546,7 +546,7 @@ module ComputationExpressions =
546546
let _ = strictMonadTest ()
547547

548548
let monadTransformer3layersTest1 () =
549-
let x: StateT<string, ReaderT<int, seq<(unit * string)>>> = monad {
549+
let x: StateT<string, ReaderT<int, seq<__>, __>, unit> = monad {
550550
try
551551
failwith "Exception in try-with not handled"
552552
()
@@ -555,7 +555,7 @@ module ComputationExpressions =
555555
let _ = ((monadTransformer3layersTest1 () |> StateT.run) "" |> ReaderT.run) 0 |> Seq.toList
556556

557557
let monadTransformer3layersTest2 () =
558-
let x: StateT<string, ReaderT<int, list<(unit * string)>>> = monad {
558+
let x: StateT<string, ReaderT<int, list<__>, __>, unit> = monad {
559559
try
560560
failwith "Exception in try-with not handled"
561561
()
@@ -564,7 +564,7 @@ module ComputationExpressions =
564564
let _ = ((monadTransformer3layersTest2 () |> StateT.run) "" |> ReaderT.run) 0
565565

566566
let monadTransformer3layersTest2' () =
567-
let x: StateT<string, ReaderT<int, Task<(unit * string)>>> = monad {
567+
let x: StateT<string, ReaderT<int, Task<__>, __>, unit> = monad {
568568
try
569569
failwith "Exception in try-with not handled"
570570
()
@@ -573,33 +573,33 @@ module ComputationExpressions =
573573
let _ = ((monadTransformer3layersTest2' () |> StateT.run) "" |> ReaderT.run) 0
574574

575575
let monadTransformer3layersTest3 () =
576-
let x: WriterT<OptionT<seq<(unit * string) option>>> = monad {
576+
let x: WriterT<string, ResultT<unit, seq<__>, __>, unit> = monad {
577577
try
578578
failwith "Exception in try-with not handled"
579579
()
580580
with _ -> () }
581581
x
582-
let _ = monadTransformer3layersTest3 () |> WriterT.run |> OptionT.run |> Seq.toList
582+
let _ = monadTransformer3layersTest3 () |> WriterT.run |> ResultT.run |> Seq.toList
583583

584584
// Same test but with list instead of seq, which makes the whole monad strict
585585
// If .strict is not used it fails compilation with a nice error asking us to add it
586586
let monadTransformer3layersTest4 () =
587-
let x: WriterT<OptionT<list<(unit * string) option>>> = monad.strict {
587+
let x: WriterT<string, ResultT<unit, list<__>, __>, unit> = monad.strict {
588588
try
589589
failwith "Exception in try-with not handled"
590590
()
591591
with _ -> () }
592592
x
593-
let _ = monadTransformer3layersTest4 () |> WriterT.run |> OptionT.run
593+
let _ = monadTransformer3layersTest4 () |> WriterT.run |> ResultT.run
594594

595595
let monadTransformer3layersTest5 () =
596-
let x: WriterT<OptionT<Task<(unit * string) option>>> = monad.strict {
596+
let x: WriterT<string, ResultT<unit, Task<__>, __>, unit> = monad.strict {
597597
try
598598
failwith "Exception in try-with not handled"
599599
()
600600
with _ -> () }
601601
x
602-
let _ = monadTransformer3layersTest5 () |> WriterT.run |> OptionT.run
602+
let _ = monadTransformer3layersTest5 () |> WriterT.run |> ResultT.run
603603

604604

605605
// ContT doesn't deal with the inner monad, so we don't need to do anything.
@@ -646,7 +646,7 @@ module ComputationExpressions =
646646

647647
let monadTransformer3layersTest1 () =
648648
SideEffects.reset ()
649-
let x: StateT<string, ReaderT<int, seq<(unit * string)>>> = monad {
649+
let x: StateT<string, ReaderT<int, seq<__>, __>, unit> = monad {
650650
use disp = { new IDisposable with override __.Dispose() = SideEffects.add "Disposing" }
651651
try
652652
failwith "Exception in try-finally"
@@ -659,7 +659,7 @@ module ComputationExpressions =
659659

660660
let monadTransformer3layersTest2 () =
661661
SideEffects.reset ()
662-
let x: StateT<string, ReaderT<int, list<(unit * string)>>> = monad {
662+
let x: StateT<string, ReaderT<int, list<__>, __>, unit> = monad {
663663
use disp = { new IDisposable with override __.Dispose() = SideEffects.add "Disposing" }
664664
try
665665
failwith "Exception in try-finally"
@@ -672,30 +672,30 @@ module ComputationExpressions =
672672

673673
let monadTransformer3layersTest3 () =
674674
SideEffects.reset ()
675-
let x: WriterT<OptionT<seq<(unit * string) option>>> = monad {
675+
let x: WriterT<string, ResultT<unit, seq<__>, __>, unit> = monad {
676676
use disp = { new IDisposable with override __.Dispose() = SideEffects.add "Disposing" }
677677
try
678678
failwith "Exception in try-finally"
679679
()
680680
finally
681681
SideEffects.add "Finally goes here" }
682682
x
683-
let _ = try (monadTransformer3layersTest3 () |> WriterT.run |> OptionT.run |> Seq.toList) with _ -> Unchecked.defaultof<_>
683+
let _ = try (monadTransformer3layersTest3 () |> WriterT.run |> ResultT.run |> Seq.toList) with _ -> Unchecked.defaultof<_>
684684
SideEffects.are ["Finally goes here"; "Disposing"]
685685

686686
// Same test but with list instead of seq, which makes the whole monad strict
687687
// If .strict is not used it fails compilation with a nice error asking us to add it
688688
let monadTransformer3layersTest4 () =
689689
SideEffects.reset ()
690-
let x: WriterT<OptionT<list<(unit * string) option>>> = monad.strict {
690+
let x: WriterT<string, ResultT<unit, list<__>, __>, unit> = monad.strict {
691691
use disp = { new IDisposable with override __.Dispose() = SideEffects.add "Disposing" }
692692
try
693693
failwith "Exception in try-finally"
694694
()
695695
finally
696696
SideEffects.add "Finally goes here" }
697697
x
698-
let _ = try (monadTransformer3layersTest4 () |> WriterT.run |> OptionT.run) with _ -> Unchecked.defaultof<_>
698+
let _ = try (monadTransformer3layersTest4 () |> WriterT.run |> ResultT.run) with _ -> Unchecked.defaultof<_>
699699
SideEffects.are ["Finally goes here"; "Disposing"]
700700

701701
// ContT doesn't deal with the inner monad, so we don't need to do anything.

tests/FSharpPlus.Tests/General.fs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ module MonadTransformers =
17811781
if x < 10 then return Result.Ok 10
17821782
else return Result.Error "failure" }
17831783

1784-
let okFoo10Comp: ResultT<_> =
1784+
let okFoo10Comp: ResultT<_, _, _> =
17851785
monad {
17861786
let! resFoo = ResultT.hoist <| someResultFunction "foo"
17871787
let! res10 = doSomeOperation 0
@@ -1804,7 +1804,7 @@ module MonadTransformers =
18041804
if x < 10 then return Choice1Of2 10
18051805
else return Choice2Of2 "failure" }
18061806

1807-
let okFoo10Comp: ChoiceT<_> =
1807+
let okFoo10Comp: ChoiceT<_, _, _> =
18081808
monad {
18091809
let! resFoo = ChoiceT.hoist <| someErrorFunction "foo"
18101810
let! res10 = doSomeOperation 0
@@ -1816,14 +1816,14 @@ module MonadTransformers =
18161816
// test generic put (no unknown(1,1): error FS0073: internal error: Undefined or unsolved type variable: ^_?51242)
18171817
let initialState = -1
18181818
let _ = put initialState : ListT<State<int, unit list>>
1819-
let _ = put initialState : ChoiceT<State<int, Choice<unit,string>>>
1819+
let _ = put initialState : ChoiceT<string, State<int, __>, _>
18201820

18211821
()
18221822

18231823
[<Test>]
18241824
let testStateT () =
1825-
let lst1: StateT<string,_> = StateT.lift [1;2]
1826-
let lst2: StateT<string,_> = StateT.lift [4;5]
1825+
let lst1: StateT<string, _, _> = StateT.lift [1;2]
1826+
let lst2: StateT<string, _, _> = StateT.lift [4;5]
18271827

18281828
let m = monad {
18291829
let! x = lst1
@@ -1841,9 +1841,9 @@ module MonadTransformers =
18411841
[<Test>]
18421842
let testCompilationMT1 () =
18431843

1844-
let fn : ResultT<Reader<int,Result<_,RErrors>>> =
1844+
let fn : ResultT<RErrors, Reader<int, __>, _> =
18451845
monad {
1846-
let! x1 = lift ask
1846+
let! x1 = ask
18471847
let! x2 =
18481848
if x1 > 0 then result 1
18491849
else ResultT (result (Error NegativeValue))
@@ -1875,7 +1875,7 @@ module BifunctorDefaults =
18751875

18761876
module Invariant =
18771877

1878-
type StringCodec<'t> = StringCodec of ReaderT<string, Result<'t,string>> * ('t -> Const<string, unit>) with
1878+
type StringCodec<'t> = StringCodec of ReaderT<string, Result<__,string>, 't> * ('t -> Const<string, unit>) with
18791879
static member Invmap (StringCodec (d, e), f: 'T -> 'U, g: 'U -> 'T) = StringCodec (map f d, contramap g e)
18801880
module StringCodec =
18811881
let decode (StringCodec (d,_)) x = ReaderT.run d x

tests/FSharpPlusFable.Tests/FSharpTests/General.fs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ let monadTransformers = testList "MonadTransformers" [
8383
if x < 10 then return Result.Ok 10
8484
else return Result.Error "failure" }
8585

86-
let okFoo10Comp: ResultT<_> =
86+
let okFoo10Comp: ResultT<_, _, _> =
8787
monad {
8888
let! resFoo = ResultT.hoist <| someResultFunction "foo"
8989
let! res10 = doSomeOperation 0
@@ -107,7 +107,7 @@ let monadTransformers = testList "MonadTransformers" [
107107
if x < 10 then return Choice1Of2 10
108108
else return Choice2Of2 "failure" }
109109

110-
let okFoo10Comp: ChoiceT<_> =
110+
let okFoo10Comp: ChoiceT<_, _, _> =
111111
monad {
112112
let! resFoo = ChoiceT.hoist <| someErrorFunction "foo"
113113
let! res10 = doSomeOperation 0
@@ -119,13 +119,13 @@ let monadTransformers = testList "MonadTransformers" [
119119
// test generic put (no unknown(1,1): error FS0073: internal error: Undefined or unsolved type variable: ^_?51242)
120120
let initialState = -1
121121
let _ = put initialState : ListT<State<int, unit list>>
122-
let _ = put initialState : ChoiceT<State<int, Choice<unit,string>>>
122+
let _ = put initialState : ChoiceT<string, State<int, __>, unit>
123123

124124
())
125125
#if !NETSTANDARD3_0
126126
testCase "testStateT" (fun () ->
127-
let lst1: StateT<string,_> = StateT.lift [1;2]
128-
let lst2: StateT<string,_> = StateT.lift [4;5]
127+
let lst1: StateT<string, _, _> = StateT.lift [1;2]
128+
let lst2: StateT<string, _, _> = StateT.lift [4;5]
129129

130130
let m = monad {
131131
let! x = lst1
@@ -141,9 +141,9 @@ let monadTransformers = testList "MonadTransformers" [
141141

142142
testCase "testCompilationMT1" (fun () ->
143143

144-
let fn : ResultT<Reader<int,Result<_,RErrors>>> =
144+
let fn : ResultT<RErrors, Reader<int, __>, _> =
145145
monad {
146-
let! x1 = lift ask
146+
let! x1 = ask
147147
let! x2 =
148148
if x1 > 0 then result 1
149149
else ResultT (result (Error NegativeValue))
@@ -181,7 +181,7 @@ module BifunctorDefaults =
181181
#endif
182182

183183
#if !FABLE_COMPILER || FABLE_COMPILER_3
184-
type StringCodec<'t> = StringCodec of ReaderT<string, Result<'t,string>> * ('t -> Const<string, unit>) with
184+
type StringCodec<'t> = StringCodec of ReaderT<string, Result<__, string>, 't> * ('t -> Const<string, unit>) with
185185
static member Invmap (StringCodec (d, e), f: 'T -> 'U, g: 'U -> 'T) = StringCodec (map f d, contramap g e)
186186
module StringCodec =
187187
let decode (StringCodec (d,_)) x = ReaderT.run d x

0 commit comments

Comments
 (0)