|DukeDave||Hi guys, am I right in thinking the Read class is a little arkward :S|
|sorear||Read is broken in every way!|
|lambdabot||I saw malcolmw leaving #haskell-soc, #ghc, #haskell-overflow, #haskell-blah and #haskell 1d 6h 43m 13s ago, and .|
|sorear||@goo malcolm text parse blog|
|sorear||I think it's on there.|
when you want code:
|DukeDave||hm, I think this might be a little over the top for me :)|
|zarvok||here's the post you want:|
|DukeDave||(reading in pairs of ints!)|
|lambdabot||Title: malcolm: Replacement for Read class|
|zarvok||yeah, you may not care about all this stuff :)|
|Cale||DukeDave: The read class would be better replaced by a proper parser combinator library, but it does its job reasonably well for basic reading of datatypes.|
DukeDave: How are the pairs of Ints formatted?
If they're like "(57,12)", you can just apply read straight off.
> read "(57,12)" :: (Int, Int)
|Cale||I think probably the easiest way to create an instance of Read is to use ReadP and use the ReadP_to_S function to get reads.|
(er, readsPrec, but you can ignore the precedence parameter.)
If you really need precedence parsing, there's ReadPrec, which ReadP lifts into as well.
how you doing Cale ?
|action||araujo packs sorear into a State transformer|
|araujo||packs sorear into a State transformer|
|action||sorear execStates himself|
|sorear||Wow, this isn't something you see every day.|
Almost unbelievable, even.
GHC's "probable cause" was correct.