[commit: ghc] master: Make Unique a newtype (d3feb16)

git at git.haskell.org git at git.haskell.org
Thu Jul 28 15:15:12 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/d3feb16a91bb285ce677fb79381f36e9fcdc0979/ghc

>---------------------------------------------------------------

commit d3feb16a91bb285ce677fb79381f36e9fcdc0979
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date:   Thu Jul 28 15:13:54 2016 +0000

    Make Unique a newtype
    
    Reviewers: austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2432


>---------------------------------------------------------------

d3feb16a91bb285ce677fb79381f36e9fcdc0979
 compiler/basicTypes/Unique.hs | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/compiler/basicTypes/Unique.hs b/compiler/basicTypes/Unique.hs
index 545ea9f..c42b825 100644
--- a/compiler/basicTypes/Unique.hs
+++ b/compiler/basicTypes/Unique.hs
@@ -87,12 +87,10 @@ The @Chars@ are ``tag letters'' that identify the @UniqueSupply at .
 Fast comparison is everything on @Uniques@:
 -}
 
---why not newtype Int?
-
 -- | The type of unique identifiers that are used in many places in GHC
 -- for fast ordering and equality tests. You should generate these with
 -- the functions from the 'UniqSupply' module
-data Unique = MkUnique {-# UNPACK #-} !Int
+newtype Unique = MkUnique Int
 
 {-
 Now come the functions which construct uniques from their pieces, and vice versa.



More information about the ghc-commits mailing list