Releases: AlexanderAllen/panettone
0.2.3
July 2024
This month's effort was focused on implementing all category objects from Chapter 5: Functors, Applicatives, Monads of Gilles Cretterand's book. Implementing these meant updating the book's 10 years old code for more modern PHP, adding static typing via PHPStan, and identifying intersections between the reference FantasyLand implementation and the book.
None of the code done exists yet in src, instead it is all being created inside unit tests.
PHPStan
I spent a good chunk of this month diving into generics with PHPStan, then understanding the intersection between generics and functional objects.
The work to fully, accurately type all the category objects implemented so far is still ongoing.
Some type information is coming from upstream in FantasyLand itself, however some of those upstream types currently do not compile in PHPStan and I am working to either fix those locally in Panettone or on a fork of Fantasy Land itself.
Initial category objects
The objects implemented include the functor, applicative functor, monoid, and monad.
I have independently written and asserted all the laws mentioned in chapter 5, even though the FantasyLand spec comes with it's own set of assertions for the laws.
It's interesting that's there slight but still significant differences between Cretterand's book and Habryn's reference implementation. Initially I've implemented Cretterand's objects as faithfully as possible even if they differ from Habryn because it made more sense for asserting category laws as they appear in Cretteran's book. However because I'm integrating Fantasy Land where possible, there might be some mapping and aliasing included between Cretterand's and Habryn's implementations.
Fantasy Land
Fantasy Land is a completely separate, independent specification for algebraic (category) objects. This consists mostly of interfaces that you can implement in your objects to make sure they are compliant with the specification.
I deferred implementing Fantasy Land to after I asserted all the functional laws for the initial tranche of category objects (completed), and as such integration of the interfaces listed by the spec is still in progress.
Completed
- Implement all objects from Ch. 05 in Cretterand's book.
- Use unit tests to assert all functional laws for implemented objects.
In progress
- Fix PHPStan compilation for upstream Fantasy Land interfaces.
- Types for objects or methods that currently lack types.
- Aliases that bridge Cretterand's and Habryn (Fantasy Land) implementations.
Testing
As the build in Github is currently broken, here is a list of tests tagged by this release:
Applicatives test
✔ Full applicatives
Assert functor laws for:
✔ What is an applicative functor
✔ Applicative functor returns closure
✔ Applicative functor hints correctly
✔ Native constructs
✔ Custom class
✔ Maybe monad
✔ Identity functor
Collection Applicative
✔ Simple applicative
✔ Image gallery applicative
Functional tests
✔ Use literal book example
✔ Change to string state
Functors using generics
✔ Check the dumped hints
Isolate generic return type
✔ Generic hint using constructor
✔ Generics using static
Laws for Applicatives
✔ Map
✔ Identity
✔ Homomorphism
✔ Interchange
✔ Composition
Laws for Monads
✔ Left identity
✔ Right identity
✔ Associativity
Laws for Monoids
✔ Identity
✔ Associativity
✔ Non associative check
✔ Monoids as int foldables
✔ Monoids as array foldables
✔ Monoids as callables
Medianoche: Fwuffy Cuban sandwich bread
✔ Functional
OK (30 tests, 74 assertions)
Generating code coverage report in Cobertura XML format ... done [00:00.007]
Code Coverage Report:
2024-07-25 20:33:49
Backed enum support
What's Changed
- Back enums with literal value sourced from OAS. by @AlexanderAllen in #47
Full Changelog: 0.2.1...0.2.2
0.2.1
What's Changed
- Make MediaNoche Stateless Again by @AlexanderAllen in #45
Full Changelog: 0.2.0...0.2.1
Emit enums harvested from OAS sources
This release adds support for enum properties in OAS sources.
Properties containing enum are emitted as discreet enum type files, in addition to being represented as object properties.
See #42 for more information.
Courtesy screenshot:
Initial development release
With all the initial objectives I envisioned for this project complete, I feel that it has earned it's first tag (and release).
What's Changed
- Working on *Of type schemas. by @AlexanderAllen in #2
- Some initial test decoupling and fixture updates by @AlexanderAllen in #7
- Remove composer package version by @AlexanderAllen in #8
- Update composer.json by @AlexanderAllen in #9
- Unsupported use case for
anyOfby @AlexanderAllen in #10 - OK: Assert union use case for anyOf by @AlexanderAllen in #11
- Move PHPUnit to
toolsdir by @AlexanderAllen in #12 - Issue #3 OneOf: Add processing for oneOf properties. by @AlexanderAllen in #13
- AlexanderAllen/issue5 by @AlexanderAllen in #14
- #18 Export Nette objects into filesystem. by @AlexanderAllen in #25
- Update test paths on media noche. by @AlexanderAllen in #26
- Update unit test for forced snakeTest casing. by @AlexanderAllen in #27
- Add configuration file support. by @AlexanderAllen in #30
- Fix AlexanderAllen/issue17 by @AlexanderAllen in #31
- Assert bad source results in command failure by @AlexanderAllen in #32
- Global property overrides by @AlexanderAllen in #33
- Re-enable logging by @AlexanderAllen in #34
- Multiple cleanup fixes for issue #15 by @AlexanderAllen in #35
- Remove reference to consolidation log from archived test. by @AlexanderAllen in #37
- Assert member property if of type intersection by @AlexanderAllen in #38
- Create bin executable for package. by @AlexanderAllen in #39
Full Changelog: https://github.com/AlexanderAllen/panettone/commits/0.1.0
TODO
- Support for
enums in Open Api sources. - Arguments and help output in the "bin" executable. It's not mission critical for me as the app's settings are set via
.inifiles at the moment.
