
12 Jul
2018
12 Jul
'18
6:05 a.m.
Hi, I'm trying to make sense of the type class `Read`. It feels to be like a function performing casting to me, similar to what you have in C and Java. The weird thing is that the casting doesn't have to make sense, type-wise. So `read "5" :: Int` produce the integer 5 which make sense but `read "(3,'a')" :: Int` doesn't make sense to me but ghci accepts it! This is seeing Read as a function, as it's a type class i suspect I'm missing something. Quite possibly quite a lot... Why is the type class called `Read`? What am I missing above? // Patrik Iselind