[Haskell-beginners] Bool newtype

Rein Henrichs rein.henrichs at gmail.com
Sat Aug 13 20:27:22 UTC 2016


Consider replacing your bools with meaningful sum types, which avoids this
issue, prevents boolean blindness, and makes your code more
self-documenting.

For example, instead of newtype SwitchsState = SwitchState Bool, data
SwitchState = On | Off
On Sun, Aug 7, 2016 at 2:47 PM Imants Cekusins <imantc at gmail.com> wrote:

> found it:
>
> https://wiki.haskell.org/GHC/Coercible
>
> yep, it type checks.
>
> Ta
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160813/1ab998e3/attachment.html>


More information about the Beginners mailing list