
26 May
2015
26 May
'15
8:35 p.m.
Given: data GPA = F Float | Excuse String class ToGPA a where giveGPA :: a -> GPA Is there any way (without IncoherentInstances or Rebindablesyntax) that I can let the user write e.g. "giveGPA 4.0" (and "giveGPA 4") and get back "F 4" without getting type errors that "4.0"'s type is ambiguous? I can guarantee there won't be any additional instances to "ToGPA" (For my uses, I really (actually!) don't want to make the user write e.g. "F 4.0") I've gotten this working, once with IncoherentInstances and once with RebindableSyntax, but both of those flags feel pretty dirty. Thanks, Tom