I tried to use ExtendedDefaultRules. In my project, there is about 14 (something :: Text) needed resolve type ambiguity. I understood that my wish of being able to set Text as a default can be solved by using ExtendedDefaultRules and default (Text).
So after removing one of the ::Text and verifiied it didn’t compile anymore, I set ExtendedDefaultRules on the top of the file and to my surprise, now it is compiling, even though I didn’t set the default to Text.
Is that normal behavior ?
By the way, I can’t find in GHC manual about this default (...). Could someone point it out for me please ?
Each type in a default declaration must be an instance of Numor of IsString.
If no default declaration is given, then it is just as if the module contained the declaration default( Integer, Double, String).
The standard defaulting rule is extended thus: defaulting applies when all the unresolved constraints involve standard classes orIsString; and at least one is a numeric class orIsString.
So perhaps it is just choosing String by default and it works? But this doesn’t seem to depend on ExtendedDefaultRules…
Indeed. The code parse a csv file and then pattern match on the value. Both String and Text work in that case. The ambiguity, forcing me to chose was actually a good thing LoL.