Bring content back

This commit is contained in:
Tissevert 2019-04-10 10:44:53 +02:00
parent b21cd8d909
commit b4fcc7857c

View file

@ -16,12 +16,14 @@ type MedicineName = String
data Medicine = Medicine {
name :: MedicineName
, content :: Float
, minStock :: Float
} deriving (Show)
instance Row Medicine where
fromRow assoc = Medicine <$>
get "name"
<*> (read <$> get "content")
<*> (read <$> get "minStock")
where
get key = maybe (Left $ Expect key) Right $ Map.lookup key assoc