Kevin Meredith
Kevin Meredith

Reputation: 41909

Restrictions on Types of `a -> b` Function

Let's say I have part of a function's signature:

f :: (a -> b) -> ...

Is there any restriction (such as their kinds) on the types of a and b?

a can't be a function, i.e. (c -> d), can it?

Upvotes: 2

Views: 72

Answers (1)

sepp2k
sepp2k

Reputation: 370102

a and b must have kind *, that is they must not be type constructors that require arguments. So they could be Integer, (c -> d) or Maybe String, but not (->), (a ->) or Maybe.

a can't be a function, i.e. (c -> d), can it?

Yes, it can. It can be any possible type of kind *.

Upvotes: 6

Related Questions