
26 Sep
2014
26 Sep
'14
10:34 a.m.
Hi, I'm trying to run an example from the eason documentation https://hackage.haskell.org/package/aeson-0.6.1.0/docs/Data-Aeson.html#g:3 : λ> do result <- decode "{\"name\":\"Dave\",\"age\":2}" flip parseMaybe result $ \obj -> do age <- obj .: "age" name <- obj .: "name" return (name ++ ": " ++ show (age*2)) I made a function: jsonTest = do result <- decode "{\"name\":\"Dave\",\"age\":2}" flip parseMaybe result $ \obj -> do age <- obj .: "age" name <- obj .: "name" return (name ++ ": " ++ show (age*2)) which can not compile: hh.hs:35:41: No instance for (Show a0) arising from a use of ‘show’ The type variable ‘a0’ is ambiguous .... ... Please what am I doing wrong? Cheers, Miro