solidsnack/system-uuid — Issue #2: Error in Read instance
Author: solidsnack
Created: 2011-11-22 07:28:19+00:00
State: open

---------- Forwarded message ----------
From: Sebastiaan Visser
Date: 2011/11/18
Subject: Minor bug in system-uuid
To: oss@solidsnack.be

There seems to be a minor bug in system-uuid package, the Read
instance fails when reading UUIDs inside some other datatype,
for example Either. Probably due to some issues with read
precedence.

Here is a simple example that shows the problem:

> import Data.UUID
> import System.UUID.V4
> import System.Random
>
> type T = Either UUID Char
>
> main :: IO ()
> main =
> do u <- uuid
>
> -- Showing and reading UUIDs works fine.
> print (read (show u) :: UUID)
>
> -- Just showing UUIDs inside an Either works as expected.
> let l = Left u :: T
> r = Right 'a' :: T
> print l
> print r
>
> -- Showing UUIDs inside an Either and reading it back fails.
> let l' = read (show l) :: T
> r' = read (show r) :: T
> print l'
> print r'

The problem doesn't seem to appear in your old 'uuid' package.