[Haskell-cafe] Specify compile error

Ismael Figueroa Palet ifigueroap at gmail.com
Thu May 3 17:36:07 CEST 2012


Hi, I'm writing a program like this:

data B = B Int
data A = Safe Int | Unsafe Int

createB :: A -> B
createB (Safe i) = B i
createB (Unsafe i) = error "This is not allowed"

Unfortunately, the situation when createB is called with an Unsafe value is
only checked at runtime.
If I omit the second case, it is not an error to not be exhaustive :-(

Is there a way to make it a compile time error??

Thanks!
-- 
Ismael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120503/e006858f/attachment.htm>


More information about the Haskell-Cafe mailing list