<div dir="ltr"><div>If I have a type</div><div><br></div><div><font face="monospace">type WaterChem = CaHardness NaturalChem | Alkalinity NaturalChem</font></div><div><br></div><div>and I want to have the values of <font face="monospace">CaHardness</font> and <font face="monospace">Alkalinity</font> constrained to positive <font face="monospace">Int</font> and between certain high and low values, I could do a <font face="monospace">newtype</font> to creater a <font face="monospace">NaturalChem</font> number, thus never less than 0, but what is the best practice to insure these values are between a certain range? Types in Haskell can't go that far, can they? Reading <a href="https://www.haskell.org/tutorial/moretypes.html">this</a> tells me I can have some of what I want. How are type values that need to be constrained handled best practices? Again, the type world of Haskell seems to do some of the lifting, but I'd like some advice if I want to have both of my constraints.</div><div><br></div><div><br></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>⨽<br></div>Lawrence Bottorff<div>Grand Marais, MN, USA</div><div><a href="mailto:borgauf@gmail.com" target="_blank">borgauf@gmail.com</a></div></div></div></div>