{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}
module Data.Git.Object
(
ObjectType(..)
, Object(..)
, Blob(..)
, Tree(..)
, Commit(..)
, Tag(..)
, TreeEntry(..)
, asBlob
, asTree
, asCommit
, asTag
, buildObject
, buildLooseObject
, emptyTree
, emptyTreeSha
) where
import Data.Git.Internal.Object
asBlob :: Object -> Maybe Blob
asBlob (BlobObj b) = Just b
asBlob _ = Nothing
asTree :: Object -> Maybe Tree
asTree (TreeObj t) = Just t
asTree _ = Nothing
asCommit :: Object -> Maybe Commit
asCommit (CommitObj c) = Just c
asCommit _ = Nothing
asTag :: Object -> Maybe Tag
asTag (TagObj t) = Just t
asTag _ = Nothing