[GHC] #9816: Add function for size-checked conversion of Integral types

GHC ghc-devs at haskell.org
Fri Nov 21 22:45:13 UTC 2014


#9816: Add function for size-checked conversion of Integral types
-------------------------------------+-------------------------------------
              Reporter:  spl         |            Owner:
                  Type:  feature     |           Status:  patch
  request                            |        Milestone:
              Priority:  normal      |          Version:  7.9
             Component:  Core        |         Keywords:
  Libraries                          |     Architecture:  Unknown/Multiple
            Resolution:              |       Difficulty:  Unknown
      Operating System:              |       Blocked By:
  Unknown/Multiple                   |  Related Tickets:
       Type of failure:              |
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:  D512        |
-------------------------------------+-------------------------------------

Comment (by Herbert Valerio Riedel <hvr@…>):

 In [changeset:"02f8f6ad7bd3d792459a1d33e8d0d57dcf1ea424/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="02f8f6ad7bd3d792459a1d33e8d0d57dcf1ea424"
 Add function for size-checked conversion of Integral types

 The new function `Data.Bits.toIntegralSized` provides a similar
 functionality to `fromIntegral` but adds validation that the
 argument fits in the result type's size.

 The implementation of `toIntegralSized` has been derived from
 `intCastMaybe`
 (which is part of Herbert Valerio Riedel's `int-cast` package,
 see http://hackage.haskell.org/package/int-cast)

 Addresses #9816

 Reviewed By: ekmett, austin

 Differential Revision: https://phabricator.haskell.org/D512
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9816#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list