private function generateFunctionDocMarkdown($function) { $eol = PHP_EOL . PHP_EOL; $buffer = ''; // If this function is missing docs if ($function instanceof FunctionDocEmpty) { $buffer .= '## ' . $function->properName() . $eol; $buffer .= $function->emptyDocMessage() . $eol; } else { $buffer .= '## ' . $function->properName(); $buffer .= '[Source](' . $function->githubSource() . ')' . $eol; $buffer .= '__' . $function->name() . '__ :: ' . Either::extract($function->type()) . $eol; $buffer .= $function->description() . $eol; $buffer .= Either::extract(Functor::fmap(function ($examples) use($eol) { $exampleBuffer = ""; $exampleBuffer .= '```' . PHP_EOL; foreach ($examples as $example) { $exampleBuffer .= $example->getDescription() . PHP_EOL; } $exampleBuffer .= '```' . $eol; return $exampleBuffer; }, $function->examples())); } $buffer .= '---' . $eol; return $buffer; }
public function apply($a) { return $this->isJust ? Functor::fmap($this->heldValue, $a) : $this; }
private static function makeLens($getter, $setter) { return Module::curry(function ($key, $f, $inv) use($getter, $setter) { return Functor::fmap($setter($key, $inv), $f($getter($key, $inv))); }); }