Thinking about abstract problems leads to really weird conceptual dreams and worse sleep for me, so I'd try meditation first
Re:Ask HN: How do you fall asleep?
by klekticist on Friday December 02, 2022 @02:59PM
(#33836011)
What sort of functional programming problems?
2. Go to my bedroom
3. Put on my pajamas
4. Turn off the lights
5. Uncover the comforter
6. Lay on top of the fitted sheets
7. Cover back the comforter
8. Close my eyes
All kidding aside one thing that helps insomnia for me is doing long an complex math equations, functional programming problems, or reading heady philosophy. You could also try meditation.