Created
October 16, 2013 15:08
-
-
Save mkrull/7009210 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
re-installing aeson fixed the issue. cause and reason unknown