[Haskell-cafe] How unique is Unique

Emil Axelsson emax at chalmers.se
Fri May 27 14:40:13 CEST 2011


2011-05-27 13:12, Simon Marlow skrev:
> On 27/05/2011 08:35, Emil Axelsson wrote:
>> Hello!
>>
>> Lacking a proper blog, I've written some notes about Data.Unique here:
>>
>> http://community.haskell.org/~emax/darcs/MoreUnique/
>>
>> This describes a real problem that makes Data.Unique unsuitable for
>> implementing observable sharing.
>>
>> The document also proposes a solution that uses time stamps to generate
>> symbols that are "more unique".
>>
>> Does anyone have any comments on the proposed solution? Are there any
>> alternatives available?
>
> This has nothing to do with Unique, you are simply using unsafePerformIO
> in an unsafe way.  It is called unsafePerformIO for a reason :-)

Right, I wasn't suggesting this is a bug in Data.Unique. It's just that 
I need something different. I've added a note about this on the post.

Note that I am planning to wrap all this in a safe interface. So using 
unsafePerformIO should be fine in this case, as long as Unique symbols 
survive GHCi reloads.

/ Emil



More information about the Haskell-Cafe mailing list