These are chat archives for ramda/ramda

28th
Jan 2017
James Forbes
@JAForbes
Jan 28 2017 00:02

no worries :) Have you heard of the interpreter pattern? I loosely follow that more and more. Before that I was attaching IO to an object called env and passing that env object around. When it came to testing I'd replace the env object. Sometimes I do a mix of the two.

But the interpreter pattern is really incredible and going forward that's all I ever want to use.

I also tend to write everything as a transformation from a -> b, whether its UI or server side stuff. And I write and test individual slices of that transformation as separate programs. I keep almost all of that process pure, so each slice of that transformation is just generating descriptions of something stateful that I want to eventually occur.

So nothing fancy or mind blowing there.

Rick Medina
@rickmed
Jan 28 2017 02:30
interpreter pattern as in free monad?
@JAForbes
Matt McKellar-Spence
@MattMS
Jan 28 2017 03:11
@JAForbes could you provide a link/example of the interpreter pattern? I'm also curious :smile:
Stefan Rimaila
@stuf
Jan 28 2017 09:57

Hum, probably a bit offtopic, but.. I've noticed that for some things, I'm have this growing phobia, if you will, to writing some function bodies into curly braces just because I need to assign something into a variable. Something that I've gotten used to in Purescript/Haskell with it's let .. in/where pattern, which for a couple of simple things, I'm currently solving with default argument assignment;

const fn = ({ state, something = U.view('something', state) }) =>
  /* function body */

Which is also something that partly encourages me to write clean and somewhat simple functions. This doesn't apply to all functions, but usually for a lot of public-facing stuff it's something that's "nice to have". Anybody else working with something like this?

Matt McKellar-Spence
@MattMS
Jan 28 2017 11:55
The computations in default arguments feels weird to me, probably because I come from Python where the defaults are calculated when the function is defined. I've ended up going back to traditional function definitions if I need to do anything in the body.
Stefan Rimaila
@stuf
Jan 28 2017 11:59
yeah. usually I create views like that outside of the function, since they're partially applied. it's just a bit of something that has started to bug me in a way of sorts after doing some stuff in Elm for instance. not a big deal but
Matt McKellar-Spence
@MattMS
Jan 28 2017 12:01
Yeah, I know what you mean though, and it does seem like a pretty nice solution to it. I'll probably steal it after I get over my default arguments phobia :P
Stefan Rimaila
@stuf
Jan 28 2017 12:02
haha, understandable also if you're from python, due to the difference
another option would be to write purs/elm, but OTOH that'd be another matter :P
Rick Medina
@rickmed
Jan 28 2017 18:08
@Bradcomp hey man you mentioned you used jsdoc for the ide help, which ide do you use? I haven't had luck with vscode
Brad Compton (he/him)
@Bradcomp
Jan 28 2017 18:26
We use webstorm