brendanhay / amazonka

A comprehensive Amazon Web Services SDK for Haskell.
https://amazonka.brendanhay.nz
Other
605 stars 226 forks source link

Finer data exports #851

Closed endgame closed 1 year ago

endgame commented 1 year ago

Selectively re-export bits of Amazonka.Data through Amazonka.Core, to avoid picking up serialisation classes/helpers which are only really of interest to service bindings. While it's important for library clients to get access to Amazonka.Data.Body, _Base64, _Sensitive, etc., it's very odd for for them to see Aeson's classes and functions re-exported by module Amazonka.

Please have a look at the changed examples to get a feel for how this looks in practice; there shouldn't be much of a change for library consumers. ToText and ToByteString are no longer exported by Amazonka; I think the examples make it look like a noisier problem than it will be in "real" code.

Once again, this means a full regeneration of everything; the branch is endgame/amazonka/finer-data-exports-gen.

Ping @ysangkok who reported this issue.

Closes #777 Fixes #728

ysangkok commented 1 year ago

Looks good! I see that stuff like runResourceT is exported on purpose, which makes sense, since it becomes more convenient. These are also this available after cabal repl in amazonka, not sure whether that is on purpose:

ghci> :info toSeconds
toSeconds :: Seconds -> DiffTime    -- Defined in ‘Amazonka.Types’
ghci> :info toMicroseconds 
toMicroseconds :: Seconds -> Int    -- Defined in ‘Amazonka.Types’

But this is definitely an improvement, so looks good to me!

endgame commented 1 year ago

Those exports exist on current main, and I can imagine people wanting to unpack amazonka's Seconds into other time types, so I think it's okay for them to stick around.