What is the fuction of infinitive located behind intransitive verb?

I know that there is no objective after intransitive verb, but I am confused that why infinitive can be located behind intransitive verb? For example, yearn to do sth, long to do sth,etc. Need you help. Thank u

Infinitives can perform the functions of many parts of speech. In your examples, I’d say that the infinitives are used as adverbs to express reason or purpose.