File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -304,17 +304,15 @@ module Fold =
304304 return foo |> Option.toResultWith NotFound
305305 }
306306
307- // An example application layer that defines an interpreter for the GetFoo program which targets the async monad
308- module App =
309- let interpreter =
310- Free.fold ( function
311- | GetFoo.Read ( fooId, next) -> async { return Some({ Id = fooId; Name = " test" }) |> next })
312-
313307 [<Test>]
314- let interpretProgramWithFold =
315- async {
316- let request : GetFoo.Request = { Id = FooId " 1" }
317- let! response = request |> GetFoo.handle |> App.interpreter
318-
319- Assert.AreEqual( Some({ Id = FooId " 1" ; Name = " test" }), response)
320- }
308+ let ``should interpret program with fold`` () =
309+ let request : GetFoo.Request = { Id = FooId " 1" }
310+ let response =
311+ request
312+ |> GetFoo.handle
313+ |> Free.fold
314+ ( function
315+ | GetFoo.Read ( fooId, next) -> { Id = fooId; Name = " test" } |> Some |> next |> result)
316+ |> Identity.run
317+
318+ areStEqual ( Ok { Id = FooId " 1" ; Name = " test" }) response
You can’t perform that action at this time.
0 commit comments