misterspeedy/StylishFSharp.Corrigenda

Listing 4-11 ex4f does not compile

Opened this issue · 0 comments

Listing 4-11:

module Average =
    let inline averageOrZero (a : 'T[]) =
       ...
    ...
    // 0.m
    let ex4:decimal = [||] |> averageOrZero<decimal>
    // 0.f
    let ex4f:decimal = [||] |> averageOrZero<float32>
           //^^^^^^^ -- should be float32

Also, not sure if you did it for the sake of clarity, but the explicit type argument to averageOrZero is not needed since the type is explicitly declared on both ex4 and ex4f. It might be nice to add a comment indicating that the type argument is not needed 🙂.