Note that there are some explanatory texts on larger screens.

plurals
  1. POReal-world applications of zygohistomorphic prepromorphisms
    text
    copied!<p>Yes, <a href="http://www.haskell.org/haskellwiki/Zygohistomorphic_prepromorphisms" rel="nofollow noreferrer">these ones</a>:</p> <pre><code>{-#LANGUAGE TypeOperators, RankNTypes #-} import Control.Morphism.Zygo import Control.Morphism.Prepro import Control.Morphism.Histo import Control.Functor.Algebra import Control.Functor.Extras import Control.Functor.Fix import Control.Comonad.Cofree zygohistomorphic_prepromorphism :: Functor f =&gt; Algebra f b -&gt; GAlgebra f (ZygoT (Cofree f) b) a -&gt; (f :~&gt; f) -&gt; FixF f -&gt; a zygohistomorphic_prepromorphism f = g_prepro (distZygoT (liftAlgebra f) (distHisto id)) </code></pre> <p>Yes, I know that they're a (<a href="http://www.catb.org/jargon/html/H/ha-ha-only-serious.html" rel="nofollow noreferrer">HHOS</a>) joke. I'm looking for a real-world example for simple hack value and last, but not least, to add it to the wiki saying "This is the idiomatic way to express XYZ". I <em>will</em> put a bounty on this should you fail to come up with a solution. If you're completely lost on what they're about, Edward posted a <a href="http://www.reddit.com/r/programming/comments/6ml1y/a_pretty_useful_haskell_snippet/c04ako5" rel="nofollow noreferrer">short explanation</a> on reddit.</p> <p>Eligible Answers must:</p> <ol> <li><p>do something at least remotely and theoretically computationally useful. That is, answers that reduce to <code>id</code> are out.</p></li> <li><p>use all the features of the scheme, no passing in of id, or const, or equivalent.</p></li> <li><p>not equally well be expressible by a simple, vanilla fold or such, so don't merely implement <code>product</code> in a meandering way.</p></li> </ol> <p>Bonus points will be given to:</p> <ul> <li><p>Well-known problem or algorithm</p></li> <li><p>solved, respectively expressed, in an unusual way that gains</p></li> <li><p>clarity and/or performance</p></li> <li><p>and/or hack value</p></li> <li><p>and/or lulz, in roughly that order, as well as</p></li> <li><p>high-ranking answers (yay democracy)</p></li> </ul> <p>Please also note <a href="https://stackoverflow.com/questions/5057136/real-world-applications-of-zygohistomorphic-prepromorphisms/5058725#5058725">Edward's answer</a> below. What ZHPM implementation you use is your choice.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload