Home >

monad

Advertisement
  • Why does Scala name monadic composition as "for comprehension"?January 16

    Not sure if it's an appropriate question, but here it goes. I know Haskell's do notation pretty well. And I realized that Scala's "for comprehension" really is just mostly the same as do notation in Haskell. Something I don't quite understand is

  • What is the purpose of wrapped values in Haskell?November 24

    I've recently read an article about Functors, Applicatives and Monads in Haskell and it concludes with these statements: functors: you apply a function to a wrapped value using fmap or <$> applicatives: you apply a wrapped function to a wrapped valu

  • Is the benefit of the IO monad pattern for handling side effects purely academic?August 5

    Sorry for yet another FP + side effects question, but I couldn't find an existing one which quite answered this for me. My (limited) understanding of functional programming is that state/side effects should be minimised and kept separate from statele

  • How to manage the state in a GUI app with HaskellJune 28

    I am using wxHaskell to create a simple GUI that has typical components like Buttons, Panels, etc. When some of these components perform an action (like callback), the generic status of the application can change. To keep the status I am using IORef

  • How is the UnitOfWork pattern related to Monadic programming?March 14

    Looking over the definition of the Unit of Work pattern it seems very much like what a programmer would get if they implemented a Monad such as an IO or Transaction Monad. What makes the unit of work concept fundamentally different from the use of a

  • When we say a monad 'encapsulates a computation' - is this just saying 'wraps a functional transformation of data'?September 26

    When I think of the word 'computation' - my mind jumps to lambda calculus or operations on a state machine representing a CPU. It is quite a broad definition. Now some people talk about monads as 'representing a unit of a computation'. But if we cons

  • When does a Monad become a hammer?July 15

    I realize my precursory understanding on Monads is severely lacking in detail considering my knowledge comes mostly from Douglas Crockford's Monads and Gonads talk and complicated with my sevear handicap with Haskell (which looks like a bunch of non-

  • What is the "Free Monad + Interpreter" pattern?June 2

    I've seen people talking about Free Monad with Interpreter, particularly in the context of data-access. What is this pattern? When might I want to use it? How does it work, and how would I implement it? I understand (from posts such as this) that it'

  • Picking a card from a shuffled deckApril 9

    I'm pretty new to Haskell although I did some ML many moons ago. I'm trying to set up a deck of playing cards, shuffle them and then deal them. I have the deck and shuffle sorted (of a fashion) but I'm not sure what I'm doing after that. This is what

  • Are monads a viable (maybe preferable) alternative to inheritance hierarchies?April 2

    I'm going to use a language-agnostic description of monads like this, first describing monoids: A monoid is (roughly) a set of functions that take some type as a parameter and return the same type. A monad is (roughly) a set of functions that take a

  • What is this programming style? "Monoid-ic"?March 17

    In a moderately old blog post, Conal Elliot makes an interesting (if less than serious) argument that C is a purely functional language, by drawing a parallel between the combination of the C preprocessor and C itself, and that of Haskell's pure expr

  • Why does a monad use "return" or "unit" rather than "lift"?March 3

    This is partly genuine curiosity, and partly a check on my understanding. I'm probably missing the point. In Haskell, why does a monad use operations called return or unit to describe putting a type into the container -- lifting it into the monadic s

  • Why doesn't monad take `(M a - M b)`?February 26

    All apologies -- I'm still very much on the outside of Haskell looking in. Why does the bind for a monad have this signature: M a -> (a -> M b) -> M b and not M a -> (M a -> M b) -> M b i.e. a function that takes M a instead of just a a

  • Is this a monad in Java? (part 2)February 16

    My first try was on stackoverflow. I'm picking up on the answer there to improve my monad: StackOverflow - Is this a monad in Java? My goal is to write an example of a monad. I'm not trying to solve the general case, just come up with one to see how

  • Either Monad and Exceptional Circumstances December 4

    This question already has an answer here: I've been told that Exceptions should only be used in exceptional cases. How do I know if my case is exceptional? 11 answers I have a function returning an Either such as GetUserFromDb(int id). If the databas

  • Why is the Scala Option type not called Maybe, just as in Haskell? August 9

    Why is the Scala Option type not called Maybe, just as in Haskell? Maybe makes a lot more "semantic sense" to me, but maybe Option has different behaviour I am not aware of. Is there any particular reason why Option in Scala was not called Maybe

  • Better to use error monad with validation in your monadic functions, or implement your own monad with validation directly in your bind?January 28

    I'm wondering what's better design wise for usability/maintainability, and what's better as far as fitting with the community. Given the data model: type Name = String data Amount = Out | Some | Enough | Plenty deriving (Show, Eq) data Container = Co

  • What monad is the opposite of the error monad in haskellJanuary 20

    In the error monad, the first failure halts any execution further just carrying the fault through any following binds. What monad halts on success only carrying forward successes, and basically swallowing any faults and trying the next bind disregard

  • Futures/Monads vs EventsSeptember 25

    In an application framework when performance impact can be ignored (10-20 events per second at max), what is more maintainable and flexible to use as a preferred medium for communication between modules - Events or Futures/Promises/Monads? It's often

  • Critique of the IO monad being viewed as a state monad operating on the worldAugust 20

    The IO monad in Haskell is often explained as a state monad where the state is the world. So a value of type IO a monad is viewed as something like worldState -> (a, worldState). Some time ago I read an article (or a blog/mailing list post) that crit

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.496 s.