scalp icon indicating copy to clipboard operation
scalp copied to clipboard

Some Scala useful classes ported to PHP.

Results 8 scalp issues
Sort by recently updated
recently updated
newest added

At this moment `Success::flatMap` and `Failure::recoverWith` functions use function `restrictCallableReturnType` to check whether callable passed as argument has defined return type to `TryCatch`. It rises `TypeError` in case when return...

proposal

Type partial function represents a function which is undefined for some elements of the domain. ### Example `f(x) = 42 / x` is not defined at `x` equal `0` ###...

proposal

In some of methods in Scala's implementation of `Option` and `Try` parameters are passed by name. In PHP we do not have such possibility and we have to pass evaluated...

proposal

https://github.com/pawaclawczyk/scalp/blob/0c0d6544688de3e091142d349beda68b26fbca4a/.php_cs#L20 https://github.com/pawaclawczyk/scalp/blob/0c0d6544688de3e091142d349beda68b26fbca4a/src/Scalp/PatternMatching/Value.php#L22-L24

bug

`Scalp\PatternMatching\Deconstruction` trait provides `construct` and `deconstruct` methods, holds internally data that represents construction arguments. Problem related with current implementation: 1. `Destruction::construct` must be called manually with right arguments. It's easy...

proposal

Example of current usage of regular expression. ``` private function elementId(string $propertyName): Option { preg_match('/^_(\d+)$/', $propertyName, $matches); return isset($matches[1]) ? Some((int) $matches[1]) : None(); } ```

proposal

`flatMap`s and `recoverWith` are protected with check that ensures the passed callable will return an expected type ie. `Option` or `TryCatch`. In case of passing partially applied function the real...

bug

Example of usage with `map` method. ```php class Counter { public static function zero(): Counter { ... } public function increment(int $step = 1): Counter { ... } } $res0...

proposal