[Haskell-cafe] positive Int
brad clawsie
clawsie at fastmail.fm
Thu Aug 2 15:29:46 EDT 2007
On Thu, Aug 02, 2007 at 12:17:06PM -0700, brad clawsie wrote:
> as far as i know, the haskell standard does not define a basic Int
> type that is limited to positive numbers.
>
> would a type of this kind not potentially allow us to make stronger
> verification statements about certain functions?
>
> for example, 'length' returns an Int, but in reality it must always
> return a value 0 or greater. a potential counter-argument would be the
> need to possibly redefine Ord etc for this more narrow type...
i suppose one could also say that the range [0..] of return values is
*implicit* in the function definition, so there is little value in
explicitly typing it given all of the hassle of specifying a new
typeclass etc
sorry, yes i am talking to myself
More information about the Haskell-Cafe
mailing list