Why do Haskell numerical literals need to start and end with digits?

前端 未结 4 1048
误落风尘
误落风尘 2020-12-21 09:54

In The Haskell 98 Report it\'s said that

A floating literal must contain digits both before and after the decimal point; this ensures that a decimal p

4条回答
  •  北海茫月
    2020-12-21 10:40

    One of the most prominent usages of (.) is the function composition. And so the haskell compiler interpretes a . 1 composing the function a with a number and does not know what to do; analogously the other way 'round. Other usage of (.) could be found here.

    Other problems with .7 vs. 0.7 are not known to me.

提交回复
热议问题