E
Edward Kmett
comonad.com · Personal blog · on HN since 2008
Edward Kmett, a Haskell programmer, writes about functional programming, category theory, parsing, and type theory.
What HN saysHN links it for his Haskell and parsing posts; commenters also discuss his advocacy of typed languages, with one finding a talk condescending.
25HN people shared it
11linked it in comments
16stories submitted
409story points
3 years agolast shared
2008people per year2026
Most-shared posts
- 1Letter to a Young Haskell Enthusiast7 people · 350 points · first shared 2014 · 173 comments on HN
- 2Linear Bloom Filters3 people · 29 points · first shared 2008 · 3 comments on HN
- 3Recursion Schemes (Edward Kmett)2 people · 3 points · first shared 2010 · discussion on HN
- 4Reader2 people · first shared 2012
- 5Computational Quadrinitarianism (2018)1 people · 12 points · first shared 2019 · 1 comments on HN
- 6Curried Scheme1 people · 6 points · first shared 2009 · 1 comments on HN
- 7Kan Extensions II: Adjunctions, Composition, Lifting1 people · 3 points · first shared 2008 · 1 comments on HN
- 8A Parsing Trifecta (2009) [pdf]1 people · 2 points · first shared 2018 · discussion on HN
- 9Natural Deduction, Sequent Calculus and Type Classes1 people · 2 points · first shared 2012 · discussion on HN
- 10A Sort of Difference1 people · 1 points · first shared 2008 · discussion on HN
- 11Free Monads for Less: Codensity1 people · 1 points · first shared 2012 · discussion on HN
- 12Iteratees parsec and monoid1 people · first shared 2010
- 13Remodeling precision1 people · first shared 2023
- 14Free monads for less 31 people · first shared 2014
- 15Category theory1 people · first shared 2010
What HN people wrote when they linked it
avindroth · 2021-01-06
Note that when you ask a question like this, you will get a biased selection of answers. People who love niche languages for whatever reason will be more than ready to answer these sorts of questions. Passionate people are great, but you often are in need of some fresh opinions on the other side.
Here are some that helped me out immensely (I used to love Haskell but now I love it adequately):
https://prog21.dadgum.com/54.html
http://comonad.com/reader/2014/letter-to-a-young-haskell-enthusiast/
New technologies can be a psychological trap.
ddellacosta · 2014-10-15
The talk he's defending was tiresome and dripping with condescension (I agree with Stephen Diehl: https://twitter.com/smdiehl/status/519160854517149696). Typed-language folks don't need advocates who waste breath talking about "incompetent Ruby developers moving to Clojure" and whatnot. There's enough positive stuff to talk about! I think the folks who gave that talk need to read Gershom Bazerman's (a person who has no trouble giving talks filled with excitement about type- and category-theoretic concepts with no condescension) excellent post here: http://comonad.com/reader/2014/letter-to-a-young-haskell-enthusiast/
tel · 2014-10-04
Perhaps the best way to think of it is that a Haskell program is a pure function from FFI outputs to FFI inputs. Something like
H out in = out -> (FFIOperation, in)
The `IO` monad is nothing more than how operating "inside of this function" feels. The runtime thus operates the pure Haskell program evaluating its FFI demands and returning their results.
The AST POV espoused by this article is quite good as well, but a little bit less obvious how to "step" things forward or operate nicely in parallel contexts.
Also, in reality the above perspective is a good way to embed Haskell into other contexts.
http://comonad.com/reader/2011/free-monads-for-less-3/
pjscott · 2010-11-28
Yes, it's possible to extend the method in the linked post to parse trees. Check out monoidal parsing:
http://comonad.com/reader/2009/iteratees-parsec-and-monoid/
This guy figured out how to turn parsers written with Parsec (an excellent collection of parser combinators; truly a pleasure to use) into monoidal parsers that you can use for incremental and/or parallel parsing.
kfixjviv · 2023-08-21
Haskell's sequence is not the same as strength. Strength specifically involves pairs.
Nobody seems to know where "strength" got its opaque name from. Like, nobody, not even the guy who first published the term.
There is another article on the topic here:
http://comonad.com/reader/2008/deriving-strength-from-laziness/
082349872349872 · 2023-06-16
Back when people-facing computer stuff worked more like computer-facing computer stuff, queries were simple: keywords to match. If you get too many results, add more keywords; if you get too few, remove* keywords (or change existing keywords to be more specific/more general respectively).
If you're not searching for literal occurrences of "what" and "is", why should they even be in a query?
* this is an instance of an adjunction, which is an important concept in informatics, but I understand that to actually admit the fact would probably be the kiss of death for anything claiming to be a "user" interface.
Lagniappe: marginalia, upon being queried with "precision" and "recall", came up inter alia with http://comonad.com/reader/2009/remodeling-precision/ , which I count as a win for it.
kian · 2020-04-14
see the second-to-last slide for a mapping from Algebraic Structures to Computer Science Concepts. http://comonad.com/reader/wp-content/uploads/2009/08/IntroductionToMon…
carterschonwald · 2013-04-03
For a nice exposition on how to do some really neat distributed joins that make even more interesting use of hashing / bloom filters, this exposition by Edward Kmett is a nice read: http://comonad.com/reader/2008/linear-bloom-filters/
chas · 2021-03-04
Programmer warning: this is the math jargon heavy version, you don't need to know the math jargon to make use of these tools for writing day-to-day programs.
There are too many applications for me to do justice in one message and it is a bit messy because all of these are related, but there are roughly three ways that category theory gets applied to computing:
- Reasoning about data within computer programs. In "Generating Compiler Optimizations from Proofs" they make a category where the objects are a representation of expressions in programming languages and the morphisms are expression substitutions. They use this to build general proofs of correctness of compiler optimizations (http://cseweb.ucsd.edu/~rtate/publications/proofgen/proofgen_tate_popl…
- Looking at logics (and thus programming languages) as algebraic objects. Objects are propositions, morphisms are proofs that prove one proposition given assumed propositions. Similarly objects are types, morphisms are functions. That in some contexts these are the same thing is the famous (in programming language circles) Curry-Howard-Lambek correspondence. https://existentialtype.wordpress.com/2011/03/27/the-holy-trinity/ For way more, see https://ncatlab.org/nlab/show/relation+between+type+theory+and+categor… A different version of this is specifying the mathematical meaning of program execution in terms of directed-complete partial orders which are fruitful to think of categorically. I think…
camccann · 2010-05-18
Well, there's not much to the basic idea--the λ-calculus just is the structure of a cartesian closed category. Exponential objects represent morphisms by objects, a.k.a. first-class and higher-order functions, the equivalence Hom(X * Y -> Z) ~ Hom(X -> Z^Y) is currying, a morphism ((Y^X) * X) -> Y is function application, and so on.
A basic cartesian closed category alone only gets you the simply-typed λ-calculus, though, which isn't much fun. The untyped λ-calculus is of course incoherent from the C-H perspective, since unrestricted recursion[0] gives you Turing-equivalence, which corresponds to an inconsistent logic; a categorical description would probably be easy but I don't think I've seen one.
More expressive typed λ-calculi such as System F are more interesting from a computer science perspective, but I've not been able to find much material discussing them from a logical or categorical perspective. Instead, most mathematicians would jump straight to something like Coquand's Calculus of Constructions[1], which is (if memory serves me) the internal logic of a topos.
Category theory also sees some use in computer science beyond just C-H stuff--for instance, describing recursive data types as fixed points of endofunctors on the category of types. This permits an elegant categorical description of operations on those types--e.g., the "fold" or "reduce" function on lists is represented by an initial F-algebra. The categorical habit of dualizing everything in reach also…
jewbacca · 2010-07-06
The extent of my experience on the topic is in half-comprehending hobbyist's awe and the inclusion of okmij on my "personal heroes and demigods" list. The only word I could half-heartedly associate with this structure is the incredibly lame "hylomorphism"... which actually kinda generally expresses the pattern of much of computing. It's 5 AM and I'm going to sleep, but I'll leave you with the the most plausible leaves of a very brief search towards finding some recognized formal name for this structure:
http://blog.sigfpe.com/2009/07/monad-for-combinatorial-search-with.htm…
http://spivey.oriel.ox.ac.uk/mike/search-jfp.pdf
http://www.cs.au.dk/~gerth/papers/jfp96.pdf
If you really don't like yourself, try digging here:
http://hackage.haskell.org/packages/archive/pointless-haskell/0.0.1/do…
http://comonad.com/reader/2009/recursion-schemes/