News for hackers. Stuff that matters.
Re:Linear types make performance more predictable by dllthomas on Wednesday March 15, 2017 @02:01AM (#13874125)
It's also worth noting that there are conventions around type variable names. If you see an `m`, it's probably a Monad; if you see an `s`, it's probably a stream or a struct or state; `i` is likely being indexed over; the code probably doesn't care what `a` is - the surrounding code can pick it freely. If you need another, advance to the next letter (`b`, `c`, less often `n`, `o`).

Of course, Edward Kmett had a story about winding up with his code telling him `i m a s t a b u`...

Re:Linear types make performance more predictable by mrkgnao on Wednesday March 15, 2017 @08:27AM (#13875594)
f for a functor is also very common, as is k for "continuations", very generally speaking (I think this is a borrowing from Lisps?): one often sees monadic bind defined as

    m >>= k = ...
In a somewhat more esoteric vein, I love the use of w for comonads: the rationale is apparently that it looks like an upside-down m.

> Of course, Edward Kmett had a story about winding up with his code telling him `i m a s t a b u`...

Is that an indexed lens ... parameterized over a monadic type? I'd like a link to the video/article.

Re:Linear types make performance more predictable by dllthomas on Wednesday March 15, 2017 @10:53AM (#13876494)
Certainly `f` for functor. `k` is more for values than types (you usually know a continuation is some kind of (->)) but they'll often return `r`.

> I love the use of w for comonads: the rationale is apparently that it looks like an upside-down m.

That's my understanding, yeah.

> Is that an indexed lens ... parameterized over a monadic type?

Presumably further parameterized by the focus, the source structure, the target structure, the focus again, the transformed focus, and some third structure.

> I'd like a link to the video/article.

Me too :-P I see a couple references in a google search but I'm not sure where I first heard it.