[Haskell-beginners] numerical types, the $ operator

John Dorsey haskell at colquitt.org
Sat Mar 28 17:53:54 EDT 2009


> > How would an experienced guy write this without parentheses?
> 
> I'm fairly certain it's impossible to write it without using
> parentheses.  I would probably just write
> 
>   x - fromInteger (floor x)

Never impossible!

flip subtract x . fromInteger $ floor x
case floor x of y -> x - fromInteger y
let y = floor x in x - fromInteger y

I guess I wouldn't choose any of these for readability, though.  Brent's
version is succinct.

Cheers,
John



More information about the Beginners mailing list