[Haskell-beginners] Bounded number types?

stuebinm stuebinm at disroot.org
Sat Feb 27 18:00:27 UTC 2021


Hi all,

I'm wondering: is there any type that represents e.g. a floating point 
value that is guaranteed to be within some interval (e.g. [0,1]?).

My practical use-case would be that I'm reading in input data from json, 
which may be ill-behaved — obviously I could just manually check, and 
then keep track of which numbers in which record fields are within which 
intervals, but coming from less strongly typed programming languages I 
wonder if there would be a "typed" way to do this, too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x695C841098BECF1D.asc
Type: application/pgp-keys
Size: 3131 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20210227/d108a61f/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20210227/d108a61f/attachment.sig>


More information about the Beginners mailing list