Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
F# composition root with lots of single and with nested lets
// old
let ComposeSimple serviceProvider configuration =
let (context, organizationService, _, _) = DecomposeServiceProvider serviceProvider
let configurationXml = XElement.Parse configuration
let getRecordName = GetRecordName organizationService
let regardingLookups() = ConfiguredRegardingLookups configurationXml
let listFindingRegardingObject() = ListFindingRegardingObject regardingLookups (GetFullRecordImage(context))
let regardingObject = NameAddedRegardingObject getRecordName listFindingRegardingObject
let setValues = SetClassificationIdentificationValues(GetTarget context)
let allAttributesPresent = AllRequiredAttributesArePresent
let main() = Main allAttributesPresent (GetTarget context) regardingObject setValues
main
// new with nested lets
let ComposeNested serviceProvider configuration =
let (context, organizationService, _, _) = DecomposeServiceProvider serviceProvider
let main() =
let regardingObject =
let listFindingRegardingObject() =
let configurationXml = XElement.Parse configuration
let regardingLookups() = ConfiguredRegardingLookups configurationXml
ListFindingRegardingObject regardingLookups (GetFullRecordImage(context))
let getRecordName = GetRecordName organizationService
NameAddedRegardingObject getRecordName listFindingRegardingObject
let setValues = SetClassificationIdentificationValues(GetTarget context)
let allAttributesPresent = AllRequiredAttributesArePresent
Main allAttributesPresent (GetTarget context) regardingObject setValues
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment