named icon indicating copy to clipboard operation
named copied to clipboard

Add an explicit parameter builder for `Symbol`

Open 3noch opened this issue 6 years ago • 4 comments

If your parameter has odd characters in the string, you can't use the # syntax for overloaded labels. Instead you need an explicit builder like fn ! namedArg @"my-arg" 5.

3noch avatar May 23 '19 22:05 3noch

This should be addressed by GHC Proposal #40: Unrestricted Overloaded Labels.

For the time being, I believe you can use fromLabel:

fn ! fromLabel @"my-arg" 5

int-index avatar May 23 '19 22:05 int-index

Great. Should this be in the docs somewhere?

3noch avatar May 23 '19 23:05 3noch

I'm not sure. It doesn't seem like something with good ergonomics, why use fromLabel @"my-arg" instead of #my_arg?

int-index avatar May 24 '19 09:05 int-index

The docs would explain exactly this: "You may be tempted to use fancy strings for your arguments like "my-arg" because the type-level annotation allows it. But using this at the label level is not yet supported (see proposal) and requires that you do this: fromLabel @"my-arg". The idea of the doc being: Avoid people coming to GitHub and posting my question again. :)

3noch avatar May 24 '19 14:05 3noch