[Haskell-beginners] Bool newtype
Imants Cekusins
imantc at gmail.com
Sun Aug 7 21:12:26 UTC 2016
Thank you Theodore.
> Data.Coerce
Could you hint the name of the package, please? Does it coerce safely?
If Coercible does not type check, another option could be to define a class
and a function that works similar to if statement, constrained to instances
of this class.
class Newtype_base nt base where
base_t::nt -> base
if_::Newtype_base nt Bool =>
nt -> then -> else
Standard if is clearer of course but with a few newtypes being passed
around, this may save some key strokes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160807/51f16e88/attachment.html>
More information about the Beginners
mailing list