eat :: Text -> Int64 -> Text -> Handler Text
eat obj areaId urlHash = do
    item <- lookAtItemByUnique obj areaId
    case item of
        Just (Entity _ itemVal) -> do
            case itemUse_action itemVal of
                -- "eat nothing" -> return $ pack $ "You eat the " ++ (unpack $ itemName itemVal) ++ ". Nothing happens."
                "eat die" -> die "you weren't listening" urlHash
                _ -> return "This item is not edible."
        Nothing -> return "No such item in this area."


--open :: Maybe Text -> Handler (Maybe (Entity Item_status))
--open obj = do
--    -- TODO
eat :: Text -> Int64 -> Text -> Handler Text
eat obj areaId urlHash = do
    item <- lookAtItemByUnique obj areaId
    case item of
        Just (Entity _ itemVal) -> do
            case itemUse_action itemVal of
                -- "eat nothing" -> return $ pack $ "You eat the " ++ (unpack $ itemName itemVal) ++ ". Nothing happens."
                "eat die" -> die "you weren't listening" urlHash
                _ -> return "This item is not edible."
        Nothing -> return "No such item in this area."


--open :: Maybe Text -> Handler (Maybe (Entity Item_status))
--open obj = do
--    -- TODO
eat obj areaId urlHash = do
    item <- lookAtItemByUnique obj areaId
    case item of
        Just (Entity _ itemVal) -> do
            case itemUse_action itemVal of
                -- "eat nothing" -> return $ pack $ "You eat the " ++ (unpack $ itemName itemVal) ++ ". Nothing happens."
                "eat die" -> die "you weren't listening" urlHash
                _ -> return "This item is not edible."
        Nothing -> return "No such item in this area."


--open :: Maybe Text -> Handler (Maybe (Entity Item_status))
--open obj = do
--    -- TODO