[Haskell-cafe] Newbie question: alternative for toInt/fromInt
Stefan O'Rear
stefanor at cox.net
Thu Jun 28 15:28:50 EDT 2007
On Thu, Jun 28, 2007 at 09:16:37PM +0200, peterv wrote:
> I'm trying to get the SOE graphics library to compile for Win32 using the
> latest libraries.
>
> I fixed a couple of imports, but in the file GraphicsTypes.hs, the functions
> toInt/fromInt are used, which are now obsolete:
>
> type Dimension = Int
>
> toDimension :: Win32.INT -> Dimension
>
> fromDimension :: Dimension -> Win32.INT
>
> toDimension = toInt
>
> fromDimension = fromInt
>
> I don't have a clue how to fix this, as I can't find alternatives for
> toInt/fromInt (except toInteger/fromInteger, but that would convert to
> heavyweight ints), but I guess it must be really easy?
Try using fromIntegral (which is sufficiently polymorphic that it works
both ways).
Stefan
More information about the Haskell-Cafe
mailing list