I read about lazy grades in haskell and ask a question. For example, we have the following calculations:
Prelude> let x = 1 + 1 :: Int Prelude> let y = (x,x)
And after getting the x value:
Prelude> :sprint x x = _
This is not appreciated. So now you can get the y value:
Prelude> :sprint y y = (_,_)
This is not appreciated either, because y depends on x and it unevaluated . Now try the same example, but without ::Int :
Prelude> let x = 1 + 1 Prelude> let y = (x, x) Prelude> :sprint y y = _
Why is y value of _ instead of (_, _) when we try without ::Int ?
I see that they have different types:
Prelude> let x = 1 + 1 Prelude> :tx x :: Num a => a Prelude> let x = 1 + 1 :: Int Prelude> :tx x :: Int
But why do y values ββdepend on it?
Thanks.
source share