I have a CSV with fields in it which contain unit values which I have to parse out. As a simple example:
data EValue = Farads Double | MicroFarads Double | PicoFarads Double
Thus I need to parse something like the following:
parseEValue = farads <|> micro <|> pico
where farads = Farads <$> double <* string "F"
micro = MicroFarads <$> double <* string "µF"
pico = PicoFarads <$> double <* string "pF"
How do I include this in an instance definition for FromField
for Cassava
?
instance FromField EValue where
parseField = ???