376402 (2) [Avatar] Offline
#1
Hi All,

I'm working through the book using Visual Studio 2015. I encounter an error in listing 9.10. After the following line

let scaleNames = new Dictionary<_, _> (noSpaceComparer)


I get the following error message

error FS0030: Value restriction. The value 'scaleNames' has been inferred to have generic type
val scaleNames : Dictionary<string,'_a>
Either define 'scaleNames' as a simple data term, make it a function with explicit arguments or, if you do not intend for it to be generic, add a type annotation.


I tried with the download code package for the book in case I'd done some typo I was failing to find but I find it gets the same message.

Did any of you encounter this and if so, how did you solve it? If I figure it out before anyone post I'll put the answer here.

Joe
376402 (2) [Avatar] Offline
#2
I changed the line to the following and it then ran and the various test later in the listing worked as expected.

let scaleNames:Dictionary<_,string> = new Dictionary<_, _> (noSpaceComparer)