[Haskell-cafe] How to decide if a number is an integer?

Thomas DuBuisson thomas.dubuisson at gmail.com
Tue Sep 29 02:45:59 EDT 2009


On Mon, Sep 28, 2009 at 11:35 PM, Magicloud Magiclouds
<magicloud.magiclouds at gmail.com> wrote:
> It never matches to (_, 0.0)....
> I mean
> case properFraction l of
>  (_, 0) -> l
>  _ -> 0 -- always goes here.

Odd, it works fine for me.

f x =
        case properFraction x of
                (_,0) -> True
                _     -> False


*Main> f 5
True
*Main> f 5.5
False
*Main> f 4.0
True
*Main> f 4.00000001
False


Thomas


More information about the Haskell-Cafe mailing list