New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of arguments to createSecurityGroup changed #439

Open
rcook opened this Issue Jan 11, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@rcook
Contributor

rcook commented Jan 11, 2018

I just noticed that in change 2de11d0 (specifically at 2de11d0#diff-bca0cdb904543d15c42fc6d872ed01c3R86), that regenerated amazonka-ec2, the order of the arguments to createSecurityGroup was (seemingly arbitrarily) flipped from:

createSecurityGroup
    :: Text -- ^ 'csgGroupName'
    -> Text -- ^ 'csgDescription'

to

createSecurityGroup
    :: Text -- ^ 'csgDescription'
    -> Text -- ^ 'csgGroupName'

Since both arguments are of type Text, this will result in a breaking behavioural change in code that will continue to compile. This change tripped me up when migrating a project from version 1.4.5 to master of amazonka-ec2.

Would it be possible to generate methods like this with a newtype wrapper or equivalent to distinguish the arguments, e.g.

newtype SecurityGroupDescription = SecurityGroupDescription Text
newtype SecurityGroupName = SecurityGroupName Text
createSecurityGroup
    :: SecurityGroupDescription -- ^ 'csgDescription'
    -> SecurityGroupName -- ^ 'csgGroupName'

That way, at least, old code would fail to compile and would require manual developer intervention to remedy the problem instead of failing at runtime.

@rcook

This comment has been minimized.

Show comment
Hide comment
@rcook

rcook Jan 11, 2018

Contributor

See also #435.

Contributor

rcook commented Jan 11, 2018

See also #435.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment