These are chat archives for dry-rb/chat

2nd
Oct 2015
@AMHOL @kwando ^
I also ported the thing to use dry-container so now we can simply register types under symbol keys
Luca Guidi
@jodosha
Oct 02 2015 13:58
OMG it returns None :heart:
Piotr Solnica
@solnic
Oct 02 2015 13:58
@jodosha hah yeah…I really really wanted that
I wonder if it makes sense to register optional types for all built-in primitives so that you get it OOTB hmmm
also optional_string vs maybe_string? I kinda like “maybe” more :)
@AMHOL I’m thinking about a predicate micro-system that we could share between dry-data and dry-validators, feels like this could be a generic functionality
Andy Holland
@AMHOL
Oct 02 2015 14:02
@solnic v.nice :smile:
Piotr Solnica
@solnic
Oct 02 2015 14:03
@AMHOL I’m sorry I didn’t pursue our “distributed TDD” idea…but I’m happy to do that next time with something that’s less urgent for me, sounds good?
another thing is separation between simple type-check and coercible-type-check, not sure how those things should be called in container :/
Andy Holland
@AMHOL
Oct 02 2015 14:13
@solnic you did a much better job than I would have anyway
Piotr Solnica
@solnic
Oct 02 2015 15:35
@AMHOL nah :) but thanks ;)
Peter Saxton
@CrowdHailer
Oct 02 2015 15:41
I would vote for maybe_string options get used all over the place.
All looking good now I am reading through learn you a haskell
Piotr Solnica
@solnic
Oct 02 2015 15:42
@CrowdHailer yeah I think I will rename it
Andy Holland
@AMHOL
Oct 02 2015 15:42
@solnic AMHOL/roda-flow@c882a51 cleaned up roda-flow :)
Piotr Solnica
@solnic
Oct 02 2015 15:42
Thoughts on coercible vs noncoercible type identifiers?
atm we use kernel coercions for all primitives but quite often you want to skip that
`
"coercible.string" maybe but I dunno
Andy Holland
@AMHOL
Oct 02 2015 15:44
Don't forget about namespace in container for that :)
How about strict.string ?
Could use maybe/always but would probably be a bit weird
Piotr Solnica
@solnic
Oct 02 2015 15:45
Then you can have things like "form_input.date"
Andy Holland
@AMHOL
Oct 02 2015 15:46
:clap:
Piotr Solnica
@solnic
Oct 02 2015 15:46
Hmm I like that yeah, so strict is just typecheck and coercible will first coerce then typecheck
Notice that type check can be anything not just class verification
Andy Holland
@AMHOL
Oct 02 2015 15:47
Cool, so could just be a respond_to?
Piotr Solnica
@solnic
Oct 02 2015 15:49
@AMHOL any constraint you want but I would prefer strict type check in most cases
Benjamin Klotz
@tak1n
Oct 02 2015 15:49
optional_string haters gonna hate, but I love it :D
Piotr Solnica
@solnic
Oct 02 2015 15:50
I am optional_string haters hater ;)
Benjamin Klotz
@tak1n
Oct 02 2015 15:51
hehe :P
u are using kleisli under the hood right?
love unneeded questions xD
Piotr Solnica
@solnic
Oct 02 2015 15:57
@tak1n yeah, I like kleisli
Benjamin Klotz
@tak1n
Oct 02 2015 15:57
awesome :D
Piotr Solnica
@solnic
Oct 02 2015 15:57
hey so maybe (no pun intended) we should switch to namespaced names?
Andy Holland
@AMHOL
Oct 02 2015 15:58
+1
Piotr Solnica
@solnic
Oct 02 2015 15:58
”strict.string” ”maybe.string” ”form_input.maybe.string”
Andy Holland
@AMHOL
Oct 02 2015 15:58
here
Benjamin Klotz
@tak1n
Oct 02 2015 15:58
+2
:D
Piotr Solnica
@solnic
Oct 02 2015 15:58
holy moly I’m gonna love this lib (self-biased optimism)
Andy Holland
@AMHOL
Oct 02 2015 15:58
:joy:
@solnic worth defining constants?
Piotr Solnica
@solnic
Oct 02 2015 15:59
I don’t think we need constants
Andy Holland
@AMHOL
Oct 02 2015 15:59
Dry::Data::STRICT_STRING = 'strict.string'.freeze
Dry::Hash.new(name: STRICT_STRING)
Piotr Solnica
@solnic
Oct 02 2015 15:59
it’s gonna be more words to type
Benjamin Klotz
@tak1n
Oct 02 2015 15:59
less string allocs
:D
Andy Holland
@AMHOL
Oct 02 2015 15:59
That was my thinking
Benjamin Klotz
@tak1n
Oct 02 2015 15:59
premature opt :D
Andy Holland
@AMHOL
Oct 02 2015 16:00
lol
Piotr Solnica
@solnic
Oct 02 2015 16:00
it’s gonna be better in mri 3.0 ;)
Andy Holland
@AMHOL
Oct 02 2015 16:00
:laughing:
Piotr Solnica
@solnic
Oct 02 2015 16:00
OPTIMIZE FOR THE UNKNOWN FUTURE ;)
Andy Holland
@AMHOL
Oct 02 2015 16:00
mri 3.0 is gonna be Perl 6
Piotr Solnica
@solnic
Oct 02 2015 16:00
luls
@AMHOL nice work on roda-flow, did you start using it in your project after all?
Andy Holland
@AMHOL
Oct 02 2015 16:01
Yeah
Piotr Solnica
@solnic
Oct 02 2015 16:01
cool man
Andy Holland
@AMHOL
Oct 02 2015 16:02
It's working out nicely
Only a simple app though
Piotr Solnica
@solnic
Oct 02 2015 16:02
Type.new(method(:constructor).to_proc.curry.(primitive), primitive) HATERS GONNA HATE ;)
Andy Holland
@AMHOL
Oct 02 2015 16:02
lol
Benjamin Klotz
@tak1n
Oct 02 2015 16:02
primitives, primitives everywhere
xD
@solnic I think I'll use dry validator for these use case specific validation rules I mentioned earlier
Piotr Solnica
@solnic
Oct 02 2015 16:09
@tak1n not sure if @AMHOL released it already :)
Andy Holland
@AMHOL
Oct 02 2015 16:18
I haven't
Wanted to add more built-in validations, but haven't had time or enthusiasm to work on stuff lately
Feel free to release it as-is though
Piotr Solnica
@solnic
Oct 02 2015 16:19
I’ll be working on it after dry-data is released and usable
Piotr Solnica
@solnic
Oct 02 2015 16:43
irb(main):009:0> t = Dry::Data.method(:[])
irb(main):010:0> maybe_coercible_string = t.('strict.nil') | t.('coercible.string')
irb(main):011:0> maybe_coercible_string[nil]
=> None
irb(main):012:0> maybe_coercible_string[123]
=> Some("123")
oh haters gonna hate so much <3
Andy Holland
@AMHOL
Oct 02 2015 16:53
Lol
Does None pass a nil check?
Piotr Solnica
@solnic
Oct 02 2015 17:30
@AMHOL nope it doesn't pretend to be a nil