Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoelQ/5b98bee8ee46131dd96742034d345bab to your computer and use it in GitHub Desktop.
Save JoelQ/5b98bee8ee46131dd96742034d345bab to your computer and use it in GitHub Desktop.

Making Impossible Functions Impossible

By putting effort into building the right data structures for your project, the compiler can guarantee that certain invalid states can never occur.

What about taking this idea a step further? How can we leverage the type system not just to prevent invalid states, but also invalid functions? We'll look at techniques for achieving this, overcoming some obstacles, and improving the readability of our code in the process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment