Algebrick - bump to version 0.1.2
Algebraic::DSL module does not have to be extended into your module to access
#type_def any more.
It can be now called directly with passing the base module to define the new types.
Algebrick.type_def self do boolean === TrueClass | FalseClass end
When wrong field is accessed it will now raise an
ArgummentError instead of silently returning
Algebrick.type_def(self) do tree === empty | tree(value: Integer, left: tree, right: tree) end Tree[1, Empty, Empty][:middle] rescue $! # => #<ArgumentError: uknown field :middle>
Access fields by method
#add_all_field_method_accessors on a product type to get access to fields by methods.
Tree.add_all_field_method_accessors Tree[1, Empty, Empty].left # => Empty
There are also methods
add_field_method_accessors to add accessor/s selectively.