uid-0.1.0.1: Simple unique identifier datatype, serializable and encodable as base32

Safe HaskellNone

Data.UID

Description

A UID is a unique identifier, generated from Data.UUID.V4.

These identifiers are designed for easy presentation as Base32, using Codec.Binary.Base32, and for transport in a JSON format using Data.Aeson.

The primary constructor, newUID, runs in the IO monad, primarily because of its use of a random number generator during construction. If all you need is a unique string, then newUIDString is just a wrapper that creates a new UID and then invokes toBase32 on it.

Synopsis

Documentation

data UID Source

A new, randomly generated identifier

newUID :: IO UIDSource

Construct a new unique identifier.

newUIDString :: IO StringSource

Construct a new identifier and immediately convert to its base32 representation using toBase32

fromBase32 :: String -> UIDSource

Convert a base32 String representation of the UID back into a UID instance.

toBase32 :: UID -> StringSource

Convert the UID into a base32 String representation'.