[Haskell-beginners] Bool newtype

Imants Cekusins imantc at gmail.com
Sun Aug 7 13:13:26 UTC 2016


True: distinct types help. In this case a function expects a couple bool
args so  the newtypes help ensure that correct args are passed in correct
order.

However when working with vals within a function, it may be handy to be
able to deduce bool from the newtype, at least to be used with if. This may
introduce complexity so not suggesting / requesting anything. Just
thought:  something might be already available.

For example, num-like newtypes can be added, compared as are, without the
need to extract the num. Num newtypes conveniently can be derived with
"deriving".

A function you suggest is good and it works. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160807/fee6d450/attachment.html>


More information about the Beginners mailing list