[Haskell-cafe] Intuitive function given type signature

Brent Yorgey byorgey at seas.upenn.edu
Thu May 20 11:51:15 EDT 2010


On Thu, May 20, 2010 at 11:53:09AM +1200, Richard O'Keefe wrote:
>
> On May 20, 2010, at 3:18 AM, Brent Yorgey wrote:
>
>> On Wed, May 19, 2010 at 04:27:14AM +0000, R J wrote:
>>>
>>> What are some simple functions that would naturally have the following 
>>> type signatures:
>>> f :: (Integer -> Integer) -> Integer
>>
> The key point is the 'that would NATURALLY have', which I take
> to mean "as a result of type inference without any forcibly
> imposed type signatures".

Given that this is an exercise in Chapter 1, I kind of doubt this is
really what it is supposed to mean.  Are people reading chapter 1
really expected to understand the intricacies of type inference and
the Num class?  And to know about 'toInteger' and the fact that
numeric constants are polymorphic?  I really doubt it.  I read the
question much more simply, with "naturally" having a much more
informal meaning than you suggest.  I interpret the question as simply
getting the reader some practice with basic higher-order types.

I haven't read the Bird book though, so I could be wrong.

-Brent


More information about the Haskell-Cafe mailing list