packages feed

orchid-0.0.6: src/Network/Orchid/Core/Backend.hs

module Network.Orchid.Core.Backend where

import Data.List (intercalate)

type Author = String
type Date   = String

data Revision =
  Revision {
    date   :: Date
  , author :: Author
  , name   :: String
  }

instance Show Revision where
  show (Revision d a n) = intercalate "\n" [sd, sa, sn]
    where
      sd = if null d then "<no date>" else d
      sa = if null a then "<no author>" else a
      sn = if null n then "<no revision name>" else n

type History = [Revision]

data Backend =
  Backend {
    store    :: FilePath -> Revision -> String -> IO ()
  , retrieve :: FilePath -> Revision -> IO (Maybe String)
  , delete   :: FilePath -> Revision -> IO ()
  , history  :: FilePath -> IO (Maybe History)
  }