This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(** | |
## References | |
As they aren't part of a project, fsx files need | |
to reference all of their dependencies within the | |
file. | |
You'll always want to reference FakeLib. VersionUpdater | |
is an inhouse tool we use for handling feature branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(** | |
## References | |
As they aren't part of a project, fsx files need | |
to reference all of their dependencies within the | |
file. | |
You'll always want to reference FakeLib. VersionUpdater | |
is an inhouse tool we use for handling feature branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let interval i = | |
let x = float i | |
let maxWait = 60. * 10. | |
let raisePower x = pown (x /10.) 4 | |
(maxWait * (raisePower x)) / (raisePower x + 1.) | |
|> (*) 1000. |> int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let agent = | |
AutoCancelAgent.Start(fun inbox -> async { | |
while true do | |
audit { | |
use! client = audit { return getClient () } | |
Log "Checking email..." | |
do! audit { return CollectMessages client } | |
expunge client | |
} |> doAuditedProcess | |
do! Async.Sleep(match pollInterval with Interval s -> s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type TestErrorBuilder () = | |
member this.Bind (expr, func) = | |
try | |
match expr () with | |
| None -> fun () -> None | |
| Some r -> | |
func r | |
with | |
| _ as e -> | |
printfn "%A" e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
type AuditedProcess<'T> = unit -> Option<'T> | |
let runAuditedProcess (auditedProcess : AuditedProcess<_>) = | |
auditedProcess () | |
let doAuditedProcess (auditedProcess : AuditedProcess<_>) = | |
runAuditedProcess auditedProcess |> ignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Our basic cexpr, fully sugared | |
let calculate input = | |
audit { | |
use! thing = Some input | |
return (possibleGoWrongThing thing) | |
} | |
// Rest of this might not be valid f# code at every step. | |
// Expanding using documentation at http://msdn.microsoft.com/en-us/library/dd233182.aspx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Our builder | |
type TestErrorBuilder () = | |
member this.Bind (expr, func) = | |
match expr with | |
| None -> None | |
| Some r -> | |
try func r | |
with | |
| _ as e -> | |
printfn "%A" e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open EasyNetQ | |
type IService = | |
abstract member Start : unit -> unit | |
type Service (log : ILog, bus : IBus, indexer : IIndex, audit : IErrorHandlerBuilder) = | |
member this.Start () = | |
bus.Subscribe<PasngrEmail>("Archive", | |
fun (email : PasngrEmail) -> | |
audit { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type TestErrorBuilder () = | |
member this.Bind (expr, func) = | |
match expr with | |
| None -> None | |
| Some r -> | |
try func r | |
with | |
| _ as e -> | |
printfn "%A" e | |
None |
NewerOlder