exercism / purescript

Exercism exercises in PureScript.

Home Page:https://exercism.org/tracks/purescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

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 requires Partial πŸ‘Ž 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.