News for hackers. Stuff that matters.
Re:This should never happen by chopin on Thursday March 31, 2016 @02:32PM (#11399428)
Sometimes you need also a user provided encoding (think of editors). In that case, the exception makes sense. Haskell or Rust would need to provide an extra API for this case. But generally you are right, stronger type checking would be preferable. Anyway, I dislike API's which take a String but only support a strongly limited subset of these. In that case, a dedicated type suits much better.
Re:This should never happen by wyager on Thursday March 31, 2016 @06:05PM (#11400951)
That's what typeclasses are for.