module DB.Model (
    ID,
    Model(..)
) where

import Control.Monad (liftM)
import Data.ID (ID(..))


class Ord m => Model m where
    id :: m -> ID m
    all :: IO [m]
    get :: ID m -> IO m
    get (ID uid) = liftM (!! uid) DB.Model.all  -- useful default implementation for mocks.
