diff --git a/spago.yaml b/spago.yaml new file mode 100644 index 0000000..85b6580 --- /dev/null +++ b/spago.yaml @@ -0,0 +1,22 @@ +package: + dependencies: + - arrays + - assert + - console + - control + - effect + - foldable-traversable + - gen + - integers + - maybe + - partial + - prelude + - quickcheck + - random + - strings + - unordered-collections + name: uuidv4 +workspace: + extra_packages: {} + package_set: + url: https://raw.githubusercontent.com/purescript/package-sets/psc-0.15.4-20221024/packages.json diff --git a/src/UUID/Random.purs b/src/UUID/Random.purs index 0f610a4..98ad50d 100644 --- a/src/UUID/Random.purs +++ b/src/UUID/Random.purs @@ -10,6 +10,7 @@ import Prelude import Control.Alternative (guard) import Data.Array as Array +import Data.Hashable (class Hashable, hash) import Data.Int as Int import Data.Maybe (Maybe, fromJust) import Data.String as String @@ -24,6 +25,9 @@ import Partial.Unsafe (unsafePartial) -- | A type for version 4 (random) UUIDs. data UUIDv4 = UUIDv4 String (Array Int) +instance Hashable UUIDv4 where + hash (UUIDv4 s _) = hash s + instance Eq UUIDv4 where eq (UUIDv4 a _) (UUIDv4 b _) = a == b