Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Twisol
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
47 ms
·
421.
▲
by
Twisol
5y ago
> Except of course there is no unwrap in the actual definition while both application and return are sure to be there. The actual definition of what? `return` is not part of the Comonad class, while `unwrap` (alternatively called `extrac
422.
▲
by
Twisol
5y ago
I'm a big fan of trees and promises as more complete representatives of monads. Trees give us free monads, where `join` grafts the child tree contained in a leaf onto the parent tree; and promises are a bit more viscerally monadic, as
423.
▲
by
Twisol
5y ago
Are you familiar with promises, particularly in the JavaScript ecosystem? A Promise<A> represents a pending interaction; you'll get an A when the interaction has finished, but you don't have an A now. But even while you don&
424.
▲
by
Twisol
5y ago
The important missing context is that a monad has `(return, bind)`, while a comonad has `(extract, extend)`, and both have their own respective laws letting you reason about combinations of those operations. You can certainly do what you de
425.
▲
by
Twisol
5y ago
Strictly speaking, in an immutable world, your iterator only gives you access to the head of your collection. I think this is a fairly standard functional representation of iterable entities: next :: T a -> Maybe a rest :: T a ->
426.
▲
by
Twisol
5y ago
That looks like a... whatever the graphical analogue of a typo is. It seems they mostly reused assets from earlier in the page for that summary.
427.
▲
by
Twisol
5y ago
No, "fmap" is actually the name in Haskell given to the function defined by the Functor typeclass. It was named "fmap" ("f"unctor map) because "map" was already taken by the map specialized to lists.
428.
▲
by
Twisol
5y ago
The version in Java? Yes, because it's Java.
429.
▲
by
Twisol
5y ago
> I wonder why auto-curried function syntax has become so ubiquitous in explaining this. I think it's primarily because this is the form you use them in in a language like Haskell. Most explanations are exported from Haskell in on
430.
▲
by
Twisol
5y ago
> What about this? Is this even possible? > (T a -> b) -> T a -> T b Yep; that's the signature for the "extend" method of a comonad . https://hackage.haskell.org/package/comonad-5.0.8/
431.
▲
by
Twisol
5y ago
I would classify this as a pun, not an explanation. That said, I prefer a presentation using `times` and `join` rather than `ap` and `bind`: map :: (a -> b) -> (f a -> f b) times :: (f a, f b) -> f (a, b) join :: f
432.
▲
by
Twisol
5y ago
I'm not going to be able to explain functors and monads in one post. That's kind of what led to Brent Yorgey's famous post with burritos. [0] What I can do is try to work with somebody at the level they're prepared for,
433.
▲
by
Twisol
5y ago
> with a C/assembly background? Interesting! I normally explain monads (and functors, which they're based on) starting from generics/templates, which C doesn't even have. I wonder if it's better or worse to start
434.
▲
by
Twisol
5y ago
Apple should hire you to upsell folks who are considering the 13" -- you just converted me, too.
435.
▲
by
Twisol
5y ago
I'm not confident that's a bad thing, and I worry that we're judging languages on metrics that only make sense for startups. Does a language need to chase growth? I'm not saying Python shouldn't improve. But, if i
436.
▲
by
Twisol
5y ago
Strangely, by the end of page 23, I started to feel some relevance to software engineering as well. For example, I'm not satisfied to know that a feature is needed; I want to know why the feature is needed and how it is hoped to be u
437.
▲
by
Twisol
5y ago
Oh my gosh, their IPv6 address contains "face:b00c"... > 2a03:2880:f0fc:c:face:b00c:0:35
438.
▲
by
Twisol
5y ago
Not directly, no -- it's at least part of my own musings on logical systems. Probably the closest thing in my mind is Kuper et al.'s LVars, and I've long wanted to extend its join-semilattices to meets, but I left academia fo
439.
▲
by
Twisol
5y ago
In some sense, whenever there's a choice (or a checkpoint) between two branches, each branch should morally get its own copy of the world; and effects should only leak out when both branches incur the same observable effect. (This is m
440.
▲
by
Twisol
5y ago
> BTW in the case of speed limits: during a burst of sensible lawmaking, California set speed limits but also modulated them with the idea that people are sensible: if the speed limit on a road is set to 25, but the dominant traffic is a
441.
▲
by
Twisol
5y ago
Yes, absolutely yes!
442.
▲
by
Twisol
5y ago
My read: there is something called a "key", and keys come in various kinds. If you only know that something is a key, the author says it should be clear that you can tell if something is a sensory key based only on its content. Th
443.
▲
by
Twisol
5y ago
I think this happens in many domains. The way an expert thinks about a topic is very different from the way a novice thinks about a topic. It's not that the expert thinks in more complex ways than the novice; I'd actually argue th
444.
▲
by
Twisol
5y ago
The trouble is that, from a certain perspective, all of those terms are indeed very simple. What they are not, however, is familiar. Everything I say below will be completely useless to you, because it starts abstract and gets worse from th
445.
▲
by
Twisol
5y ago
It tolerates partitions just fine; I've been through many netsplits where folks just kept talking on our side of the split until the network healed. Partition tolerance doesn't mean partitions don't affect the system, or that
446.
▲
by
Twisol
5y ago
It depends on what you mean by "swallows values". If I have an IO<T>, I can very easily get at the T that's inside by flatMapping over it. It's true that there's no way to turn an IO<T> straight into a T
447.
▲
by
Twisol
5y ago
I have pretty much the same intuition, except I think of functors not just as containers, but as sources of T . If you have a source of Ts, you can adapt it with a function from T to S to get a source of Ss. If you want to apply a pipeline
448.
▲
by
Twisol
5y ago
Nice explanation! Minor nit toward the end: > So a monoid is also a type constructor Is it? You claimed correctly a couple paragraphs back that a functor is a type constructor F bundled with the ability to "lift" functions into
449.
▲
by
Twisol
5y ago
I agree with your overall point, but I want to dig in on this bit: > Not all functional languages have typeclasses or an alternative and convenient way to express these concepts, and in those, it's not so important to understand the
450.
▲
by
Twisol
5y ago
And I was building on yours :) I hope you didn't mind.
More ›