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 { data Medicine = Medicine {
name :: MedicineName name :: MedicineName
, content :: Float
, minStock :: Float , minStock :: Float
} deriving (Show) } deriving (Show)
instance Row Medicine where instance Row Medicine where
fromRow assoc = Medicine <$> fromRow assoc = Medicine <$>
get "name" get "name"
<*> (read <$> get "content")
<*> (read <$> get "minStock") <*> (read <$> get "minStock")
where where
get key = maybe (Left $ Expect key) Right $ Map.lookup key assoc get key = maybe (Left $ Expect key) Right $ Map.lookup key assoc