garyb / purescript-codec-argonaut

Bi-directional JSON codecs for argonaut
MIT License
38 stars 16 forks source link

Json Decode Error naming #39

Open wclr opened 3 years ago

wclr commented 3 years ago

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?

garyb commented 3 years ago

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

wclr commented 3 years ago

@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.

JordanMartinez commented 3 years ago

@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?

garyb commented 3 years ago

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.