brendanhay / gogol

A comprehensive Google Services SDK for Haskell.
Other
281 stars 105 forks source link

Design question: newtypes #69

Closed MichaelXavier closed 7 years ago

MichaelXavier commented 7 years ago

Hey there!

I'm taking gogol for a spin. I'm a long time amazonka user and noticed that theres some departers from the amazonka design. In particular, in amazonka, things like BucketName are a newtype over text which I really like because it helps prevent you from mixing up something that's semantically a BucketName with one of the most ubiquitous types. I noticed in gogol-storage its just a Text. I'm curious if this was a conscious decision and if so, why?

brendanhay commented 7 years ago

It's unfortunately something that propagates directly from the service definitions and the generator's interpretation of, as opposed to a concious decision. Additionally some of the newtypes present in amazonka have been retroactively added over time whereas gogol hasn't seen the same amount of attention.

I currently have some changes in the works which unify the generation steps of both library suites and should make things like this much more consistent + easier to layer on if absent from the definitions.

MichaelXavier commented 7 years ago

Makes sense. I figured it would be something like that. As long as you're amenable to updates and there's a sensible way to customize the types beyond what is generated from the docs, I think its a good position to be in. We're still investigating google cloud but if we end up using it I'll probably be looking at implementing some improvements.