Skip to content
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

Change references to replicateM to replicateA in dlint rules #5933

Merged
merged 1 commit into from
May 11, 2020

Conversation

da-tanabe
Copy link
Contributor

@da-tanabe da-tanabe commented May 11, 2020

changelog_begin
Change references to replicateM to replicateA in dlint rules; remove some Haskell-based rules that do not yet apply in DAML.
changelog_end

Noticed this when writing

mapA create $ replicate copies book

and dlint suggested:

….daml:37:11-45: Warning: Use replicateM
Found:
  mapA create $ replicate copies book
Perhaps:
  replicateM copies (create book)

When applying the fix, I also noticed a comment a few lines up about zipWithA not existing in the stdlib, so I commented out a few rules in the same block as well.

@da-tanabe da-tanabe requested a review from a user May 11, 2020 15:48
Copy link
Contributor

@shayne-fletcher shayne-fletcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

- warn: {lhs: sequence_ (replicate n x), rhs: DA.Action.replicateM_ n x}
- warn: {lhs: mapA f (replicate n x), rhs: DA.Action.replicateM n (f x)}
- warn: {lhs: mapA_ f (replicate n x), rhs: DA.Action.replicateM_ n (f x)}
# TODO(DKT): Commented out because neither `mapAndUnzipA` nor `zipWithA` are in the stdlib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@da-tanabe I think just delete these. We can always add them back.

…some Haskell-based rules that do not yet apply in DAML.

changelog_begin
dlint: Change references to replicateM to replicateA; remove some Haskell-based rules that do not currently apply in DAML.
changelog_end
@da-tanabe da-tanabe force-pushed the dlint-replicateAFix branch from ac301dd to 9634052 Compare May 11, 2020 16:16
@da-tanabe da-tanabe merged commit 60b2649 into master May 11, 2020
@da-tanabe da-tanabe deleted the dlint-replicateAFix branch May 11, 2020 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants