Open MMesch opened 4 years ago
So, this is code I based on the Elm Vega Lite version and haven't really looked at since (to see if it can be made "more" haskelly, to abuse a term or two).
I'm not sure if this helps you, but you can see some examples in the tests - e.g. https://github.com/DougBurke/hvega/blob/master/hvega/tests/DataTests.hs and https://github.com/DougBurke/hvega/blob/master/hvega/tests/Gallery/Bar.hs
This is a question rather than a bug. I am a happy hvega user but my code usually gets bloated up at the point where I need to convert some Haskell data type into an HVega datatype.
dataFromRows
expects a[DataRow]
which can be constructed withdataRow
. However, this constructor doesn't have the typical form[(FieldName, DataValue)] -> [DataRow]
that one would expect and that could be used with a simpledataRow <$> myrows
to convert a whole list of fields with associated value into a list of DataRows.I don't understand the point of this other constructor yet. Yes it allows us to concatenate lists of DataRows but wouldn't we be able to do this with simple list operators anyway?
What are the objections against simple
dataRow :: [(FieldName, DataValue)] -> [DataRow]
anddataColumn :: FieldName -> [DataValue] -> [DataRow]
constructors that I would expect?