I am starting my very first try on elm. Will get json data from server like below:
{
“categories” : {
"Featured" : [ ],
"New" : [ ],
"Recommend" : [ {
"productId" : "Product-1",
...
...
}, {
"productId" : "Product-2",
...
...
} ],
"Slides" : [ {
"productId" : "Product-3",
...
...
}, {
"productId" : "Product-4",
...
...
} ]
}
}
I am modeling like below:
type alias Product =
{ productId : String
…
…
}
type alias Categories =
{ Featured: List Product
, New: List Product
, Recommend: List Product
, Slides: List Product
}
type alias Model =
{ categories : WebData (Categories)
}
This will not work, as Elm need lower case name, Featured, New… will not get through.
So in my case, how to model the categories?