[Haskell-cafe] Monadic Floating Point [was: Linking and unsafePerformIO]

Ariel J. Birnbaum valgarv at gmx.net
Wed Oct 15 19:24:38 EDT 2008


On Wednesday 15 October 2008 05:21:04 John Dorsey wrote:
> Should all floating point numerals be in the IO Monad?

I'm deviating from the thread's topic, but I tend to agree with this one. 
Maybe not IO directly, but some kind of STM-style monad, at least (that is, 
FP operations are composable but ultimately they must be evaluated in IO).

Floating point operations, at least by IEEE754, depend on environmental 
settings like the current rounding mode. They may modify state, like the 
sticky bits that indicate an exception occurred. They may jump nonlocally if  
a trap handler has been enabled.

None of these help in making an expression like 
  (a + b) + c == a + (b + c) :: Bool
any more referentially transparent than
  getChar : getChar : [] :: [Char]
would be if it was legal.

Anyway, enough rant for tonight. Sorry for the hijack.
We now resume our regular transmissions.
-- 
Ariel J. Birnbaum


More information about the Haskell-Cafe mailing list