
16 Jul
2013
16 Jul
'13
4:04 a.m.
Jedaï ...... We discover that this function is pretty simple in fact and combine some pure code that does provide pure exceptions, so defining a new function may bring a solution : tryDecodingJSON :: (Data a) => String -> Result a tryDecodingJSON s = case runGetJSON readJSValue s of Left msg -> Error msg Right j -> fromJSON j You may need to import Text.JSON.String for runGetJSON. --- This is a nice solution for the problem. Thanks! Kees