[Haskell-beginners] capital letter name in record syntax (parsing json)

Miro Karpis miroslav.karpis at gmail.com
Wed Oct 16 21:18:19 UTC 2013


Hi, please,...is it possible to use a capital letter in record syntax data
definition? For example

data Car =
  Car { CarName  :: !Text
         ,CarColor   :: !Text
        } deriving (Show,Generic)

When I try this I get: parse error on input `CarName'

The thing is that I'm trying to parse a json file (with Aeson package) that
has records starting with capital letter. After that I would like to parse
the JSON file with following code:

 d <- (eitherDecode <$> getJSON) :: IO (Either String [Car])

where getJSON gets the json file from url

If not, what alternative do I have?

thanks,
m.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20131016/4e2a9adf/attachment-0001.html>


More information about the Beginners mailing list