As i was going through Learn You a Haskell for Great Good , i came across following repeat function implementation :<div>   repeat&#39; ::  x - &gt; [x]</div><div>   repeat&#39; x = x : repeat&#39; x</div><div>My question is why it produces list in first place. 1:2:3 is not a list but 1:2:3:[] is. How comes haskell know that the things which we are adding will eventually added to the beginning of  empty list given things are infinite so you can specify the end which is [] . Then why doing 1:3:4 is not acceptable ?</div>

<div><br></div><div>Thanks</div><div>Divyanshu Ranjan </div>