spago icon indicating copy to clipboard operation
spago copied to clipboard

Fix byPrefix examples in the README

Open cwstra opened this issue 5 months ago • 4 comments

Description of the change

Running spago 0.93.44 and purs 0.15.15, when trying out the byPrefix censor example in the configuration section of the README, it doesn't actually work.

import Data.Array as Array
import Data.Map (Map)

--warning still happens at this declaration
fn :: Array (Map String String) -> Map String String
fn = Array.fold

Turns out, to properly silence this, we'd need to include the "A custom warning occurred" blurb, as well as fixing some of the quotation marks.

Checklist:

  • [ ] Added the change to the "Unreleased" section of the changelog
  • [ ] Added some example of the new feature to the README
  • [ ] Added a test for the contribution (if applicable)

cwstra avatar Jun 01 '25 22:06 cwstra

I think that was supposed to work and broke at some point? It looks like we don't have tests for this (or well, I couldn't find them), and I'd rather add tests and fix the implementation than change the README.

f-f avatar Jun 08 '25 15:06 f-f

Based on the git blame for the UserMessage in question, I don't think the quotations in the text would have allowed the old version to ever work.

cwstra avatar Jun 09 '25 14:06 cwstra

Sounds good - but to be clear I consider this a bug, in the sense that the README is correct and the implementation is wrong. So I am not going to merge a documentation change to document the bug, and the only change that I'm willing to merge is fix+tests so that spago behaves like documented.

If you'd like to have a go at fixing it then we can keep this PR open, otherwise we should close it and open a bug report instead

f-f avatar Jun 11 '25 21:06 f-f

What exactly is wrong with the implementation? The message in question starts with A custom warning occurred while solving type class constraints:

cwstra avatar Jun 12 '25 14:06 cwstra