Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • May 27 12:26
    rrcosta starred dry-rb/dry-types
  • May 25 11:45

    timriley on v0.24.0

    (compare)

  • May 25 11:45

    timriley on remove-dry-struct

    (compare)

  • May 25 08:10

    github-actions[bot] on main

    [devtools] sync (compare)

  • May 25 08:10

    action-hero[bot] on main

    Update dry-system.gemspec from … (compare)

  • May 25 08:09

    flash-gordon on main

    Remove dry-struct dependency I… Bump version Update CHANGELOG (compare)

  • May 22 09:10
    Benoit-Baumann starred dry-rb/dry-monads
  • May 21 16:11
    kholdrex starred dry-rb/dry-monads
  • May 19 15:16
    cllns edited #255
  • May 19 07:00
    radar edited #440
  • May 19 05:51
    flash-gordon commented #440
  • May 18 23:22
    radar labeled #440
  • May 18 23:22
    radar labeled #440
  • May 18 23:22
    radar opened #440
  • May 17 14:06
    flash-gordon closed #96
  • May 17 14:06
    flash-gordon commented #96
  • May 17 12:08
    olkeene labeled #96
  • May 17 12:08
    olkeene labeled #96
  • May 17 12:08
    olkeene opened #96
  • May 13 10:11
    jonathanmdavies starred dry-rb/dry-monads
Nikita Shilnikov
@flash-gordon
I use hashes, but it's up to you. You also can define a custom step http://dry-rb.org/gems/dry-transaction/custom-step-adapters/, but this is advanced usage :)
Pablo Herrero
@pabloh
My question is do you have to put a hash besides the actual value in the result to have some kind of context?
Nikita Shilnikov
@flash-gordon
can be arrays also, or you can define your own "context" object
the main point is that dry-transaction doesn't have a mutable state inside
Pablo Herrero
@pabloh
I understand that, I meant "change" the context in the same way the state monad updates its "state".
Nikita Shilnikov
@flash-gordon
yeah, in this sense a new type of step will be useful, atm we don't have any special "context" object
txn = define_transaction do
  custom_step_adapter 'step_1', using: :value_1
  custom_step_adapter 'step_2', using: :value_2
  map 'step_3'
end

txn.call(value_1: 1, value_2: 2)


def my_step(value_1)
  value_1 + 1
end

def my_step(value_2)
  value_2 + 1
end

def step_3(context)
  context # { value_1: 2, value_2: 3 } 
end
@pabloh for example^
Nick Sutterer
@apotonick
@pabloh That's basically and exactly what a TRB operation provides (sorry for high-jacking)
Pablo Herrero
@pabloh
Ok, will check it out.
Nick Sutterer
@apotonick
@pabloh There a "context" object, we call it options which is basically a hash, and passed from step to step (per default) http://trailblazer.to/gems/operation/2.0/#state-and-result
Pablo Herrero
@pabloh
So you just store the actual result in :model as a convention?
Pablo Herrero
@pabloh
@apotonick, any reason yoy prefered that approach instead of storing the result separately?
Nick Sutterer
@apotonick
@pabloh The result is stored separately! The options hash scopes, and knows who added what
However, most operations don't need that, so the "human" interface is very simple and looks "global", but it isn't. It took months to design it
Pablo Herrero
@pabloh
I see, I think I could take a dive in the code in order to fully get it after I check out the docs some more.
George Millo
@georgemillo
hey, when I clone the dry-types repo and run specs, I get failures for all tests that involve a maybe type
I imagine that this is something to do with dry-monads not being loaded?
how do I make the tests pass?
Nikita Shilnikov
@flash-gordon
@georgemillo run with rake
George Millo
@georgemillo
aha
thanks
looks like rake runs two rspec suites
what's going on there?
Nikita Shilnikov
@flash-gordon
with/without monads ext
George Millo
@georgemillo
oh wait, I answered my own question by looking in the Rakefile
funny how that happens
Piotr Solnica
@solnic
@flash-gordon I’d like to revisit hash schema implementation in dry-types, and try to figure out a more flexible way for setting them up. This was brought up before by @Kukunin I believe, I was initially against it, but we start to see more use cases where a more flexible solution would be very useful. /cc @backus
ie now we need a symbolized hash which has strict semantics too, and we’re stuck :)
this is definitely something to figure out before 1.0.0
if we can come up with a flexible solution which is also fast, that would be awesome. Oh and the lib should still provide a bunch of common, built-in hash schema types
@apotonick I’ll let you know once I have something working with the new dry-v + dry-schema, and re rom, I reported an issue about reform/rom integration so we can discuss things there I guess
Sergey Kukunin
@Kukunin
@flash-gordon I have a crash on latest master of dry-struct. on the first attribute call.
equalizer.instance_variable_get('@keys').concat(new_schema.keys)
NoMethodError: undefined method `concat' for nil:NilClass
  /Users/kukunin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/dry-struct-fbe71e6445a8/lib/dry/struct/class_interface.rb:78:in `attributes'
  /Users/kukunin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/dry-struct-fbe71e6445a8/lib/dry/struct/class_interface.rb:50:in `attribute'
  /Users/kukunin/Sites/matic-www/gems/shift-domain/lib/shift/domain/attachment.rb:8:in `block in <module:Domain>'
Nikita Shilnikov
@flash-gordon
@Kukunin I think you need dry-core from master, check it out
Sergey Kukunin
@Kukunin
thanks. going to try
yep. that's the reason. thanks
any plans to release dry-struct 0.2.2 with minor changes?
it seems that major changes are coming (already in master)
Nikita Shilnikov
@flash-gordon
nope, I'll release 0.3, soon. Bumping dry-core will require releasing rom as well, takes some time...
Sergey Kukunin
@Kukunin
what's about releasing dry-rb/dry-struct@bfc867e commit as 0.2.2?
and next release will be 0.3
Nikita Shilnikov
@flash-gordon
too late :) I don't have time for this
Sergey Kukunin
@Kukunin
ok. looking forward 0.3 version =)
you're doing great job, though. thanks
Nikita Shilnikov
@flash-gordon
@Kukunin it's about today/tomorrow I hope
Sergey Kukunin
@Kukunin
:+1:
Ahmad Musaffa
@musaffa
@timriley After reading your series post in Icelab's blog, I've finally come to understand dry-container and dry-auto_inject etc gems and their usecases. Before that I read the docs in dry-rb site but couldn't fully understand the concepts. Wouldn't it be better if the documentation of dry-rb website also contains a getting started guide that walks the newcomers through some storybased steps introducing new concepts on every chapter like you did in the series post of Icelab blog?
Thanks.
Tim Riley
@timriley
@musaffa yep, that’s totally the plan. I’d love for us to have a “guides” section with some more step-by-step introductions.
Glad to hear you figured this stuff out via the blog posts though :)
Piotr Rybarczyk
@Argonus
Hi all. I ma trying to make custom rule it should look like this: rule(variant_presence: [:variant_id, :sku]) do |variant_id, sku| variant_id.filled? | (sku.filled? & Spree::Variant.where(sku: value(:sku)).any?) end But i have +arel+ is not a valid predicate name error. I really cant find nothing about this in documentation.