ldnclj

Find us on #clojure-uk
thomas 2016-02-29T08:49:25.000220Z

morning

2016-02-29T09:00:31.000221Z

moinmoin

mccraigmccraig 2016-02-29T09:39:54.000222Z

moarnin

bahulneel 2016-02-29T11:03:44.000223Z

hi guys, when is the next meetup?

2016-02-29T11:07:03.000224Z

bahulneel: schedule is here: http://www.londonclojurians.org/

malcolmsparks 2016-02-29T11:07:14.000225Z

http://www.londonclojurians.org/

bahulneel 2016-02-29T11:08:04.000227Z

Thx, I looked at that but couldn't then find the corresponding event on skills matter for tomorrow, so was unsure.

2016-02-29T11:36:25.000228Z

bahulneel: I've deleted that event. We didn't really get things together in time (life intervened for a number of the organisers incl me)

mccraigmccraig 2016-02-29T12:09:38.000229Z

i'm looking to replace pallet as my infrastructure automation tool... any recommendations anyone ? i need to manager clusters of cloud servers with various roles and services, and i much prefer git-based config to a config server

2016-02-29T13:00:35.000230Z

mccraigmccraig: wow, if even you are leaving pallet...

2016-02-29T13:01:16.000231Z

mccraigmccraig: not sure what you think of the thing that elise_huard and thattommyhall are working on here: https://github.com/MastodonC/terraboot

mccraigmccraig 2016-02-29T13:14:40.000233Z

@otfrom: final-straw - pallet is way behind on the AWS client libs https://github.com/pallet/awaze

mccraigmccraig 2016-02-29T13:14:56.000235Z

how have you found terraform @otfrom ?

2016-02-29T13:16:56.000236Z

elise_huard and thattommyhall love it

2016-02-29T13:18:26.000237Z

it is a pity they didn't go w/amazonica then https://github.com/mcohen01/amazonica

mccraigmccraig 2016-02-29T13:20:20.000239Z

oh, they did, but they forked it, and the fork is some way behind and there were sufficient AWS api changes that it's not an easy upgrade

2016-02-29T13:28:48.000240Z

πŸ˜•

2016-02-29T13:29:02.000241Z

so, a pity they didn't stay with amazonica

mccraigmccraig 2016-02-29T13:29:11.000242Z

hmm - if i like terraform, terraboot looks like something i could use/fork @otfrom - afaics it's setting up a mesos cluster, which is most of what i want... starting from scratch might even encourage me to move my c* onto mesos at last

thattommyhall 2016-02-29T13:52:25.000243Z

Hey @mccraigmccraig, terraform is good but I found it lacks abstraction. Adding a DSL to generate their JSON format has worked well for me in Ruby and now here in Clj too

thattommyhall 2016-02-29T13:53:03.000244Z

I didnt realise the project was public already, will probs share the more reusable stuff somewhere else

mccraigmccraig 2016-02-29T13:54:18.000245Z

by "lacks abstraction" dyu mean stuff like the ability to define concepts like groups and roles for resources and associated behaviours @thattommyhall ?

thattommyhall 2016-02-29T13:55:08.000246Z

want to do the same thing in N regions/AZs, do some conditional logic

mccraigmccraig 2016-02-29T13:57:11.000247Z

cool - DSL sounds like a good approach too - if the underlying behaviours are simple, then you get to introspect why your cluster is messed up from the generated JSON :simple_smile:

2016-02-29T13:57:59.000248Z

thattommyhall: I think the repo started off as public. I do realise it is too early for other people than us to even think about using it yet though

2016-02-29T13:58:09.000249Z

so, caveat forker mccraigmccraig πŸ˜‰

thattommyhall 2016-02-29T13:58:12.000250Z

https://www.terraform.io/docs/configuration/syntax.html is where it mentions the JSON format

2016-02-29T13:58:42.000252Z

thattommyhall: mccraigmccraig is also using c*, kafka, mesos, es, spark, hadoop et al

2016-02-29T13:58:49.000253Z

and he has a better beard than I do

2016-02-29T13:58:52.000254Z

πŸ˜•

2016-02-29T13:58:58.000255Z

🐻

thattommyhall 2016-02-29T13:59:08.000256Z

https://www.terraform.io/docs/configuration/interpolation.html is were they list a few built-in functions etc (but no way to define your own afaikt)

thattommyhall 2016-02-29T13:59:39.000258Z

and the index stuff is just annoying

mccraigmccraig 2016-02-29T14:00:34.000259Z

@otfrom: semper caveat forker

thattommyhall 2016-02-29T14:00:54.000260Z

I hope they resist nonsense like http://docs.ansible.com/ansible/playbooks_loops.html

2016-02-29T14:02:52.000261Z

thattommyhall: I was wondering when you were going to post that. πŸ˜‰

2016-02-29T14:03:08.000262Z

do you have a yasnippet or macro for that set up? πŸ˜›

thattommyhall 2016-02-29T14:03:15.000263Z

haha

thattommyhall 2016-02-29T14:03:33.000264Z

mean time before slagging off Ansible

mccraigmccraig 2016-02-29T14:04:31.000265Z

argh... it's the old programming in XML zombie arising again

thattommyhall 2016-02-29T14:05:42.000266Z

thats why I like the 'feed it JSON' approach

2016-02-29T14:06:42.000267Z

mccraigmccraig: but xml is just lisp with angled brackets. You should love it. πŸ˜„

thattommyhall 2016-02-29T14:06:44.000268Z

any declaritive thing either has an escape hatch like JSON in terraform or becomes like Ansible and tries to turn a serialisation format into a proglang

mccraigmccraig 2016-02-29T14:07:33.000269Z

yep, i'm convinced by that argument. i'll take a good look at terraform

2016-02-29T14:08:02.000270Z

mccraigmccraig: always happy to have more community around an approach.

mccraigmccraig 2016-02-29T14:08:40.000271Z

@otfrom: not sure that follows - i don't love common-lisp or elisp

mccraigmccraig 2016-02-29T14:08:53.000272Z

i'm picky about my lisps

2016-02-29T14:09:14.000273Z

mccraigmccraig: what do you look for in a lisp?

2016-02-29T14:09:39.000274Z

clojure (and clojure derived) are my faves atm as I really like the seq abstraction

mccraigmccraig 2016-02-29T14:09:47.000275Z

@otfrom: basically this forward a few years - https://github.com/LuxLang/lux

mccraigmccraig 2016-02-29T14:11:07.000277Z

i'm happy in clojure atm, but i keep hankering after some static-type goodness

πŸ‘ 1
2016-02-29T14:12:49.000278Z

I'm mostly interested in good (haskell or similar) levels of static typing to see what I'm missing. Anything less that haskell seems to be not worth the effort (C++ or Java types)

mccraigmccraig 2016-02-29T14:15:14.000279Z

agree

mccraigmccraig 2016-02-29T14:19:46.000280Z

i'm currently liking the monad stuff and working with them in clojure is not as straightforward as in a lang with a decent static-type system, though still very useful

2016-02-29T14:30:17.000281Z

mccraigmccraig: so I have to admit, that I think I only kind of sort of understand the State monad (which I think earlier versions of pallet used). What applications are you using monads for and how does having static typing make those things easier?

mccraigmccraig 2016-02-29T14:34:07.000283Z

@otfrom: i make everything async and sensible with monads :simple_smile:

mccraigmccraig 2016-02-29T14:36:27.000284Z

i recently switched the UI of my app from being based around core.async for api calls to promesa - thanks to everything using the generic monadic apis it took only a couple of hours...

mccraigmccraig 2016-02-29T14:36:56.000285Z

and now i've got the awesomeness of alet aka applicative-do too - http://funcool.github.io/cats/latest/#alet

mccraigmccraig 2016-02-29T14:38:32.000286Z

the difficulty is non-obvious (at first) exceptions if you return the wrong type from your monadic functions... something that will never happen with static validation

mccraigmccraig 2016-02-29T14:50:02.000287Z

as an example, here's a function which does a c* upsert with the async api... every step is actually an async call with a callback-function, and there is composable short-circuit-error behaviour, but it reads like straightforward synchronous code https://github.com/employeerepublic/er-cassandra/blob/master/src/er_cassandra/model/upsert.clj#L150

mccraigmccraig 2016-02-29T14:52:19.000289Z

other libs implement such behaviours for themselves - https://github.com/ztellman/manifold/blob/master/docs/deferred.md#composing-with-deferreds - but there's an advantage to having a standardized interface

2016-02-29T14:58:58.000291Z

mccraigmccraig: have you seen muse? https://github.com/kachayev/muse

mccraigmccraig 2016-02-29T15:00:00.000293Z

@otfrom: or urania - https://github.com/funcool/urania :simple_smile:

2016-02-29T15:00:46.000295Z

mccraigmccraig: ah, yes: http://funcool.github.io/urania/latest/#acknowledgements

mccraigmccraig 2016-02-29T15:01:48.000296Z

i'm not yet, but i think i will soon be using urania - it should make a bunch of stuff simpler in my app

2016-02-29T15:01:56.000297Z

could you get over some of those problems (or at least the weirdness) with :pre checks in some of the functions that expect monads?

2016-02-29T15:03:55.000298Z

(I'm still trying to wrap my head around which bit of these things are the monads, as it looks like it is just passing around useful data structures and not throwing exceptions or returning nils)

2016-02-29T15:04:06.000299Z

and I do realise I'm a numpty

mccraigmccraig 2016-02-29T15:05:35.000300Z

my most common error is this - https://www.refheap.com/01d65cbc88c78c1ea7658819c

mccraigmccraig 2016-02-29T15:07:15.000301Z

which won't be caught by :pre checks unless they were in the bind impl itself (which is not unreasonable thinking about it...)

2016-02-29T15:07:47.000302Z

is a bit confused by (return ...)

mccraigmccraig 2016-02-29T15:08:52.000303Z

@otfrom: the monad is the type and its associated bind / return operations... return would be better called wrap or something

mccraigmccraig 2016-02-29T15:10:04.000305Z

the way i found to think about it is that every step in an mlet (aka do in haskell land) is supplied naked values, and returns a value with the type of the monad

2016-02-29T15:11:21.000307Z

ok, I think I'm starting to get there

mccraigmccraig 2016-02-29T15:11:40.000308Z

yep, that's the one - it wraps a naked value in the monad... e.g. if you are composing manifold Deferreds, it just returns a resolved Deferred with the value in - https://github.com/funcool/cats/blob/master/src/cats/labs/manifold.clj#L80

mccraigmccraig 2016-02-29T15:13:35.000311Z

well, it is a data-structure - plus some bind and return ops

minimal 2016-02-29T15:15:54.000314Z

:simple_smile:

mccraigmccraig 2016-02-29T15:15:59.000315Z

lol

minimal 2016-02-29T15:16:08.000316Z

wondering if an intervention was required

minimal 2016-02-29T15:16:41.000317Z

every small explanation of monads tends to drift into full tutorial-land

minimal 2016-02-29T15:16:53.000318Z

it’s inescapable

2016-02-29T15:17:03.000319Z

mccraigmccraig: ok, I think I understand a bit of what return is doing, so I just need to understand what bind is doing

2016-02-29T15:17:14.000320Z

minimal: yeah, guilty of asking too many questions again

minimal 2016-02-29T15:17:34.000321Z

don’t be guilty, it’s just inevitable hehe

mccraigmccraig 2016-02-29T15:17:37.000322Z

you are probably right... i only intended to give some examples of how they can be useful,and then fell down the rabbit-hole

mccraigmccraig 2016-02-29T15:17:58.000323Z

there's an event-horizon

2016-02-29T15:18:17.000324Z

mccraigmccraig: examples of how/where they are useful (what problem they are solving in a particular instance and how) is usually what I don't get from the monad tutorials I've read

minimal 2016-02-29T15:18:18.000325Z

I would say it’s hard to think about as a thing unless you are actually using them

πŸ‘ 1
2016-02-29T15:18:39.000326Z

and it is hard to know where to use them without a good example

mccraigmccraig 2016-02-29T15:19:15.000328Z

@otfrom: bind is taking a wrapped value, unwrapping it and feeding the naked value to a function, which returns another wrapped value

2016-02-29T15:19:32.000329Z

mccraigmccraig: thx

mccraigmccraig 2016-02-29T15:21:45.000330Z

so, using the Deferred example again, bind takes a Deferred, gets at it's resolved value (by registering a callback in this case), and passes it to a function which is expected to return another Deferred - i.e. does a step in an asynchronous computation without you needing to wire up callbacks yourself - https://github.com/funcool/cats/blob/master/src/cats/labs/manifold.clj#L80

πŸ‘ 1
mccraigmccraig 2016-02-29T15:22:33.000331Z

i'll stop now @minimal πŸ˜„

minimal 2016-02-29T15:22:59.000332Z

lol

2016-02-29T15:27:10.000333Z

ok, that's useful. I get the idea of using monads as a way of handling the failures of remote systems. Does that particular type of monad have a name? (Like State or IO or Fred?)

2016-02-29T15:27:18.000334Z

minimal: I'm a bad influence

mccraigmccraig 2016-02-29T15:28:18.000335Z

help me @minimal , now @otfrom is trying to get me to explain monad transformers !

minimal 2016-02-29T15:29:40.000336Z

hehe

2016-02-29T15:29:50.000337Z

I did warn you

2016-02-29T15:30:28.000338Z

but knowing that you just described monad transformers will help me when I come across someone else talking about them, so thank you

minimal 2016-02-29T15:30:31.000339Z

there are things like Maybe and Either for signalling things not working out as expected

mccraigmccraig 2016-02-29T15:30:53.000340Z

@otfrom: the either or exception monad can be combined with other monads for that sort of behaviour... e.g. you could combine a core.async promise-chan monad with an either monad

mccraigmccraig 2016-02-29T15:32:04.000341Z

if your type already has error-handling built in (like promises or manifold Deferreds) then you won't need to do that, and the basic monad implementation for the type will probably come with error-handling behaviour

2016-02-29T15:32:35.000342Z

as in "either you get the result or you get an error data structure"

mccraigmccraig 2016-02-29T15:32:44.000343Z

zakly

2016-02-29T15:32:46.000344Z

OK, I think I've got you there

minimal 2016-02-29T15:33:08.000345Z

and if using a type system you have to check

mccraigmccraig 2016-02-29T15:34:14.000346Z

the monad-transformer allows you to take two monadic structures, say promise-chan and either and create a new monadic structure like promise-chan<either> i.e. a promise-chan containing an either

2016-02-29T15:34:18.000347Z

minimal: b/c the expected return type is different from the error type which is why you wrap it in an either type that can handle that for you?

minimal 2016-02-29T15:35:55.000348Z

yeah, by saying that the type is and either then the type system will make sure you handle both cases. In a dynamic language not so much so it’s less useful

minimal 2016-02-29T15:36:17.000351Z

...

2016-02-29T15:36:23.000352Z

and I'd probably solve that problem in core.async using something like http://clojure.github.io/core.async/#clojure.core.async/split

2016-02-29T15:37:52.000353Z

say if I was processing msgs coming in and I was trying to coerce them using plumatic schema and then I'd either get back the type I expected as a return or and error and then I could use a predicate in split to get a chan of the good ones and a chan of the bad ones to pass to a transducer

minimal 2016-02-29T15:37:55.000354Z

Yeah i’ve done things that group by true/false after a channel

2016-02-29T15:38:25.000355Z

I think that is the type of tying into the kind of work I normally do that I've been missing around monads tbh

2016-02-29T15:40:13.000356Z

minimal and mccraigmccraig thx for talking me through that. I feel I've made a little break through. I think most of my problem has been around the terms used to describe it more than anything.

mccraigmccraig 2016-02-29T15:41:20.000358Z

yw @otfrom

2016-02-29T15:42:06.000359Z

and this also means that an earlier conversation I was having with Rich Hickey around monads and stats calcs makes more sense too

keeds 2016-02-29T16:07:00.000360Z

Thx @mccraigmccraig @minimal - useful convo to listen in on.

πŸ‘ 6
malcolmsparks 2016-02-29T18:24:58.000362Z

Me too. So engrossed I missed my bus stop

πŸ˜„ 1
2016-02-29T18:45:54.000363Z

malcolmsparks: lol

mccraigmccraig 2016-02-29T18:47:59.000364Z

@otfrom: u invented the socratic monad tutorial !

2016-02-29T18:49:32.000365Z

yeah, but Socrates usually knew the answer he was after. I was just a numpty trying to understand a small part of monads. πŸ˜‰

mccraigmccraig 2016-02-29T19:55:56.000367Z

@otfrom: looks quite nice actually - http://www.foodnetwork.com/recipes/hemlock-cocktails.html

2016-02-29T22:31:48.000369Z

@mccraigmccraig @minimal reading the Wadler paper now πŸ˜‚

minimal 2016-02-29T22:39:56.000370Z

@otfrom cool, I was going to suggest that. At leat a bit of it if you can stomach/ignore the maths notation

minimal 2016-02-29T22:40:20.000371Z

Also the terminology is slightly different for some of the function names