Created
August 12, 2012 15:24
-
-
Save aristidb/3332273 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Git where | |
import Data.ByteString | |
import Data.Time | |
import qualified Data.Map as M | |
-- | Objects that are stored in the git storage by SHA1. Just a dummy class in this demonstration. | |
class Storable a | |
newtype Object = Object { objectData :: ByteString } | |
instance Storable Object | |
type FileName = ByteString | |
type BranchName = ByteString | |
type Author = ByteString | |
newtype Tree = Tree (M.Map FileName Object) | |
instance Storable Tree | |
data Commit = Commit { commitAuthor :: Author | |
, commitDate :: UTCTime | |
, commitParents :: [Commit] | |
, commitTree :: Tree | |
} | |
instance Storable Commit | |
data Repo = Repo { repoIndex :: Tree -- also known as Staging Area | |
, repoBranches :: M.Map BranchName Commit | |
, repoStorage :: () -- dummy for the big git storage | |
} | |
instance Storable Repo | |
-- this model completely ignores packed files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment