
7 Aug
2016
7 Aug
'16
4:48 p.m.
As-is, no. As Michael said, that would defeat the purpose of a newtype.
However, there is a generic way: all newtypes are given instances of
Coercible, so instead of individual unwrap functions you can use coerce
from Data.Coerce.
On Aug 7, 2016 7:59 AM, "Imants Cekusins"
newtype B = B { toBool :: Bool }
yep, this works well. toBool b1 is easy enough ;)
I wondered if there was an easy (with deriving etc) way to test B as it is. If there isn't - no biggie.
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners