No instance for Database.SQLite.Simple.FromField.FromField Char
You are using res
as a [String]
:
mapM_ putStrLn res
It is equivalent to [[Char]]
. But queryNamed
returns a list of rows, so each row has type [Char]
. There is an instance FromField a => FromRow [a]
, but there is no instance FromField Char
. That is what the error messages says.
I never used sqlite-simple
, but it is clear that each row contains a number of fields, so you are trying to fetch a row that contains a number of fields of type Char
. That makes no sense. Depending on actual database scheme, each row should be e.g. a number of text field, then the res
can have type [[String]]
. In that case you should use it like the next:
mapM_ (mapM_ putStrLn) (res :: [[String]])