Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Piotr Solnica
@solnic
but in case of haskell it’s probably even more difficult as its type system is kinda crazy powerful
Andy Holland
@AMHOL
I need to look into this at some point
Piotr Solnica
@solnic
it has some simple beautiful concepts too that are easy to understand, like you can define a data type with specific attributes and use Eq interface to get equality support OOTB, very explicit and clear. in Ruby equality stuff is so messy
Andy Holland
@AMHOL
Sounds cool
Piotr Solnica
@solnic
there’s a lot of stuff that you can encode within the custom types and a lot of testing goes away not to mention catching stupid bugs at compilation time. but I barely scratched the surface so it’s hard to say anything more about that, need to build something real first (and relatively big)
Andy Holland
@AMHOL
Did you see that PostREST thing on HN?
Piotr Solnica
@solnic
I’ve read quite some criticism too so even though I’m excited I don’t see it as any kind of a silver bullet
yes I did
Andy Holland
@AMHOL
WDYT?
Piotr Solnica
@solnic
I just saw it, didn’t read :)
Andy Holland
@AMHOL
Ahh OK
You should :smile:
Piotr Solnica
@solnic
will do
ok I gotta run, ttyl
Andy Holland
@AMHOL
:+1:
:wave:
Andy Holland
@AMHOL
Updated the validator, ignore build errors, was the wrong build, and just rubocop
Andy Holland
@AMHOL
@solnic added option to pass a validator to each and embedded, check it out if you get a chance :)
Andy Holland
@AMHOL
embedded_user_validator.call(user: user)
# => {:user=>[{:name=>[{:code=>"presence", :value=>"", :options=>true}]}]}
Need to make that a hash rather than an array :/
Either that or return a hash with a code for embedded and array, which could make sense, if you want to validate the type or w.e. too
Think that may be the way to go
As processing, for presentation or w.e., would be easier too
Andy Holland
@AMHOL
@solnic you Skyping today?
Andy Holland
@AMHOL
If anyone gets a chance could I get opinions on dryrb/dry-validator#1 please?
Piotr Solnica
@solnic
@AMHOL sorry I’m having a weird day today, will check it out later in the eve or during the weekend
Andy Holland
@AMHOL
Ahh OK, hope everything is OK
Piotr Solnica
@solnic
@AMHOL our container has ~150LOC; any ideas how to split it into smaller chunks?
Andy Holland
@AMHOL
You mean registering stuff with it?
Piotr Solnica
@solnic
yes
I’m loving the idea you gave me with dot notation btw
Andy Holland
@AMHOL
Yeah, that's what I was thinking
Piotr Solnica
@solnic
helped to categorize things nicely
Andy Holland
@AMHOL
Could split it into namespaces
Piotr Solnica
@solnic
yeah some sugar could be provided on the dsl side I think
Andy Holland
@AMHOL
You doing it in an initializer?
Piotr Solnica
@solnic
yeah
not sure where to put it
I tried separating it into smaller files but then rails loads it in an order that doesn’t work :)
Andy Holland
@AMHOL
Nice, sth like:
container.namespace 'my_namespace' do |namespace|
  namespace.register('sth', -> {})
end
Piotr Solnica
@solnic
yeah
I have one configure block exposed by the app singleton where I yield the container
so I have only one chance to register stuff because then it freezes everything
but that part I can change
Andy Holland
@AMHOL
WDYT of:
container.register({
  item_1: -> {},
  item_2: -> {},
  # ...
})
Same with namespace
As an alternative method
Piotr Solnica
@solnic
I wouldn’t use it
Andy Holland
@AMHOL
:p
Piotr Solnica
@solnic
it would look very cluttered
do...end is much cleaner, easier to parse with eyes you know :)