
4 Aug
2011
4 Aug
'11
6:49 a.m.
Once you've validated your user input though, nothing prevents you to have it return a Positive Int that you will guarantee can hold only positive integers, for example by using a smart constructor, and hiding the contructor in a separate module. You don't need dependant types for this.
Yes, but once you want to operate on that data you'll note the difference: subtract :: Positive Int -> Positive Int -> ??? IIUC with dependent types you'll have a compile time guarantee, without you'll have to test for errors at runtime. Regards, Thomas