uuid icon indicating copy to clipboard operation
uuid copied to clipboard

UUID deriving Generic

Open pmlodawski opened this issue 8 years ago • 5 comments

Hi! Can we make UUID deriving Generic?

pmlodawski avatar Jan 10 '17 13:01 pmlodawski

@pmlodawski UUID is an abstract data-type, i.e. its constructor is hidden so that its internal implementation can change (e.g. it could e.g. be arch-dependent whether it uses Word32 or Word64) w/o affecting the exposed API. Providing a Generic instance would weaken the abstraction as it would allow to look at the internal representation. What do you want/need a Generic instance for?

hvr avatar Mar 11 '17 09:03 hvr

I wanted it to derive ToJSON and FromJSON.

pmlodawski avatar Mar 22 '17 09:03 pmlodawski

@pmlodawski ...are you aware aeson versions now have From/ToJSON instances for UUID? :-)

hvr avatar Mar 22 '17 14:03 hvr

Yes, but unfortunately latest ghcjs use lts-7.19. If it is really a problem, I can manage without Generic here so we can close this. ;)

pmlodawski avatar Mar 22 '17 15:03 pmlodawski

I have a similar situation where I am using UUID keys in postgresql and would like to also use them in my corresponding data types. The problem is that I am also using those data types with elm-export which requires that you derive Generic for the type.

tekul avatar Mar 30 '17 17:03 tekul