Add function for size-checked conversion of Integral types
ClosedPublic

Authored by spl on Nov 20 2014, 3:25 PM.

Details

Summary

This function provides a similar functionality to fromIntegral but adds validation that the argument fits in the result type's size.

Test Plan

Validate, add tests from int-cast

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
spl updated this revision to Diff 1605.Nov 20 2014, 3:25 PM
spl retitled this revision from to Add function for size-checked conversion of Integral types.
spl updated this object.
spl edited the test plan for this revision. (Show Details)
spl added reviewers: austin, hvr, ekmett.
spl updated the Trac tickets for this revision.
austin requested changes to this revision.Nov 20 2014, 10:24 PM
austin edited edge metadata.

Wouldn't this require a libraries@haskell.org proposal? @ekmett?

This revision now requires changes to proceed.Nov 20 2014, 10:24 PM
spl added a comment.Nov 20 2014, 10:46 PM
In D512#13459, @austin wrote:

Wouldn't this require a libraries@haskell.org proposal?

The thread is here, though the conclusion is not yet clear.

spl updated this revision to Diff 1622.Nov 21 2014, 1:14 AM
spl edited edge metadata.

Add base version and update changlog.md

hvr edited edge metadata.EditedNov 21 2014, 1:45 AM
hvr added a subscriber: simonpj.
In D512#13459, @austin wrote:

Wouldn't this require a libraries@haskell.org proposal? @ekmett?

@austin. See also @simonpj's request for a CLC ruling on that in the associated Trac #9816 ticket

Btw, I'm a bit worried that, apparently, there was so little interest (in terms of participants) during the libraries@ discussion. I would have liked more parties to express their opinion on this one.

hvr added a comment.Nov 21 2014, 1:48 AM

@spl, to speed things up, I'd suggest you shoot the CLC list an email asking for an official ruling

spl added a comment.Nov 21 2014, 2:38 AM
In D512#13540, @hvr wrote:

Btw, I'm a bit worried that, apparently, there was so little interest (in terms of participants) during the libraries@ discussion. I would have liked more parties to express their opinion on this one.

Me, too.

In D512#13543, @hvr wrote:

@spl, to speed things up, I'd suggest you shoot the CLC list an email asking for an official ruling

Done.

ekmett accepted this revision.Nov 21 2014, 4:00 PM
ekmett edited edge metadata.

Ok. Officially, let's make this happen

austin accepted this revision.Nov 21 2014, 4:04 PM
austin edited edge metadata.

Alright then!

This revision is now accepted and ready to land.Nov 21 2014, 4:04 PM
This revision was automatically updated to reflect the committed changes.