A partial application gotcha

I ran into my first F# gotcha today.
Here was the code in one file:

let template = DomainOperations.GetTemplate id

and in the other:

let GetTemplate (id: System.Guid) (templateRepository: ITemplateRepository) =
    templateRepository.FindById id

When I compiled this there were no errors or warnings, but when it ran GetTemplate wasn’t called.

Then the headslap moment – I’d left out an argument – and because of the beauty of type inference and partial application in F# the compiler was completely happy with what I’d written. It simply assumed that I meant to create a partially applied function that takes a repository as an argument, i.e. template: ITemplateRepository -> Template