Wanted: warning option for usages of unary minus

John Meacham john at repetae.net
Mon May 21 21:21:31 EDT 2007


On Mon, May 21, 2007 at 10:33:56AM +0100, Simon Marlow wrote:
> I think that we could easily remove the '3e4' lexical syntax though, since 
> '3*10^^4' works just as well (I often write the latter anyway) (and guess 
> what, I just had to look up the difference between ^ and ^^, only to 
> discover I picked the wrong one).  The '3e4' syntax is a common source of 
> compiler bugs, becuase it is rarely used and hence rarely tested.

but they have substantially different translations.

3e2 -> fromRational (300 % 1)

3*10^^2   ->

(fromInteger 3) * (fromInteger 10) ^^ (2 :: Foo)

where Foo is whatever 4 defaults to, probably Integer, but could be a
compile error if defaulting is off or changed.

Though, the current floating point support in haskell is pretty funky as
is...

        John 

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Glasgow-haskell-users mailing list