syntax - Does an unused let binding have any effect in Haskell? -
I realized that it is actually legal to write:
two = sum [1 ..100] "Hello" in
There is no compelling absolutely anything to do this.
But now I am thinking about words here precise is possible to write a program in which a _
is binding, and so far Removing clearly means the meaning of the program will change?
Actually, I'm thinking, is it safe to remove automatic binding, as far as I can tell, the value of this bond is probably not affected by anything. Can do. However, it can be assumed that this type can affect anything else, can anyone make an example?
Here's an example. With the _
binding, the output is 8.0
, but without it, this is 8
(of course, this is not a huge difference, but I Sure it can be used as a base for something more important.)
main :: IO () main = let x = 5 _ = asTypeOf x 6.0 print $ X + 3
Comments
Post a Comment