PROPOSAL: Add 'Natural' type to base:Data.Word

Mario Blažević blamario at acanac.net
Fri Nov 14 03:34:58 UTC 2014


On 13/11/14 05:35 PM, Brandon Allbery wrote:
> On Thu, Nov 13, 2014 at 5:20 PM, Mario Blažević <mblazevic at stilo.com 
> <mailto:mblazevic at stilo.com>> wrote:
>
>     Regarding the partial vs. saturated negation, I'm in favour of the
>     former. However, there is another option nobody mentioned so far: NaN
>
>
> NaN is only defined in the context of IEEE floating point; as such, it 
> is not available for this use.

     I'm aware of the current uses of NaN. I was just suggesting that 
the same concept could be used for operations on natural values that go 
out of band. Just like we have

    isNaN :: RealFloat a => a -> Bool

we could add a function

    isUnnatural :: Natural -> Bool

and replace exceptions by an unnatural Natural values... I'm open to an 
alternative terminology. The important question is whether this approach 
is feasible for the implementation.



More information about the Libraries mailing list