Skip to content

Instantly share code, notes, and snippets.

@TeaDrivenDev
Created March 11, 2014 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TeaDrivenDev/9495417 to your computer and use it in GitHub Desktop.
Save TeaDrivenDev/9495417 to your computer and use it in GitHub Desktop.
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