Towards a More Efficient Selection Monad
摘要
This paper explores a novel approach to selection functions through the introduction of a generalised selection monad. The foundation is laid with the conventional selection monad \(J\) , defined as \((A \rightarrow R) \rightarrow A\) , together with various combinators for computing new selection functions from old. However, inefficiencies in these combinators are identified. To address these issues, a specialised type \(K\) is introduced, and its isomorphism to \(J\) is demonstrated. The paper further generalises the \(K\) type to \(G\) , where performance improvements and enhanced intuitive usability are observed. The embeddings between \(J\) and \(G\) are established, offering a more efficient and expressive alternative to the well established \(J\) type for selection functions. The findings emphasise the advantages of the generalised selection monad and its applicability in diverse scenarios, paving the way for further exploration and optimisation.