Re: Monads and Middleware

2016-07-01 Thread James Reeves
Functions are a type of monad, and function composition is a type of monadic binding. You could certainly say that middleware are a type of monad, but so many things can be thought of as monads that's not hugely useful in and of itself. - James On 1 July 2016 at 18:14, Scott Klarenbach

Monads and Middleware

2016-07-01 Thread Scott Klarenbach
I'm looking for some insight into the relationship between Monads and Middleware. It seems to me that middleware (ala Ring, Boot) is really just a subset of Monads, where bind and lift are globally agreed upon conventions, rather than explicitly defined. For example, with middleware you

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2016-03-10 Thread Dragan Djuric
ry, more or less a direct port of Haskell's. > As > > Clojure is different, there are different ways to approach monads from > > neither of which can be the same as Haskell's, each having its pros and > > cons, so there are many libraries. Additional motivation in

[ANN] monads 0.2.2

2014-07-16 Thread Ben Wolfson
After a surprisingly long time I'm releasing a new version of my monads library, focussed on expressivity and correctness: https://github.com/bwo/monads Leiningen: [bwo/monads "0.2.2"] Improvements from 0.1.0 include: - change from maps to protocols for monad implementat

Re: monads not working in Clojure 1.4.0

2013-11-11 Thread Gary Zhao
4910--auto-- (monads.clj:11) >> > It means you have some code compiled against 1.5.1 in monads, one of the > other libraries or your own code. > > Run lein clean and try again. > -- > MK > > http://github.com/michaelklishin > http://twitter.com/michaelklishin >

Re: monads not working in Clojure 1.4.0

2013-11-09 Thread Michael Klishin
2013/11/9 Gary Zhao > NoSuchMethodError > clojure.lang.RT.mapUniqueKeys([Ljava/lang/Object;)Lclojure/lang/IPersistentMap; > clojure.algo.monads/loading--4910--auto-- (monads.clj:11) > It means you have some code compiled against 1.5.1 in monads, one of the other libraries or your ow

monads not working in Clojure 1.4.0

2013-11-09 Thread Gary Zhao
Hello I saw the following error when using monads in Clojure 1.4.0, however it worked fine in Clojure 1.5.1. Isn't monads compatible with 1.4.0? [org.clojure/clojure "1.4.0"] [org.clojure/algo.monads "0.1.4"] NoSuchMethodError clojure.lang.RT.mapUniqueKeys([Ljava/l

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-22 Thread Phillip Lord
Clojure monad library, more or less a direct port of Haskell's. As > Clojure is different, there are different ways to approach monads from > neither of which can be the same as Haskell's, each having its pros and > cons, so there are many libraries. Additional motivation in my cas

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-16 Thread Dragan Djuric
. On Wednesday, July 3, 2013 9:31:58 PM UTC+2, Ben wrote: > > On Wed, Jul 3, 2013 at 7:49 AM, Dragan Djuric > > wrote: > >> Monads as a Haskell construct is what the previously mentioned laws >> describe. Monads in category theory are defined in a category X as a triple

[ANN] Fluokitten 0.3.0 - Monads and more - now features

2013-07-16 Thread Dragan Djuric
Fluokitten - Category Theory in Idiomatic Clojure has just been upgraded to 0.3.0 Get started guide: http://fluokitten.uncomplicate.org/articles/getting_started.html The library is in the clojars, so lein will pick it up easily. There are lot of new features: - mdo macro as a syntactic suga

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-05 Thread Dragan Djuric
Thanks for the tip, Michael. I added a notification on every page, for the TL;DR crowd, so I hope that will catch the attention of enough people and improve the future readability of the docs. On Wednesday, July 3, 2013 2:34:33 PM UTC+2, Michael Klishin wrote: > > 2013/7/3 Dragan Djuric > > >> T

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Ben Wolfson
On Wed, Jul 3, 2013 at 7:49 AM, Dragan Djuric wrote: > Monads as a Haskell construct is what the previously mentioned laws > describe. Monads in category theory are defined in a category X as a triple > (T, n, m) where T is a functor and m and n certan natural transformations > such

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Dragan Djuric
matter of being in Haskell or not, it's a matter of accurately > implementing the concepts you claim to be implementing. > I do not want to be a nitpick, but category theory does not define monads (and functors and everything else) through types, but through categories. Categories

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Ben Wolfson
On Wed, Jul 3, 2013 at 10:31 AM, Dragan Djuric wrote: > Yes, I agree completely, when we stay inside Haskell. However, Clojure is > dynamic. Here are two objects that are equal despite having different types: > If you're going to talk about "category theory concepts", then that's the constraint

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Dragan Djuric
y 3, 2013 6:20:08 PM UTC+2, Nils Bertschinger wrote: > > Hi, > > Am Mittwoch, 3. Juli 2013 16:49:43 UTC+2 schrieb Dragan Djuric: >> >> Monads as a Haskell construct is what the previously mentioned laws >> describe. Monads in category theory are defined in a category

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Nils Bertschinger
Hi, Am Mittwoch, 3. Juli 2013 16:49:43 UTC+2 schrieb Dragan Djuric: > > Monads as a Haskell construct is what the previously mentioned laws > describe. Monads in category theory are defined in a category X as a triple > (T, n, m) where T is a functor and m and n certan natural tra

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Dragan Djuric
If Clojure has all of the Haskell's type features, I guess there would be only one Clojure monad library, more or less a direct port of Haskell's. As Clojure is different, there are different ways to approach monads from neither of which can be the same as Haskell's, each havi

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Phillip Lord
I've never really used monads or monoids, but one thing that does confuse me is how come there are so may libraries for supporting them. I've been reading the documentation of morph (https://github.com/blancas/morph) recently, which is the first one I've understood. A quick loo

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Dragan Djuric
Monads as a Haskell construct is what the previously mentioned laws describe. Monads in category theory are defined in a category X as a triple (T, n, m) where T is a functor and m and n certan natural transformations such that certan diagrams commute. In that sense, I am not sure that even

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Ben Wolfson
tay within the same monad, > because the types the laws give to >>= and return *require* that. > Addendum, if you're going to say that the various monad laws don't apply because the types differ, then you are, whether you like it or not, not talking about monads; monads are what the

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Ben Wolfson
t to use until >> you actually want to use it: >> > > Unless you need to use two or more different monads in that function, in > which case I don't see now would you do that at all. And, you have to > structure the code a bit awkwardly for clojure, and have to say > specifi

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Michael Klishin
2013/7/3 Dragan Djuric > The site source is in the gh-pages branch in the main source repository on > github: https://github.com/uncomplicate/fluokitten/tree/gh-pages > It's worth mentioning somewhere. ClojureWerkz projects link to doc source at the top of every guide, adding a README link is fi

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Dragan Djuric
ject goals is to make monads (et al) approachable for >> beginners, and for that, docs and tutorials are the main thing. So, this >> library really does not make much sense without lots of documentation. I >> hope to even improve it on that point. > > > Dragan, > >

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Michael Klishin
2013/7/3 Dragan Djuric > one of the main project goals is to make monads (et al) approachable for > beginners, and for that, docs and tutorials are the main thing. So, this > library really does not make much sense without lots of documentation. I > hope to even improve it o

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Ambrose Bonnaire-Sergeant
on an accurate and extensible type for conj type right now. The code looks very pure and accommodating for type checking. > > >> And enough documentation to satisfy Michael Klishin? I'm impressed :) >> >> > Thanks :) Actually, one of the main project goals is to m

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Dragan Djuric
x27;t had time to look at core.typed (I only skimmed through the homepage when it was released). > And enough documentation to satisfy Michael Klishin? I'm impressed :) > > Thanks :) Actually, one of the main project goals is to make monads (et al) approachable for beginners, and fo

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Ambrose Bonnaire-Sergeant
first public release of new (and different) > "monads and friends" library for Clojure. > Extensive *documentation* is at http://fluokitten.uncomplicate.org > > Fluokitten is a Clojure library that implements category theory concepts, > such as functors, applicative funct

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Dragan Djuric
urn= m >>> m >>= (\x -> k x >>= h) = (m >>= k) >>= h >>> >>> It seems to me the laws are still satisfied if you keep changing monads >>> in each bind (if compiler is not restricting it, as is the case with >>> Haskell b

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-03 Thread Dragan Djuric
ight be a >> preferred way, but in my opinion for most cases that I care about I prefer >> it the other way. > > > No, you don't. You don't have to specify the monad you want to use until > you actually want to use it: > Unless you need to use two or more differe

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Ben Wolfson
> way)? Here are the laws, in Haskell: >> >> return a >>= k = k a >> m >>= return= m >> m >>= (\x -> k x >>= h) = (m >>= k) >>= h >> >> It seems to me the laws are still satisfied if you keep changing mon

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Ben Wolfson
> Regarding monadic laws, which one exactly demands that you cannot change > the monad (not counting the fact that haskell's implementation does it that > way)? Here are the laws, in Haskell: > > return a >>= k = k a > m >>= return = m > m >>= (\

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Dragan Djuric
that you cannot change the monad (not counting the fact that haskell's implementation does it that way)? Here are the laws, in Haskell: return a >>= k = k a m >>= return= m m >>= (\x -> k x >>= h) = (m >>= k) >>= h It seems to me the laws are st

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Ben Wolfson
fferent approach to how the results are executed. (This is with this lib: https://github.com/bwo/monads) On Tue, Jul 2, 2013 at 4:03 PM, Dragan Djuric wrote: > pure function, defined in applicative, is equivalent to return (In > Haskell, in Fluokitten there is only pure). > > I

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Dragan Djuric
t;>>>>(mdo env <- ask >>>>> v <- (lift (f env)) >>>>> (return (println "here I am")) >>>>> (return v))) >>>>> #'monads.core/tst-read

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Dragan Djuric
;>> #'monads.core/tst-reader >>>> monads.core> (require '[monads.reader :as r] '[monads.identity :as i] >>>> '[monads.state :as st] '[monads.error :as e]) >>>> nil >>>> monads.core> (r/run-reader-t (r/t i/m) (tst-r

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Ben Wolfson
[monads.identity :as i] >>> '[monads.state :as st] '[monads.error :as e]) >>> nil >>> monads.core> (r/run-reader-t (r/t i/m) (tst-reader (comp return inc)) 5) >>> here I am >>> 6 >>> monads.core> (r/run-reader-t (r/t e/m) (tst-reader (f

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Ben Wolfson
# >> monads.core> (st/run-state (r/run-reader-t (r/t st/m) (tst-reader (fn >> [env] (>> (modify #(assoc % :env env)) (return (dec env) 5) {}) >> here I am >> # >> monads.core> >> >> ? >> >> >> On Tue, Jul 2, 2013 at 11:0

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Dragan Djuric
> # > monads.core> > > ? > > > On Tue, Jul 2, 2013 at 11:07 AM, Dragan Djuric > > wrote: > >> I am pleased to announce a first public release of new (and different) >> "monads and friends" library for Clojure. >> Extensive *documentat

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Ben Wolfson
(modify #(assoc % :env env)) (return (dec env) 5) {}) here I am # monads.core> ? On Tue, Jul 2, 2013 at 11:07 AM, Dragan Djuric wrote: > I am pleased to announce a first public release of new (and different) > "monads and friends" library for Clojure. > Extensive *doc

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Michael Klishin
2013/7/2 Dragan Djuric > I am pleased to announce a first public release of new (and different) > "monads and friends" library for Clojure. > Extensive *documentation* is at http://fluokitten.uncomplicate.org > Good job, Dragan! -- MK http://github.com/michaelklis

[ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-02 Thread Dragan Djuric
I am pleased to announce a first public release of new (and different) "monads and friends" library for Clojure. Extensive *documentation* is at http://fluokitten.uncomplicate.org Fluokitten is a Clojure library that implements category theory concepts, such as functors, applicativ

Re: -> operator and monads

2013-04-17 Thread Matthew Hill
Yes, I said that it's *like *function composition in reverse order. And only if you apply the function returned by comp, as I did in my example. It's not to be taken too literally, but it is perhaps helpful for people coming from language that have function composition but no analogue to ->. On

ANN: Morph 0.3.0, monads+functors lib gets perf boost

2013-04-16 Thread Armando Blancas
In this release the lib gets rid of reflective calls by adding type hints. https://github.com/blancas/morph I don't have any benchmarks, but in Ben's tree-numbering Morph's timing goes from ~13,700 msecs down to ~350. https://github.com/bwo/monads/wiki/Tree-numbering-benchmark M

Re: -> operator and monads

2013-04-14 Thread Ben Wolfson
On Sun, Apr 14, 2013 at 1:03 PM, Marko Topolnik wrote: > On Sunday, April 14, 2013 7:51:10 PM UTC+2, Matthew Hill wrote: > >> Function composition is done via comp. Using -> and ->> is like function >> composition in reverse order (though there's a difference between how the >> two thread return v

Re: -> operator and monads

2013-04-14 Thread Marko Topolnik
On Sunday, April 14, 2013 7:51:10 PM UTC+2, Matthew Hill wrote: > Function composition is done via comp. Using -> and ->> is like function > composition in reverse order (though there's a difference between how the > two thread return values), and often it reads more naturally. -> applies the

Re: -> operator and monads

2013-04-14 Thread Matthew Hill
Function composition is done via comp. Using -> and ->> is like function composition in reverse order (though there's a difference between how the two thread return values), and often it reads more naturally. user> (-> [1 2 5] rest first) 2 user> ((comp first rest) [1 2 5]) 2 On Wednesday, 3 Ap

Re: Monads usage

2013-04-08 Thread Armando Blancas
)) To translate expressions in a sequence it uses the generic function (seqm); function (run-se) evaluates the resulting sequenced monads using an initial state "predefs". The result from (run-se) feeds (either) which evaluates to the first form on ->left and to the second on ->ri

Re: Monads usage

2013-04-08 Thread Ben Wolfson
I don't know if this is adequately "in the wild" (since it's part of a monad lib itself), but part of my monads library uses a continuation monad to let two mutually recursive functions traverse and rebuild a tree structure without blowing the stack. It would be a pain to do t

Re: Monads usage

2013-04-08 Thread Timothy Baldridge
oops, gen-plan was missing a helper function: (defn- with-bind [id expr psym body] `(fn [~psym] (let [[~id ~psym] ( ~expr ~psym)] (assert ~psym "Nil plan") ~body))) On Mon, Apr 8, 2013 at 9:32 AM, Timothy Baldridge wrote: > I have a love/hate relationship w

Re: Monads usage

2013-04-08 Thread Timothy Baldridge
I have a love/hate relationship with monads. I think their use in Clojure programming is much more limited than most would like to admit. However, I have found a very nice use for them: in my case, I'm attempting to insert a very complex AST into Datomic. I'd like all my data to go in

Monads usage

2013-04-08 Thread Carlos Galdino
Hi, I've been reading about monads for the past couple of weeks and I think I got the idea, but I still don't know when to use it since I don't have enough experience with functional programming. So, I'd like to ask you guys if you can point me to some examples of Monads

ANN: monads 0.1.0, YA monads lib for clojure

2013-04-04 Thread Ben Wolfson
After much tinkering I am announcing a new monads implementation: https://github.com/bwo/monads Rather than using protocols or symbol macros as (I believe) all hitherto existing monad libraries for Clojure have, this implementation has the elements of a monadic computation build up a structure

Re: -> operator and monads

2013-04-04 Thread Marko Topolnik
Isn't the dot just like Clojure's *comp*? As Allan correctly points out, the thrushes are macros that combine the given forms in a specified way, which only under certain constraints has the effect of composing function applications, whereas *comp* is truly a function composition operator. On T

Re: -> operator and monads

2013-04-04 Thread Maik Schünemann
if you come from the haskell world, it is like . piplining - but in reverse order I needed some time to get used to it but I really like -> ->> as-> ... to structure my code. It helps to see the sequence of functions that operate on your data On Wed, Apr 3, 2013 at 11:05 PM, Alan Malloy wrote:

Re: -> operator and monads

2013-04-03 Thread Alan Malloy
Not even that: -> is not a function composition operator at all, but a form-rewriting macro. You can perfectly well write (-> [x xs] (for (inc x))) to get (for [x xs] (inc x)), and that is not composing any functions. The two things are entirely separate. On Wednesday, April 3, 2013 12:45:55 PM

Re: -> operator and monads

2013-04-03 Thread Plínio Balduino
Now it's clear. Thank you Plínio On Wed, Apr 3, 2013 at 4:45 PM, Marko Topolnik wrote: > I guess you mean the monadic bind operation, but -> is not it. The only > conceptual connection between *bind* and -> is that they are both some > kind of function composition operators. > > -marko > > > O

Re: -> operator and monads

2013-04-03 Thread Marko Topolnik
I guess you mean the monadic bind operation, but -> is not it. The only conceptual connection between *bind* and -> is that they are both some kind of function composition operators. -marko On Wednesday, April 3, 2013 8:21:43 PM UTC+2, Plinio Balduino wrote: > > Hi there > > Is it correct to sa

-> operator and monads

2013-04-03 Thread Plínio Balduino
Hi there Is it correct to say that -> operator is a kind of monad in Clojure? Thank you in advance. Plínio Balduino -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts fr

Re: [ANN] Morph v0.1.0 Monads & friends: pure functions, less boilerplate

2013-02-07 Thread Armando Blancas
Yeap, I've had looked at Jim Duey's projects and had read his articles at his website; it's good content. On Thursday, February 7, 2013 1:48:12 AM UTC-8, Marek Srank wrote: > > btw, have you seen https://github.com/jduey/protocol-monads ? > > Marek > > On Thur

Re: [ANN] Morph v0.1.0 Monads & friends: pure functions, less boilerplate

2013-02-07 Thread Marek Šrank
btw, have you seen https://github.com/jduey/protocol-monads ? Marek On Thursday, February 7, 2013 1:06:39 AM UTC+1, Armando Blancas wrote: > > Morph is a new implementation of monads based on protocols. It's intended > to provide the common patterns of error-handling, short-circ

Re: [ANN] Morph v0.1.0 Monads & friends: pure functions, less boilerplate

2013-02-06 Thread Armando Blancas
have one in babbage, and > it has two more methods than yours, "mempty?" and "value" (instead of > monoid-specific accessors). Why not put the accessors in the protocol? > > On Wed, Feb 6, 2013 at 4:06 PM, Armando Blancas > > > wrote: > > Morph is a new

Re: [ANN] Morph v0.1.0 Monads & friends: pure functions, less boilerplate

2013-02-06 Thread Ben Wolfson
ccessors in the protocol? On Wed, Feb 6, 2013 at 4:06 PM, Armando Blancas wrote: > Morph is a new implementation of monads based on protocols. It's intended to > provide the common patterns of error-handling, short-circuit sequencing, and > modeling of stateful computations in pure f

Re: [ANN] Morph v0.1.0 Monads & friends: pure functions, less boilerplate

2013-02-06 Thread Ben Wolfson
ccessors in the protocol? On Wed, Feb 6, 2013 at 4:06 PM, Armando Blancas wrote: > Morph is a new implementation of monads based on protocols. It's intended to > provide the common patterns of error-handling, short-circuit sequencing, and > modeling of stateful computations in pure f

[ANN] Morph v0.1.0 Monads & friends: pure functions, less boilerplate

2013-02-06 Thread Armando Blancas
Morph is a new implementation of monads based on protocols. It's intended to provide the common patterns of error-handling, short-circuit sequencing, and modeling of stateful computations in pure functions. I've tried to make this library idiomatic while keeping it close to its Has

Re: monads

2012-10-30 Thread nicolas.o...@gmail.com
In a few lines: Monads are a common framework to represent any sequential computation. What is a sequential computation? - either no computation at all. return :: a -> m a does that. - or I have already a computation and want to go on with my computation. But then, I need to be able

Re: monads

2012-10-29 Thread Michael Bradley, Jr.
On Friday, October 26, 2012 11:06:59 AM UTC-5, Brian Craft wrote: > I've read about four tutorials on monads so far, but it still escapes me. > > In fact, I'm still not sure what problem it solves. I'm familiar with the > problem of having, say, three functions lik

Re: monads

2012-10-27 Thread Armando Blancas
I found these articles very valuable in understanding the original motivation for monads and their use for practical development. Imperative Functional Programming Simon Peyton Jones, Philip Wadler http://research.microsoft.com/pubs/67066/imperative.ps.z Monadic Parser Combinators Graham Hutton

Re: monads

2012-10-27 Thread Stephen Compall
On Fri, 2012-10-26 at 21:55 -0700, Ben Wolfson wrote: > f :: a -> b > g :: c -> d > h :: e -> j [renamed from "f"] > > and "you'd like to chain [them] like f(g(h(x))), but you can't because > b is a different type from c and d is a different type from e.", how > does m-chain help? > > I would hav

Re: monads

2012-10-26 Thread Ben Wolfson
On Fri, Oct 26, 2012 at 8:39 PM, Stephen Compall wrote: > On Fri, 2012-10-26 at 09:06 -0700, Brian Craft wrote: >> First, do monads provide a generic solution, so I can apply >> f(g(h(x)))? > > Yes. control.algo.monads provides it as m-chain. Can you expand on this? If the

Re: monads

2012-10-26 Thread Stephen Compall
On Fri, 2012-10-26 at 09:06 -0700, Brian Craft wrote: > First, do monads provide a generic solution, so I can apply > f(g(h(x)))? Yes. control.algo.monads provides it as m-chain. The closest equivalent to m-chain in Haskell is (foldl' (>=>) return), but in most situations

Re: monads

2012-10-26 Thread Brian Marick
On Oct 26, 2012, at 11:06 AM, Brian Craft wrote: > I've read about four tutorials on monads so far, but it still escapes me. > > In fact, I'm still not sure what problem it solves. Monads are hard to understand, and I too found I wasn't the target audience for th

Re: monads

2012-10-26 Thread Andy Fingerhut
I can't say I grok monads completely yet, but was one of the tutorials you read this one? http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html I like the style of showing how they solve problems that arise naturally in the context of purely functional programming,

monads

2012-10-26 Thread Brian Craft
I've read about four tutorials on monads so far, but it still escapes me. In fact, I'm still not sure what problem it solves. I'm familiar with the problem of having, say, three functions like f(a) -> b, g(c) -> d, h(e) -> f, which you'd like to chain like f(g(h(x))

Transients, pods, and monads

2012-03-10 Thread Konrad Hinsen
I finally found the time to watch the video recording of Rich's keynote at Clojure/conj. Lots of interesting stuff, as usual... When he started talking about transients and pods, I saw the term "state monad" flashing in the background. I suppose most people don't see, which is why I am writing thi

Re: what stack traces include / exclude regarding monads

2012-02-15 Thread jim
> method calls and are thus not part of the stack trace. But if I'm mistaken > or if anyone has figured out how to use monads and still get detailed stack > traces, please do let me know. -- You received this message because you are subscribed to the Google Groups "Clojure&qu

Re: what stack traces include / exclude regarding monads

2012-02-14 Thread Andrew
I guess the use of domonads leaves behind do statements with m_bind's and m_result's... and since these expressions are not fn's, they don't count as method calls and are thus not part of the stack trace. But if I'm mistaken or if anyone has figured out how to use mona

Re: what stack traces include / exclude regarding monads

2012-02-13 Thread Andrew
Here's the code if the list in the original post was too cryptic. None of the items beginning with "cc" show up in the stack trace by name -- m_bind shows up instead. (defn ee [] (show-stack)) (def dd (fn [s] [ (show-stack) s])) (def cc2 (with-monad sim-m (domonad [_# dd]

what stack traces include / exclude regarding monads

2012-02-13 Thread Andrew
I've been experimenting with a state monad. Below is a list of what is included in my stack trace [+] and what isn't [-]. I've noticed that a call to a symbol that is bound to the result of a domonad (not sure if that's the right way to describe it) doesn't end up in my stack trace. I was plann

Re: Do you use Monads in your real clojure applications

2012-01-04 Thread Dragan R
Thank you for your great answer Konrad. On Jan 3, 9:46 am, googlegro...@khinsen.fastmail.net wrote: > Dragan R writes: > >  > On the net I read that "Impure functional programming doesn't really >  > need monads." >  > and "It appears that in

Re: Do you use Monads in your real clojure applications

2012-01-04 Thread Dragan R
Thanks to all authors for help. Best regards, Dragan Radevic -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your fi

Re: Do you use Monads in your real clojure applications

2012-01-04 Thread Meikel Brandmeyer
Hi, Am 04.01.2012 um 10:12 schrieb Thorsten Wilms: >> (defn handler [{:keys [params] :as req}] >> (if (person/valid? params) >> {:status 200 :body (json/generate-string (person/create params))} >> {:status 400})) Or you let the create function return nil on invalid params. (defn handl

Re: Do you use Monads in your real clojure applications

2012-01-04 Thread Thorsten Wilms
this might be suited to monads, which I don't fully understand. If you work with self-imposed restrictions that make you call functions with the same parameters twice in short order, you should reconsider those restrictions. If all the information you need from a validator is true/false

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread Takahiro Hozumi
twice in the validate function and the create function. Ring handler example (defn handler [{:keys [params] :as req}] (if (person/valid? params) {:status 200 :body (json/generate-string (person/create params))} {:status 400})) I think this might be suited to monads, which I don't

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread Mark Engelberg
Some of the most common uses for monads have pre-existing mechanisms with Clojure to handle them, e.g.: sequence monad (for) state monad (Clojure has many stateful mechansisms) maybe monad (Clojure programmers usually just return nil for failure, and use something like when-let to process it) In

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread jim
On Jan 3, 2:46 am, googlegro...@khinsen.fastmail.net wrote: > I probably use monad more than the average programme in my own code, > but that's also because I happen to be familiar with them. I could > very well live with fewer monads in my code. But once you know monads, > they

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread Lee Hinman
We use monads within one of our work project, but not to any large amount. It mostly boils down to using the Maybe monad to avoid giant nested if- lets. - Lee Hinman -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread Philip Potter
On 3 January 2012 08:46, wrote: > Dragan R writes: > >  > On the net I read that "Impure functional programming doesn't really >  > need monads." >  > and "It appears that in the presence of mutable state, a lot of the >  > advantages of

Re: Do you use Monads in your real clojure applications

2012-01-03 Thread Meikel Brandmeyer
Hi, I used monads in two projects. * The last rewrite of ClojureQL before v1.0 used a state monad to keep track of various things during query creation. * ClojureCheck also uses a monad approach to create and combine generators for test data. * Dave Ray and I tried a monad style in the async

Do you use Monads in your real clojure applications

2012-01-03 Thread googlegroups
Dragan R writes: > On the net I read that "Impure functional programming doesn't really > need monads." > and "It appears that in the presence of mutable state, a lot of the > advantages of monads become moot." Monads are an abstraction mechanism, so yo

Re: Do you use Monads in your real clojure applications

2012-01-02 Thread Alex Baranosky
Midje has some of its error handling code implemented with a monad. https://github.com/marick/Midje/blob/master/src/midje/error_handling/monadic.clj#L32 `error-let` is like a regular let, except if there is a validation-error, that error short-circuits out. Alex -- You received this message bec

Re: Do you use Monads in your real clojure applications

2012-01-02 Thread Stephen Compall
On Mon, 2012-01-02 at 05:18 -0800, Dragan R wrote: > and are monads realy useful in impure functional languages like > clojure? Clojure's impurity doesn't mean that we wouldn't like to avoid side-effecty ways of doing stuff. Monads can help you there, among other things. Th

Do you use Monads in your real clojure applications

2012-01-02 Thread Dragan R
Hello, I would like to know do you use Monads in your real clojure applications, and are monads realy useful in impure functional languages like clojure? On the net I read that "Impure functional programming doesn't really need monads." and "It appears that in the presence

Re: Errors w/ dynamic symbols in macro-utils or monads?

2011-12-02 Thread Andrew
ah: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go clojure.contrib.monads - Migrated to clojure.algo.monads - lead Konrad Hinsen . - Status: latest build status

Re: Errors w/ dynamic symbols in macro-utils or monads?

2011-12-02 Thread Andrew
Does this still happen for you? It appears to still be the case in my environment. Dropping back to Clojure *1.2.1* seems to work but in addition to trying out monads, I need to use a library (clj-webdriver) that relies on Clojure *1.3.0* What to do? -- You received this message because

Re: monads > macros

2011-07-13 Thread Ken Wesson
On Wed, Jul 13, 2011 at 1:37 PM, Raoul Duke wrote: > On Wed, Jul 13, 2011 at 5:20 AM, Ken Wesson wrote: >> Oh, I'm not saying my own is exploding -- just that macros can be >> tough for some people to get their heads around, and monads even more >> so, so combining

Re: monads > macros

2011-07-13 Thread Raoul Duke
On Wed, Jul 13, 2011 at 5:20 AM, Ken Wesson wrote: > Oh, I'm not saying my own is exploding -- just that macros can be > tough for some people to get their heads around, and monads even more > so, so combining the two ... maybe call them something else and it won't be so bad.

Re: monads > macros

2011-07-13 Thread Ken Wesson
gt;>> for >>> the continuation monad, so perhaps monads may be of use in implementing >>> complex macros. >> >> That popcorn-popping sound you hear is heads exploding out there in >> the audience. > > Maybe this article will help understand what I was r

Re: monads > macros

2011-07-13 Thread Konrad Hinsen
On 13 Jul 2011, at 05:04, Ken Wesson wrote: One approach that has been proposed to improve composability of macros is to adopt a continuation-passing style. This would make macros a candidate for the continuation monad, so perhaps monads may be of use in implementing complex macros

Re: monads > macros

2011-07-13 Thread Konrad Hinsen
On 12 Jul 2011, at 23:18, Alan Malloy wrote: On Jul 12, 12:01 pm, Konrad Hinsen wrote: The composability issue with macros lies in writing them, not using them. Strongly disagree. Macros compose reasonably well when writing them (eg, using let in the implementation of with-open is trivial);

Re: monads > macros

2011-07-12 Thread Ken Wesson
On Tue, Jul 12, 2011 at 3:01 PM, Konrad Hinsen wrote: > On 12 Jul 2011, at 15:40, James Keats wrote: > >> My humble understanding is that macros complicate composability, >> whereas monads facilitate it. > > The composability issue with macros lies in writing them, not

  1   2   3   >