You already know it: the way you do this is with a homoiconic language. I don&#x27;t know of any &quot;formalisms&quot; of homoiconic languages, but there&#x27;s always Scheme. I don&#x27;t know why this idea is relevant though. If where you&#x27;re going with this is &quot;you can write code to take in a monad instance as an input syntax tree and verify it satisfies the laws&quot;, then I assure you that&#x27;s impossible in the general case.