Bring content back
This commit is contained in:
parent
b21cd8d909
commit
b4fcc7857c
1 changed files with 2 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue