David Dalrymple, Lord Hailes — Scottish judge and historian