Skip to content

Instantly share code, notes, and snippets.

@MarcelineVQ
Created April 15, 2019 18:12
Show Gist options
  • Select an option

  • Save MarcelineVQ/1fd05c18ab83b39fd1edbcc66c8cb856 to your computer and use it in GitHub Desktop.

Select an option

Save MarcelineVQ/1fd05c18ab83b39fd1edbcc66c8cb856 to your computer and use it in GitHub Desktop.
data Foo = Bar | Baz
-- In haskell one can ensure coverage of the domain of a function (all cases of a datatype) by having ghc
-- tell you when a case is mising.
-- Can I ensure coverage of the codomain? (all outputs)
parse :: String -> Foo
parse "aba" = Bar
parse "za" = Baz -- how do I make it an error to omit this line? How can I make not covering Bar AND Baz a compiler error?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment