purescript-codec-argonaut icon indicating copy to clipboard operation
purescript-codec-argonaut copied to clipboard

Json Decode Error naming

Open wclr opened this issue 3 years ago • 4 comments

Not an idle question:

Affjax error type called Error Data.Interval has type Error Some Halogen packages expose type Error

This package exposes JsonDecodeError type.

Why it is was decided this way? What should be the reasoning about how to name exposed error types (in particular) for package authors?

wclr avatar May 15 '21 06:05 wclr

I don't know, it's just what I happened to come up with on the day I wrote it.

garyb avatar May 15 '21 10:05 garyb

@garyb I guess. I know that the naming issue is hard, consistent naming even more. But we could try to come up with some reasoning in general on the topic on the example of this case. So it would be nice if you could suggest what you think about it, how those things should be designed, what should be taken into account in your view, and how would you name it if you designed it today.

wclr avatar May 15 '21 14:05 wclr

@wclr JsonDecodeError sounds like a reasonable error type name for here. One is dealing with Json and the error arises when decoding something that might not match the expected schema or type.

I think the real question is why the name, Error, was used in the other packages you mentioned above. (though perhaps I'm misunderstanding your question.) If so, then shouldn't this question be raised in other repos?

JordanMartinez avatar May 15 '21 17:05 JordanMartinez

I think Error would have been a good choice here actually. I generally name things without use-case specific prefixes/suffixes if I assume/intend modules to be imported qualified... aside from the fact that's generally the norm in PureScript already, I'd definitely be assuming people are going to be using qualification for this library the way most of the rest of it is named.

garyb avatar May 16 '21 02:05 garyb