[Haskell-beginners] LYAH example

sasa bogicevic brutallesale at gmail.com
Wed Mar 22 11:44:23 UTC 2017

Hi All,
Can someone clarify the example I got from LYAH book. This let statement is kinda confusing to me : 

applyLog :: (a, String) -> (a -> (b, String)) -> (b, String)
applyLog (x, log) f = let (y, newLog) = f x in (y, log ++ newLog) 

I know that f applied to x should produce y and we append log with newLog but when reading  ... f x in (y, ...  I just don't see how f x becomes y in the let statement.
Seems more readable if we could write ... = (f x, log ++ newLog)

Thanks, Sasa

	name: Bogicevic Sasa
	phone: +381606006200

More information about the Beginners mailing list