[Haskell-beginners] Need help groking the statement: expression1 in term:expression2

Quanyang Liu lqymgt at gmail.com
Tue Mar 22 10:57:56 UTC 2016


On Tue, Mar 22 2016 at 18:43:46 +0800, Olumide wrote:
> Hello List,
>
> I'd appreciate help understanding the second line of following block
> of code (from LYH, first line added for completeness),
>
> http://learnyouahaskell.com/input-and-output#randomness
> randoms' :: (RandomGen g, Random a) => g -> [a]
> randoms' gen = let (value, newGen) = random gen in value:randoms' newGen
>

It's equivalent to the following:
     randoms' gen = let (value, newGen) = random gen
                    in value:(randoms' newGen)

> The part I'm really struggling with is random gen in value:randoms' newGen
>
> Thanks,
>
> - Olumide

-- 
Thanks,
Quanyang


More information about the Beginners mailing list