Reputation: 88
I am just starting out with F# so this is a bit of basic question on best practise with type inference.
I am trying to write a function that works on a TimeSpan. This is a simplified version of what I am trying to do:
let intervalsFromTimespan t = t.TotalMinutes / 5.0
Clearly this won't work because I need to somehow state that t is a timespan.
Would the correct way be:
let intervalsFromTimespan' t = (t : TimeSpan).TotalMinutes / 5.0
Upvotes: 1
Views: 179
Reputation: 149078
Try this:
let intervalsFromTimespan (t : TimeSpan) = t.TotalMinutes / 5.0
Upvotes: 4