FsToolkit.ErrorHandling icon indicating copy to clipboard operation
FsToolkit.ErrorHandling copied to clipboard

Gitbook: Some Typos

Open bytesource opened this issue 3 years ago • 1 comments

Hi!

First of all I want to thank you for taking the time to write such a detailed documentation for every function in FsToolkint.Errorhandling!

While going through the text, I stumbled upon a few words that might be typos.

I'm just a beginner, so there might be mistakes on my part, but I decided to just list them here anyway:

AsyncResult.withError

https://demystifyfp.gitbook.io/fstoolkit-errorhandling/asyncresult/others#witherror

'a -> Async<Result<'b, uni>t> -> Async<Result<'b, 'a>> should probably be 'a -> Async<Result<'b, unit>> -> Async<Result<'b, 'a>>

Similarly,

JobResult.withError

https://demystifyfp.gitbook.io/fstoolkit-errorhandling/jobresult/others#witherror

'a -> job<Result<'b, uni>t> -> job<Result<'b, 'a>> should probably be 'a -> job<Result<'b, unit>> -> job<Result<'b, 'a>>

TaskResult.map

https://demystifyfp.gitbook.io/fstoolkit-errorhandling/taskresult/map#example-1 TaskResult.map, example 1, code block 2, line 2

let rawPostId : Task<Result<Guid, exn>> = savePost createostRequest |> TaskResult.map (fun (PostId postId) -> postId)

should probably be

let rawPostId : Task<Result<Guid, exn>> = savePost createPostRequest |> TaskResult.map (fun (PostId postId) -> postId)

ResultOption.map2

https://demystifyfp.gitbook.io/fstoolkit-errorhandling/resultoption/map2#example-2 ResultOption.map2, example 2, second code box, line 16

// Result<Location option, string> let locationR = ResultOption.map2 location latR lngR

should probably be

// Result<Location option, string> let locationR = ResultOption.map2 location.Create latR lngR

location.Create was defined here: Result.map2, example 2

AsyncResult.map2

https://demystifyfp.gitbook.io/fstoolkit-errorhandling/asyncresult/map2#example-1

getFollowerIds : UserId -> Async<Result<UserId, exn>>

Based on the code that follows in this example, I think the function should return a UserId list:

getFollowerIds : UserId -> Async<Result<UserId list, exn>>

If this is correct, the comment above this piece of code should also mention UserId list, too: Example 1, code box 3, line 2

// Async<Result<UserId, exn>> let getFollowersResult = getFollowerIds req.UserId

should become:

// Async<Result<UserId list, exn>> let getFollowersResult = getFollowerIds req.UserId

TaskResult.map2, JobResult.map2

The same code regarding UserId appears in the following two places:

  • TaskResult.map2: https://demystifyfp.gitbook.io/fstoolkit-errorhandling/taskresult/map2#example-1
  • JobResult.map2: https://demystifyfp.gitbook.io/fstoolkit-errorhandling/jobresult/map2#example-1

JobResult.foldResult

https://demystifyfp.gitbook.io/fstoolkit-errorhandling/jobresult/foldresult#example-1

JobResult.foldResult, example 1, line 14

// Job<Result<PostId, exn>> let createPostAR = createPost httpReq

should probably mean

// Job<Result<PostId, exn>> let createPostJR = createPost httpReq

Of course, this has no effect on how the code works. It's just that in the original example, AR was probably chosen to mean AsyncResult, so in the case of JobResult, adding JR might make sense.

TaskResult.foldResult

https://demystifyfp.gitbook.io/fstoolkit-errorhandling/taskresult/foldresult#example-1

The sample applies to the TaskResult example: TaskResult.foldResult, example 1, line 14

// Task<Result<PostId, exn>> let createPostAR = createPost httpReq

should probably be:

// Task<Result<PostId, exn>> let createPostTR = createPost httpReq

Keep up the good work!

Stefan

bytesource avatar Sep 17 '21 08:09 bytesource

Thanks! It was mostly @demystifyfp on the initial documentation.

Two things I need to do:

  • Figure out how to deploy new gitbook content
  • I need to get around to generating this from the codebase rather than having it be hand written

TheAngryByrd avatar Sep 17 '21 13:09 TheAngryByrd