These are chat archives for dry-rb/chat

31st
Oct 2016
Piotr Solnica
@solnic
Oct 31 2016 10:01
@georgemillo right, we gotta update this page
first of all, maybe has become an extension, so to use it you need to do Dry::Types.load_extensions :maybe
George Millo
@georgemillo
Oct 31 2016 10:06
is that the only difference?
Piotr Solnica
@solnic
Oct 31 2016 10:14
optional means “nil or something else”
and it does not use dry-monads
so values are not wrapped in Some or None
George Millo
@georgemillo
Oct 31 2016 10:15
okay
Piotr Solnica
@solnic
Oct 31 2016 10:15
@flash-gordon you there?
George Millo
@georgemillo
Oct 31 2016 10:15
so if you're using optional, does that render the nil_or_string example here redundant? http://dry-rb.org/gems/dry-types/sum/
nil_or_string = Types::Strict::Nil | Types::Strict::String could just be nil_or_string = Types::Strict::String.optional, amirite?
Piotr Solnica
@solnic
Oct 31 2016 10:16
@georgemillo yes, optional is a shortcut for summing nil with another type
George Millo
@georgemillo
Oct 31 2016 10:17
okay
and Types::Coercible::String.maybe is just an alias for Types::Maybe::Coercible::String?
(as penance for pestering you with so many questions, I will gladly submit a PR to the docs so that the next person won't ask them)
Piotr Solnica
@solnic
Oct 31 2016 10:26
@georgemillo yes #maybe method just turns a type into a maybe type, the built-in maybe types are created using this method
ie see here
George Millo
@georgemillo
Oct 31 2016 10:28
ahhh
alles klar
thanks!
Piotr Solnica
@solnic
Oct 31 2016 10:48
@georgemillo cool :) helping with docs is greatly appreciated <3
George Millo
@georgemillo
Oct 31 2016 23:57
okay, sorry, yet another question
Notice that you must add the :email_absence message to the configuration if you want to have the error converted to a message.
what does 'add it the configuration' mean? Move the rule block from that example to inside the schema's configure block? What's the syntax for defining high-level rules inside configure?