[Haskell-cafe] Newbie question: alternative for toInt/fromInt

peterv bf3 at telenet.be
Fri Jun 29 10:34:45 EDT 2007


That would be too easy ;) Coming from C++, that was the first I tried too.
But in Haskell, an Win32.INT is not an Int:

GraphicsTypes.hs:46:16:
    Couldn't match expected type `Dimension'
           against inferred type `Win32.INT'
    In the expression: id
    In the definition of `toDimension': toDimension = id

GraphicsTypes.hs:47:16:
    Couldn't match expected type `Win32.INT'
           against inferred type `Dimension'
    In the expression: id
    In the definition of `fromDimension': fromDimension = id

Stefan O'Rear "fromIntegral" magic worked fine, thanks!

-----Original Message-----
From: Thomas Schilling [mailto:nominolo at googlemail.com] 
Sent: Thursday, June 28, 2007 9:40 PM
To: peterv
Cc: Haskell-Cafe at haskell.org
Subject: Re: [Haskell-cafe] Newbie question: alternative for toInt/fromInt

toInt = id
fromInt = id

?

On 28 jun 2007, at 21.16, 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?
>
>
>
> Thanks,
>
> Peter
>
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe




More information about the Haskell-Cafe mailing list