4 ms·
You may want to try using TemplateHaskell. Where you had: data MetaData = MetaData { metadataUrl :: String, metadataTitle :: String ... you ca
by maxpow4h 13y ago
You may want to try using TemplateHaskell.
Where you had:
data MetaData = MetaData {
metadataUrl :: String,
metadataTitle :: String ...
you can use
import Data.Char
...
upStr n s = toLower (head (drop n s)) : (drop (n+1) s)
$(deriveJSON (upStr 8) ''MetaData)
This will splice the `metadataUrl` to use the `url` field from JSON. The deriveJSON function takes a function to change the field names.
It's pretty handy.