Back to articles
Mad For Monads

Mad For Monads

via Dev.tolray138

When I loaded up this site this article sat at the top of the feed. https://dev.to/sylwia-lask/how-i-almost-burned-out-doing-everything-right-31j6 ? Well, I'm burned out. I've been burned out. I never even wanted to be a programmer... how did I get here? function tryPartial ( $partial , $args = null ): Result { $result = getPartialCallable ( Str :: of ( $partial )) -> map ( fn ( $callable ) => fn ( array $args ) => Str :: of ( $callable ( $args ))); if ( func_num_args () >= 2 ) { return $result -> ap ( Result :: of ( $args )); } return $result ; } that was the updated function from: function tryPartial ( $partial , $args = []): Result { $out = getPartialCallable ( Str :: of ( $partial )) -> map ( fn ( $callable ) => Str :: of ( $callable ( $args ))); return $out ; } Where I realized if tryPartial was curried I could return the Result which would contain the functional component and then I could use ap on the Result to apply the data and return the result of the function with is a strin

Continue reading on Dev.to

Opens in a new tab

Read Full Article
6 views

Related Articles