Skip to content

Instantly share code, notes, and snippets.

@mkrull
Created October 16, 2013 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkrull/7009210 to your computer and use it in GitHub Desktop.
Save mkrull/7009210 to your computer and use it in GitHub Desktop.
[1 of 1] Compiling Main ( test.hs, test.o )
test.hs:17:45:
No instance for (FromJSON (Map String String))
arising from a use of `parseJSON'
Possible fix:
add an instance declaration for (FromJSON (Map String String))
In the second argument of `(<$>)', namely `parseJSON val'
In the expression: TemplateConfig <$> parseJSON val
In an equation for `parseJSON':
parseJSON val = TemplateConfig <$> parseJSON val
module Main where
import Data.Maybe
import Data.Aeson
import Data.Map as Map
import Data.Functor
import qualified Data.ByteString.Lazy as LBS
main = do
jsonContent <- LBS.readFile "templates/test.json"
print (decode jsonContent :: Maybe TemplateConfig)
newtype TemplateConfig = TemplateConfig (Map String String)
deriving Show
instance FromJSON TemplateConfig where
parseJSON val = TemplateConfig <$> parseJSON val
@mkrull
Copy link
Author

mkrull commented Oct 26, 2013

re-installing aeson fixed the issue. cause and reason unknown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment