
$ ghci Prelude> let isInteger' l = case properFraction l of { (_,0) -> 1; _ -> 0 } Prelude> isInteger' 2.0 1 Prelude> isInteger' 1.9 0 Do you really get 1? For what input types/values? Although I would write: isInteger = (== 0) . snd . properFraction
It never matches to (_, 0.0).... I mean case properFraction l of (_, 0) -> l _ -> 0 -- always goes here.
On Tue, Sep 29, 2009 at 2:18 PM, Jimmy Hartzell
wrote: Use properFraction: http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3Aprop...
Hi,  In other weak-type language, `round i == i` would work. But in haskell, what should I do? Thanks. -- 竹å¯å²å¦¨æµæ°´è¿ å±±é«åªé»éäºé£ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- 竹å¯å²å¦¨æµæ°´è¿ å±±é«åªé»éäºé£