Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Philip Arndt
@parndt
awesome - zulip's great!
Piotr Solnica
@solnic
it's pretty awesome indeed, looks so-so but functionality-wise it's fantastic
Nick Sutterer
@apotonick
Cool, I will check it out
Oh wow, they address so many things I hate about Slack :grimacing:
Philip Arndt
@parndt
@apotonick exactly!
Nick Sutterer
@apotonick
Phil!!!!! :heart_eyes:
Philip Arndt
@parndt
:heart: :heart: :heart:
Christopher Swasey
@endash
Maybe I'm dumb but I can't figure out how just to say something
Christopher Swasey
@endash
bonus feature
Nikita Shilnikov
@flash-gordon
it’s not on you, find the reply button
Spencer Goh
@dymaxionuk
Hi, I'm trying out the Dry::Monads::Do notation, but I get LocalJumpError: yield called out of block. Any ideas why?
Nikita Shilnikov
@flash-gordon
Mind to share an example?
Spencer Goh
@dymaxionuk

@flash-gordon , I've figured it out! seems like a clash between the mixin Dry::Transaction::Operation as soon as I include that it breaks. That Operation mixin includes...

Dry::Matcher.for(:call, with: Dry::Matcher::ResultMatcher)

which wraps :call and clashed with the Do wrapping.

Tim Riley
@timriley
@dymaxionuk hmm, we have an integration test in dry-matcher to ensure it works with dry-monads do notation IIRC
Spencer Goh
@dymaxionuk
Hi Tim, that's suprising... cos I just typed out an example and flattened all the Dry::Transaction::Operation includes into the top level of my class
and it blew up with that ResultMatch
Tim Riley
@timriley
Hmm, could you please file an issue with your gem versions and example case?
Spencer Goh
@dymaxionuk
class MyOp
  include Dry::Monads::Result::Mixin
  include Dry::Matcher.for(:call, with: Dry::Matcher::ResultMatcher)
  include Dry::Monads::Do.for(:call)

  def call
    _should_fail_fast = yield one('hello')
    Success(:yesyesyes)
  end

  def one(param)
    Failure(:nonono)
  end
end

MyOp.new.call
Nikita Shilnikov
@flash-gordon
it can fail if you include modules in the wrong order
Spencer Goh
@dymaxionuk
I'll raise an issue, it might be some clash with the versions I'm using...
Nikita Shilnikov
@flash-gordon
first do, then matcher
this is the right way
Spencer Goh
@dymaxionuk
aah but problem is I'm extending a base class MyOperation
and so the matcher gets included first
Nikita Shilnikov
@flash-gordon
it won’t work
you may want to use included or something like this as a workaround
Spencer Goh
@dymaxionuk
it's ok I'll push up the Do wrap higher up the chain in my base class.
it migjht silently catch other ppl off guard in a similar way if they are usiung Dry::Transaction::Operation and not conscious of the ordering
thanks for help guys
Tim Riley
@timriley
tbh I wonder about the value of Dry::Transaction::Operation in the first place
Spencer Goh
@dymaxionuk
yeah agreed - the monads cover all, and give far more flexibility.
I'm in teh process of ripping out dry-web / dry-web roda (since they dont do much anyway other than some pre config + deprecated) just ripped out dry-transactio from my project (it's slow also) and just removing operations... all I need is the Matcher realy..
and that's clean... and far more powerful composing actions with fmap bind or etc.
the biggest limitation of transactions imo, is of having to chain the parameters from step to step.... so step 1 has 5 params.. of which onky 2 are pertinent for step 2, and diff 2 are useful for step 3 etc... end up passing through in hash, most of the unused params
seems kinda pointless... and once you have the DO notation, the usefulness of step: adapters goes away
Tim are you thinking of deprecating Dry::Transaction one day?
Tim Riley
@timriley
@dymaxionuk No, dry-transaction will remain, it’s useful for many things
How have you found it to be slow?
Viet (Drake) Tran
@tiev
@dymaxionuk with functional objects style, the object interface is simple, you can compose instead of inherit a base class
I use dry-transaction for an importing CSV process and see no slowness
Spencer Goh
@dymaxionuk

Not slow per se, and unlikely issue in real world, but there was a page was linked off the dry-* website, where someone had done some perf tests... and shown that transactions were n factor slower than pure monads.. but then you get all the other benefits... hooks, notifications etc.

Personally not that useful to me anymore for what I wanna do...

a side issue relating to dry-system / Container , when config.auto_register is used, by default the AutoRegistrar will register a block taht creates a new instance.
i'd like to register a single instance of a class - (I have some stateless ext api adapter classes) that are used to call other services - i dontn really want to instantiate on each container resolution
woudl be nice to have a the option to pass a hash to that configuration
```
auto_register = { 'lib/stuff' => :instantiate, 'lib/singlestuff' => :singleton }
Mario Viapiano
@emeve89
Hello everyone, I've been using dry-container & dry-auto_inject to, of curse, avoid to reference dependencies in some classes (as part of the process of applying clean/hexagonal architecture). The thing is that when I use dry-auto_inject, my use cases now depend on the container that lives in a outter layer. What do you think about that? how do you "mix" the use of auto-inject & the guidelines of the clean architecture, for example?
Spencer Goh
@dymaxionuk
or :memoize option I guess is really waht I'm looking to pass through
but the auto register config can't pass that down into the container.register call.
Shawn Anderson
@shawn42
Hi everyone. Thanks for making such a great suite of libraries. I really appreciate all the work and time you've all put in.
Nikita Shilnikov
@flash-gordon
Thanks :heart:
Shawn Anderson
@shawn42
I do have a question the best way to use the List monad over a collection of Try results. The list is built dynamically, then I want to create a List out of the results. When I try to traverse them, it complains about it not being typed. I've tried adding .typed calls, but am not sure what the correct type is. Try did not work. (apologies if this is something simple; I'm pretty new to monads)