unique identifiers as a separate library

Sebastian Fischer sebf at informatik.uni-kiel.de
Thu Dec 18 11:58:11 EST 2008


On Dec 17, 2008, at 10:54 AM, Sebastian Fischer wrote:

> Would it be possible to put everything concerned with unique  
> identifiers in GHC into a separate package on Hackage?


I have wrapped up (a tiny subset of) GHC's uniques into the package  
`uniqueid` and put it on Hackage:

     http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uniqueid

It only provides

     type Id
     hashedId :: Id -> Int

     type IdSupply
     initIdSupply  :: Char -> IO IdSupply
     splitIdSupply :: IdSupply -> (IdSupply,IdSupply)
     idFromSupply  :: IdSupply -> Id

     instance Eq Id
     instance Ord Id
     instance Show Id

The main difference is due to my fear of depending on the foreign  
function `genSymZh` which I replaced by a global counting IORef.

The other difference is that the Show instance does not rely on GHC's  
static flags and can hence be used outside of GHC sessions.

The code is on github:

     http://github.com/sebfisch/uniqueid

Extensions welcome!

Cheers,
Sebastian


More information about the Glasgow-haskell-users mailing list