<div dir="ltr">iterate' :: (a -> a) -> a -> [a]<br><div><br></div><div>I am trying going to go ahead and write my own iterate function.  But before I do I want to be clear on types.</div><div><br></div><div>Looking at  :: (a -> a) -> a -> [a]</div>
<div><br></div><div>The first part is (a -> a)  Now because it is in parentheses it is a function?</div><div><br></div><div>I can call iterate like this:</div><div><div>take 5 $ iterate (*2) 5</div></div><div><br></div>
<div>So (*2) is a possible function.  Does the brackets mean it is a function, the left hand a is indicating a general type and the right hand a means the return type must be the same as the function type.  Eg in the case of (*2) the 2 is an Int so the function returns and Int?  Is my understanding correct?</div>
<div><br></div><div>How could this be better explained?</div><div><br></div><div>The last bit is easier to understand.  a -> [a] meaning a singleton of general type and [a] means a list of same type.</div><div><br></div>
<div><br></div><div><br></div><div><br></div><div><br></div></div>