Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 20 15:09
    raccube starred dry-rb/dry-types
  • Jan 20 13:08
    timriley synchronize #209
  • Jan 20 13:08

    timriley on container-exports

    Better, remove spurious arg and… (compare)

  • Jan 20 13:05
    timriley synchronize #209
  • Jan 20 13:05

    timriley on container-exports

    Better, remove spurious arg and… (compare)

  • Jan 20 13:01
    timriley edited #209
  • Jan 20 13:00
    timriley synchronize #209
  • Jan 20 13:00

    timriley on container-exports

    Refactor, make things a bit nic… Better, remove spurious arg and… (compare)

  • Jan 20 12:48
    timriley synchronize #209
  • Jan 20 12:48

    timriley on container-exports

    Working (but somewhat gross) ve… (compare)

  • Jan 20 03:55

    action-hero[bot] on master

    Update Gemfile.devtools from dr… (compare)

  • Jan 20 03:55

    action-hero[bot] on master

    Update .rubocop.yml from dry-rb… (compare)

  • Jan 20 03:55

    action-hero[bot] on master

    Update Gemfile.devtools from dr… (compare)

  • Jan 20 03:55

    action-hero[bot] on master

    Update Gemfile.devtools from dr… (compare)

  • Jan 20 03:55

    action-hero[bot] on master

    Update .rubocop.yml from dry-rb… (compare)

  • Jan 20 03:55

    action-hero[bot] on master

    Update .rubocop.yml from dry-rb… (compare)

  • Jan 20 03:55

    action-hero[bot] on master

    Update Gemfile.devtools from dr… (compare)

  • Jan 20 03:55

    action-hero[bot] on master

    Update Gemfile.devtools from dr… (compare)

  • Jan 20 03:55

    action-hero[bot] on master

    Update .rubocop.yml from dry-rb… (compare)

  • Jan 20 03:55

    action-hero[bot] on master

    Update .rubocop.yml from dry-rb… (compare)

Piotr Solnica
@solnic
@apotonick let’s talk this through then, I’m working on dry-v + dry-schema 0.11 in May
Nick Sutterer
@apotonick
Yeah, I mean all Reform does in addition to your work is: presentation object, mapping between DB structure and the form object, and, and that's what is underestimated all the time, the deserialization of the incoming document
That's where Representable comes into play
And I think we should also discuss how ROM could do the structural mapping part of Reform, as I am absolutely not interested in repeating what's been done better, before
Pablo Herrero
@pabloh
When using dry-transaction, Is possible to modify the context within a step?
Nikita Shilnikov
@flash-gordon
@pabloh wdym by saying "context"? A transaction just accepts arguments and returns a result, it doesn't have any mutable internal state
Pablo Herrero
@pabloh
Doesn't it keep a context along the way where you can grab values?
Is not possible to store partial results somewhere there to use on subsequent steps?
Nikita Shilnikov
@flash-gordon
you just pass them from one step to another
I use keyword args for passing several values at once
def my_step(value_1: , **rest)
  value_1_transformed = do_something(value_1)
  Right(value_1: value_1_transformed, **rest)
end
@pabloh like this^
Pablo Herrero
@pabloh
So you need to make your result value a hash?
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?