
14 Dec
2012
14 Dec
'12
9:57 a.m.
Hello, I expected "read" to work directly on a Data.Text because Data.Text has an instance of the Read class, but it seems to fail: --------- import Data.Text main = do let a = pack "1" let b = read a :: Int putStrLn "parsed OK" --------- test.hs:5:22: Couldn't match expected type `String' with actual type `Text' In the first argument of `read', namely `a' In the expression: read a :: Int In an equation for `b': b = read a :: Int Sure I can do"read (unpack a) :: Int" but there must be a way to do it directly? Emmanuel