Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Becich
hpc
Commits
b5454680
Commit
b5454680
authored
3 years ago
by
BinderDavid
Committed by
Ben Gamari
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add Generic and NFData instances for Hash, Tix and TixModule
parent
7d400662
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Trace/Hpc/Tix.hs
+16
-1
16 additions, 1 deletion
Trace/Hpc/Tix.hs
Trace/Hpc/Util.hs
+11
-2
11 additions, 2 deletions
Trace/Hpc/Util.hs
with
27 additions
and
3 deletions
Trace/Hpc/Tix.hs
+
16
−
1
View file @
b5454680
{-# LANGUAGE CPP #-}
#
if
__GLASGOW_HASKELL__
>=
704
{-# LANGUAGE Safe #-}
{-# LANGUAGE Safe
, DeriveGeneric, StandaloneDeriving
#-}
#
elif
__GLASGOW_HASKELL__
>=
702
-- System.FilePath in filepath version 1.2.0.1 isn't marked or implied Safe,
-- as shipped with GHC 7.2.
...
...
@@ -16,6 +16,11 @@ module Trace.Hpc.Tix(Tix(..), TixModule(..),
tixModuleName
,
tixModuleHash
,
tixModuleTixs
,
readTix
,
writeTix
,
getTixFileName
)
where
#
if
__GLASGOW_HASKELL__
>=
704
import
GHC.Generics
(
Generic
)
import
Control.DeepSeq
(
NFData
)
#
endif
import
System.FilePath
(
replaceExtension
)
import
Trace.Hpc.Util
(
Hash
,
catchIO
,
readFileUtf8
,
writeFileUtf8
)
...
...
@@ -25,6 +30,11 @@ import Trace.Hpc.Util (Hash, catchIO, readFileUtf8, writeFileUtf8)
data
Tix
=
Tix
[
TixModule
]
deriving
(
Read
,
Show
,
Eq
)
#
if
__GLASGOW_HASKELL__
>=
704
deriving
instance
(
Generic
Tix
)
instance
NFData
Tix
#
endif
data
TixModule
=
TixModule
String
-- module name
Hash
-- hash number
...
...
@@ -32,6 +42,11 @@ data TixModule = TixModule
[
Integer
]
-- actual ticks
deriving
(
Read
,
Show
,
Eq
)
#
if
__GLASGOW_HASKELL__
>=
704
deriving
instance
(
Generic
TixModule
)
instance
NFData
TixModule
#
endif
-- TODO: Turn extractors below into proper 'TixModule' field-labels
tixModuleName
::
TixModule
->
String
tixModuleName
(
TixModule
nm
_
_
_
)
=
nm
...
...
This diff is collapsed.
Click to expand it.
Trace/Hpc/Util.hs
+
11
−
2
View file @
b5454680
{-# LANGUAGE CPP #-}
#
if
__GLASGOW_HASKELL__
>=
704
{-# LANGUAGE Safe #-}
{-# LANGUAGE Safe
, DeriveGeneric, StandaloneDeriving
#-}
#
elif
__GLASGOW_HASKELL__
>=
702
{-# LANGUAGE Trustworthy #-}
#
endif
...
...
@@ -22,7 +22,11 @@ module Trace.Hpc.Util
,
writeFileUtf8
)
where
import
Control.DeepSeq
(
deepseq
)
#
if
__GLASGOW_HASKELL__
>=
704
import
GHC.Generics
(
Generic
)
#
endif
import
Control.DeepSeq
(
deepseq
,
NFData
)
import
qualified
Control.Exception
as
Exception
import
Data.List
(
foldl'
)
import
Data.Char
(
ord
)
...
...
@@ -81,6 +85,11 @@ class HpcHash a where
newtype
Hash
=
Hash
Word32
deriving
(
Eq
)
#
if
__GLASGOW_HASKELL__
>=
704
deriving
instance
(
Generic
Hash
)
instance
NFData
Hash
#
endif
instance
Read
Hash
where
readsPrec
p
n
=
[
(
Hash
v
,
rest
)
|
(
v
,
rest
)
<-
readsPrec
p
n
...
...
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