Add signatures to all stub files
MatthijsBlom opened this issue Β· comments
I notice it is a recurring source of annoyance to me that I have to figure out the signatures myself. Not seeing any real benefit to omitting them, I propose to add them to all stub files.
I'm prepared to do this myself; I'm opening this issue in the hope of hearing your thoughts.
Thanks for reaching out @MatthijsBlom. I think this is reasonable and I see other languages do this as well:
- https://github.com/exercism/haskell/blob/main/exercises/practice/hello-world/src/HelloWorld.hs
- https://github.com/exercism/fsharp/blob/main/exercises/practice/hello-world/HelloWorld.fs
Feel free to start on a pull request.
I suppose it would be nice that the stub builds and raises an error indicating the function needs to be implemented. Something along the lines of: https://github.com/exercism/haskell/blob/main/exercises/practice/bob/src/Bob.hs
Great. I'll get started on a PR sometime in the near future.
I suppose it would be nice that the stub builds and raises an error indicating the function needs to be implemented.
Yes. I see four options:
- Use
?todo
, which raises a compile error, which is π, but also prevents a successful build, which is π’. - Use
crashWith
, which requiresPartial
π and thereby breaks the build π’. - Use
Undefined.undefined
, which allows for build π but results in an inscrutable runtime error π. - Use
unsafeThrow
, which allows for build π and gives a slightly better runtime error π€·.
In my experience a successful build is important to get the language server going, so I guess we should go with unsafeThrow
and accept its short-lived import
and normalization of unsafe.