Skip to content

TWith2Sugars/AttemptIt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AttemptIt

F# computation expression based on railway programming http://fsharpforfunandprofit.com/posts/recipe-part2/

Build Status

Build status

Nuget

https://www.nuget.org/packages/AttemptIt

Types

  • Attempt<'TSuccess, 'TFail> represents an attempt at doing something
  • Result<'TSuccess, 'TFail> represents the result of an attempt

Syntax

Basic usage

let doThis = attempt {
    let! x = someFunc()
    let! y = someOtherFunc y
    return! finalFunc y
}

Catching Exceptions

let exceptionHandler (e:exn) -> Fail e.Message
let tryThis = Attempt.Catch exceptionHandler doThis

Evaluating

let result = Attempt.Run tryThis

About

F# computation expression based on railway programming

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published