Fork me on GitHub
#ldnclj
<
2016-02-29
>
bahulneel11:02:44

hi guys, when is the next meetup?

bahulneel11:02:04

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

otfrom11:02:25

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)

mccraigmccraig12:02:38

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

otfrom13:02:35

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

otfrom13:02:16

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

mccraigmccraig13:02:40

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

mccraigmccraig13:02:56

how have you found terraform @otfrom ?

otfrom13:02:56

elise_huard and thattommyhall love it

otfrom13:02:26

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

mccraigmccraig13:02:20

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

otfrom13:02:02

so, a pity they didn't stay with amazonica

mccraigmccraig13:02:11

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

thattommyhall13:02:25

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

thattommyhall13:02:03

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

mccraigmccraig13:02:18

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

thattommyhall13:02:08

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

mccraigmccraig13:02:11

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

otfrom13:02:59

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

otfrom13:02:09

so, caveat forker mccraigmccraig ๐Ÿ˜‰

otfrom13:02:42

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

otfrom13:02:49

and he has a better beard than I do

otfrom13:02:58

๐Ÿป

thattommyhall13:02:08

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)

thattommyhall13:02:39

and the index stuff is just annoying

mccraigmccraig14:02:34

@otfrom: semper caveat forker

otfrom14:02:52

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

otfrom14:02:08

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

thattommyhall14:02:33

mean time before slagging off Ansible

mccraigmccraig14:02:31

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

thattommyhall14:02:42

thats why I like the 'feed it JSON' approach

otfrom14:02:42

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

thattommyhall14:02:44

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

mccraigmccraig14:02:33

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

otfrom14:02:02

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

mccraigmccraig14:02:40

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

mccraigmccraig14:02:53

i'm picky about my lisps

otfrom14:02:14

mccraigmccraig: what do you look for in a lisp?

otfrom14:02:39

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

mccraigmccraig14:02:07

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

otfrom14:02:49

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)

mccraigmccraig14:02:46

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

otfrom14:02:17

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?

mccraigmccraig14:02:07

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

mccraigmccraig14:02:27

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...

mccraigmccraig14:02:56

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

mccraigmccraig14:02:32

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

mccraigmccraig14:02:02

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

mccraigmccraig14:02:19

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

otfrom14:02:58

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

mccraigmccraig15:02:48

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

otfrom15:02:56

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

otfrom15:02:55

(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)

otfrom15:02:06

and I do realise I'm a numpty

mccraigmccraig15:02:15

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

otfrom15:02:47

is a bit confused by (return ...)

mccraigmccraig15:02:52

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

mccraigmccraig15:02:04

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

otfrom15:02:21

ok, I think I'm starting to get there

mccraigmccraig15:02:40

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

mccraigmccraig15:02:35

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

minimal15:02:08

wondering if an intervention was required

minimal15:02:41

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

minimal15:02:53

itโ€™s inescapable

otfrom15:02:03

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

otfrom15:02:14

minimal: yeah, guilty of asking too many questions again

minimal15:02:34

donโ€™t be guilty, itโ€™s just inevitable hehe

mccraigmccraig15:02:37

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

mccraigmccraig15:02:58

there's an event-horizon

otfrom15:02:17

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

minimal15:02:18

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

otfrom15:02:39

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

mccraigmccraig15:02:15

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

otfrom15:02:32

mccraigmccraig: thx

mccraigmccraig15:02:45

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

mccraigmccraig15:02:33

i'll stop now @minimal ๐Ÿ˜„

otfrom15:02:10

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?)

otfrom15:02:18

minimal: I'm a bad influence

mccraigmccraig15:02:18

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

otfrom15:02:50

I did warn you

otfrom15:02:28

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

minimal15:02:31

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

mccraigmccraig15:02:53

@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

mccraigmccraig15:02:04

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

otfrom15:02:35

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

otfrom15:02:46

OK, I think I've got you there

minimal15:02:08

and if using a type system you have to check

mccraigmccraig15:02:14

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

otfrom15:02:18

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?

minimal15:02:55

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

otfrom15:02:23

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

otfrom15:02:52

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

minimal15:02:55

Yeah iโ€™ve done things that group by true/false after a channel

otfrom15:02:25

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

otfrom15:02:13

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.

otfrom15:02:06

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

keeds16:02:00

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

malcolmsparks18:02:58

Me too. So engrossed I missed my bus stop

otfrom18:02:54

malcolmsparks: lol

mccraigmccraig18:02:59

@otfrom: u invented the socratic monad tutorial !

otfrom18:02:32

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

otfrom22:02:48

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

minimal22:02:56

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

minimal22:02:20

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