945 research outputs found

    Comprehending monads

    Get PDF
    Category theorists invented monads in the 1960's to concisely express certain aspects of universal algebra. Functional programmers invented list comprehensions in the 1970's to concisely express certain programs involving lists. This paper shows how list comprehensions may be generalised to an arbitrary monad, and how the resulting programming feature can concisely express in a pure functional language some programs that manipulate state, handle exceptions, parse text, or invoke continuations. A new solution to the old problem of destructive array update is also presented. No knowledge of category theory is assumed

    Notions of Monad Strength

    Full text link
    Over the past two decades the notion of a strong monad has found wide applicability in computing. Arising out of a need to interpret products in computational and semantic settings, different approaches to this concept have arisen. In this paper we introduce and investigate the connections between these approaches and also relate the results to monad composition. We also introduce new methods for checking and using the required laws associated with such compositions, as well as provide examples illustrating problems and issues that arise.Comment: In Proceedings Festschrift for Dave Schmidt, arXiv:1309.455

    Constructing applicative functors

    Get PDF
    Applicative functors define an interface to computation that is more general, and correspondingly weaker, than that of monads. First used in parser libraries, they are now seeing a wide range of applications. This paper sets out to explore the space of non-monadic applicative functors useful in programming. We work with a generalization, lax monoidal functors, and consider several methods of constructing useful functors of this type, just as transformers are used to construct computational monads. For example, coends, familiar to functional programmers as existential types, yield a range of useful applicative functors, including left Kan extensions. Other constructions are final fixed points, a limited sum construction, and a generalization of the semi-direct product of monoids. Implementations in Haskell are included where possible

    Hard, Harder, and the Hardest Problem: The Society of Cognitive Selves

    Get PDF
    The hard problem of consciousness is explicating how moving matter becomes thinking matter. Harder yet is the problem of spelling out the mutual determinations of individual experiences and the experiencing self. Determining how the collective social consciousness influences and is influenced by the individual selves constituting the society is the hardest problem. Drawing parallels between individual cognition and the collective knowing of mathematical science, here we present a conceptualization of the cognitive dimension of the self. Our abstraction of the relations between the physical world, biological brain, mind, intuition, consciousness, cognitive self, and the society can facilitate the construction of the conceptual repertoire required for an explicit science of the self within human society

    Monadic parser combinators

    Get PDF
    In functional programming, a popular approach to building recursive descent parsers is to model parsers as functions, and to define higher-order functions (or combinators) that implement grammar constructions such as sequencing, choice, and repetition. Such parsers form an instance of a monad, an algebraic structure from mathematics that has proved useful for addressing a number of computational problems. The purpose of this report is to provide a step-by-step tutorial on the monadic approach to building functional parsers, and to explain some of the benefits that result from exploiting monads. No prior knowledge of parser combinators or of monads is assumed. Indeed, this report can also be viewed as a first introduction to the use of monads in programming

    How functional programming mattered

    Get PDF
    In 1989 when functional programming was still considered a niche topic, Hughes wrote a visionary paper arguing convincingly ‘why functional programming matters’. More than two decades have passed. Has functional programming really mattered? Our answer is a resounding ‘Yes!’. Functional programming is now at the forefront of a new generation of programming technologies, and enjoying increasing popularity and influence. In this paper, we review the impact of functional programming, focusing on how it has changed the way we may construct programs, the way we may verify programs, and fundamentally the way we may think about programs
    • …
    corecore