keyFrom_id :: (PersistEntity record) => DB.Value -> Either Text (Key record)
keyFrom_id idVal = case cast idVal of
    (PersistMap m) -> keyFromValues $ map snd m
    pv -> keyFromValues [pv]

-- | It would make sense to define the instance for ObjectId
-- and then use newtype deriving
-- however, that would create an orphan instance
keyFrom_id :: (PersistEntity record) => DB.Value -> Either Text (Key record)
keyFrom_id idVal = case cast idVal of
    (PersistMap m) -> keyFromValues $ map snd m
    pv -> keyFromValues [pv]

-- | It would make sense to define the instance for ObjectId
-- and then use newtype deriving
-- however, that would create an orphan instance
keyFrom_id idVal = case cast idVal of
    (PersistMap m) -> keyFromValues $ map snd m
    pv -> keyFromValues [pv]

-- | It would make sense to define the instance for ObjectId
-- and then use newtype deriving
-- however, that would create an orphan instance