Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hgit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eduardo Trujillo
hgit
Commits
907c7138
Commit
907c7138
authored
6 years ago
by
Vincent Hanquez
Browse files
Options
Downloads
Patches
Plain Diff
improve types (more strictness, newtype instead of data)
parent
74e435a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Data/Git/Types.hs
+20
-20
20 additions, 20 deletions
Data/Git/Types.hs
git.cabal
+1
-0
1 addition, 0 deletions
git.cabal
with
21 additions
and
20 deletions
Data/Git/Types.hs
+
20
−
20
View file @
907c7138
...
@@ -69,8 +69,8 @@ data ObjectType =
...
@@ -69,8 +69,8 @@ data ObjectType =
-- | Git time is number of seconds since unix epoch in the UTC zone with
-- | Git time is number of seconds since unix epoch in the UTC zone with
-- the current timezone associated
-- the current timezone associated
data
GitTime
=
GitTime
data
GitTime
=
GitTime
{
gitTimeUTC
::
Elapsed
{
gitTimeUTC
::
!
Elapsed
,
gitTimeTimezone
::
TimezoneOffset
,
gitTimeTimezone
::
!
TimezoneOffset
}
deriving
(
Eq
)
}
deriving
(
Eq
)
instance
Timeable
GitTime
where
instance
Timeable
GitTime
where
...
@@ -177,46 +177,46 @@ type TreeEnt hash = (ModePerm,EntName,Ref hash)
...
@@ -177,46 +177,46 @@ type TreeEnt hash = (ModePerm,EntName,Ref hash)
-- FIXME: should be a string, but I don't know if the data is stored
-- FIXME: should be a string, but I don't know if the data is stored
-- consistantly in one encoding (UTF8)
-- consistantly in one encoding (UTF8)
data
Person
=
Person
data
Person
=
Person
{
personName
::
ByteString
{
personName
::
!
ByteString
,
personEmail
::
ByteString
,
personEmail
::
!
ByteString
,
personTime
::
GitTime
,
personTime
::
!
GitTime
}
deriving
(
Show
,
Eq
)
}
deriving
(
Show
,
Eq
)
-- | Represent a root tree with zero to many tree entries.
-- | Represent a root tree with zero to many tree entries.
data
Tree
hash
=
Tree
{
treeGetEnts
::
[
TreeEnt
hash
]
}
deriving
(
Show
,
Eq
)
newtype
Tree
hash
=
Tree
{
treeGetEnts
::
[
TreeEnt
hash
]
}
deriving
(
Show
,
Eq
)
-- | Represent a binary blob.
-- | Represent a binary blob.
data
Blob
hash
=
Blob
{
blobGetContent
::
L
.
ByteString
}
deriving
(
Show
,
Eq
)
newtype
Blob
hash
=
Blob
{
blobGetContent
::
L
.
ByteString
}
deriving
(
Show
,
Eq
)
-- | Represent a commit object.
-- | Represent a commit object.
data
Commit
hash
=
Commit
data
Commit
hash
=
Commit
{
commitTreeish
::
Ref
hash
{
commitTreeish
::
!
(
Ref
hash
)
,
commitParents
::
[
Ref
hash
]
,
commitParents
::
[
Ref
hash
]
,
commitAuthor
::
Person
,
commitAuthor
::
!
Person
,
commitCommitter
::
Person
,
commitCommitter
::
!
Person
,
commitEncoding
::
Maybe
ByteString
,
commitEncoding
::
Maybe
ByteString
,
commitExtras
::
[
CommitExtra
]
,
commitExtras
::
[
CommitExtra
]
,
commitMessage
::
ByteString
,
commitMessage
::
!
ByteString
}
deriving
(
Show
,
Eq
)
}
deriving
(
Show
,
Eq
)
data
CommitExtra
=
CommitExtra
data
CommitExtra
=
CommitExtra
{
commitExtraKey
::
ByteString
{
commitExtraKey
::
!
ByteString
,
commitExtraValue
::
ByteString
,
commitExtraValue
::
!
ByteString
}
deriving
(
Show
,
Eq
)
}
deriving
(
Show
,
Eq
)
-- | Represent a signed tag.
-- | Represent a signed tag.
data
Tag
hash
=
Tag
data
Tag
hash
=
Tag
{
tagRef
::
Ref
hash
{
tagRef
::
!
(
Ref
hash
)
,
tagObjectType
::
ObjectType
,
tagObjectType
::
!
ObjectType
,
tagBlob
::
ByteString
,
tagBlob
::
!
ByteString
,
tagName
::
Person
,
tagName
::
!
Person
,
tagS
::
ByteString
,
tagS
::
!
ByteString
}
deriving
(
Show
,
Eq
)
}
deriving
(
Show
,
Eq
)
-- | Delta pointing to an offset.
-- | Delta pointing to an offset.
data
DeltaOfs
hash
=
DeltaOfs
Word64
Delta
data
DeltaOfs
hash
=
DeltaOfs
!
Word64
!
Delta
deriving
(
Show
,
Eq
)
deriving
(
Show
,
Eq
)
-- | Delta pointing to a ref.
-- | Delta pointing to a ref.
data
DeltaRef
hash
=
DeltaRef
(
Ref
hash
)
Delta
data
DeltaRef
hash
=
DeltaRef
!
(
Ref
hash
)
!
Delta
deriving
(
Show
,
Eq
)
deriving
(
Show
,
Eq
)
This diff is collapsed.
Click to expand it.
git.cabal
+
1
−
0
View file @
907c7138
...
@@ -27,6 +27,7 @@ extra-source-files: tests/*.hs
...
@@ -27,6 +27,7 @@ extra-source-files: tests/*.hs
Library
Library
Build-Depends: base >= 4 && < 5
Build-Depends: base >= 4 && < 5
, basement
, bytestring >= 0.9
, bytestring >= 0.9
, byteable
, byteable
, containers
, containers
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment