William lived in the mid to late 1700s. He was a Christian, but one who battled with depression all his life. He was a poet who also ended up writing many hymns, including his most famous, "There is a fountain." He lived with his good friend John Newton most of his life who loved him well during his dark days.
He wrote a hymn called "God moves in a mysterious way" the day before he fell into his greatest depression that lasted until he died. It is a hymn that has greatly comforted me during my darker days over the last several years. It is reminiscent of Jeremiah's Lamentations, when, after he groans over his life devoid of happiness, he says this:
"But this I call to mind, and therefore I have hope: The steadfast love of the Lord never ceases; his mercies never come to an end; they are new every morning; great is Your faithfulness."
So let this hymn remind you, Christian, that now matter how hard things seem to be in your life, God is always sovereign and working all things out for your greater good, your richer joy, and for His greater glory.
God moves in a mysterious way His wonders to perform;
He plants His footsteps in the sea and rides upon the storm.
Deep in unfathomable mines of never failing skill.
He treasures up His bright designs and works His sovereign will.
Ye fearful saints, fresh courage take, the clouds ye so much dread
Are big with mercy and shall break in blessings on your head.
Judge not the Lord by feeble sense, but trust Him for His grace;
Behind a frowning providence, He hides a smiling face.
His purposes will ripen fast, unfolding every hour.
The bud may have a bitter taste, but sweet will be the flower.
Blind unbelief is sure to err and scan His work in vain;
God is His own interpreter, and He will make it plain.
Here's Piper's bio of WIlliam.