This is pretty close to type branding (newtype wrapping for the Haskell-inclined), though using template literal types is pretty novel. Normal brands look something like this:
type Brand<BaseType, Brand> = BaseType & { readonly __brand__: Brand };
type FooId = Brand<string, 'FooId'>;
function fooBar(asdf: FooId | 'foobar'): void { }
fooBar will only accept the literal string 'foobar' or a true FooId, but not any arbitrary string. FooId would then come from a function that validates strings as FooIds, or some other part of the app that is an authoritative source for them. Brands extend their BaseType so they can be used anywhere their BaseType is used, but not the inverse
Using a private shared symbol your authoritative validation/sources can share your brand symbol and no one else can create one without using your validation. Private symbol brands in this way become the closest Typescript gets to "nominal types".
Unfortunately this doesn’t work, at least not from a type safety perspective, because even without access to the symbol, nothing stops anyone from doing `let myFooId = 'foo' as any as FooId;`. You could detect this at runtime, but type safety is compile time.
Agreed, for instance in our codebase we just make all type assertions a lint error demanding a justification, as well as flat out banning the any type. But anyone is free to write shoddy TypeScript.
Right, hence "closest to" in my description. Typescript's role ends at compile time and it can't/won't stop bad actors at runtime. Typescript tries to make it easier for good actors to do the right thing more of the time.
That said, the other benefit to using private symbols like this is that they are also easy to enforce at runtime, because symbol visibility is enforced at runtime (you can't create the same signal by hand somewhere else). It can be as easy as something like:
console.assert(id.__brand__ === FooIdBrand)
(That still won't stop the determined hacker in the console dev tools, if they can see a symbol they can create a reference to it, defense in depth will always be a thing.)
It is also convenient to use a unique symbol for the brand (declare const brand: unique symbol). Then we can combine multiple brands in the same type and if we don't export that symbol type, we simply dont have a way to access the brand property at runtime.
The meaning is different though. Brands convey intent, UserId brand would allow only other UserId brands, but with string literal types "any" type that matches 'user_${string}' will do
In my experience branded types are relatively more fragile than normal types though. IIRC they badly behaved with infer types in particular, and it was quite hard to work around. This solution seems more versatile. (Of course, I want to see a built-in branded type support in TS as well.)
This solution only works with strings, whereas branded types can be used with numbers as well, or any kind of object that you want to add stricter types to without modifying the runtime value.
I haven't observed any issues with branded types and infer—is there documentation somewhere about the problem?
As others pointed out, TypeScript sometimes reasons `string & object` or similar as an impossible type and can turn it into `never` at any time. I don't exactly recall whether `infer` triggered that or it was a separate issue, but that was a major problem in my experience.
It opens up a huge toolbox of tools that work with Functors and Applicative to make parsing easier, and proves that using those tools will work predictably.
I believe that would be covariant: `'home' | 'work'` is a subtype of `string`, and `Record<'home' | 'work', number>` is assignable to `Record<string, number>` so the subtype relationship is preserved.
I think you were originally correct and that `Record<string, number>` was not a good example. I would guess that union literals and primitives are handled differently by the compiler in this case, perhaps because a record with keys of every possible string is impossible it may have a special condition to skip some typing rules. In fact, `Record<number, number>` is assignable to `Record<string, number>`.
I had read this article more as a "from-first-principles" example, but it's a good note for people who might be unfamiliar with practical Haskell. Using an effects system also promotes the domain DSL from an initial-tagless language (only the interpreter is extensible) to a tagless-final language (both the language and the interpreter are extensible).
It may be worth noting that effectful, polysemy, and the other "new kids" of effects systems are not the only option: record-of-functions, mtl, and type-class effects aren't cutting edge, but they're a little more approachable from an OOP dependency injection pattern.
I can attest to this and took all of my notes on paper in college. However, once I started a real job I realized that this strategy doesn't scale to all situations. In college, I needed to be able to recall all of the information I had ingested: it was low-write, high-read. In the workplace, there's much more information, but I'm unlikely to need most of it: it's high-write, low-read. I need to be able to reference the information, but not necessarily recall it. Taking paper notes became too much of a burden and I moved to a wiki of markdown notes.
I came to the same conclusion, however, here’s how I handle that:
I carry around a folder with just a bunch of printer paper, and some index cards in it. I write my todo lists on an index card because it’s intentionally small so I can’t overload it, and it feels good to cross out the last thing and just throw it away.
I take notes through the day on the printer paper, and then I review them frequently and type up what I want to preserve in Notion (recently switched from WorkFlowy, as much as I love outlines, I need free form writing options too).
Anything I don’t type up, I just throw away.
Benefits:
Super cheap
Intentionally not opinionated, just pen and paper.
If I need to think about a hard problem, I can lay out all of my notes on a flat surface. I think spatially, this is so valuable and not possible with notebooks or even software (miro kinda)
I started this about a month ago and it’s going great so far. And this is coming from w notebook and note taking software snob.
I actually distinctly prefer not having lines on my paper, because my notes are typically big outlines and drawings and diagrams.
I am planning on coming up with a few different paper templates that I can easily print when I need it (I have a cheap $100 brother laser b&w printer that works perfectly and cheaply for this purpose).
i found a little orange notebook for sale at an obscure place many years ago. honestly, it's changed my life.
well, at any rate, to make a short story long, since i like orange, have no concept of the value of a dollar, and, have every intention of perhaps someday using at least a few of the methodically-growing collection of various notepads i, for <insert totally legitimate and intentional reason here>, possess, i purchased this particular notepad.
to paint a better picture of that day, which occurred oh so long ago, i will provide only the important, totally accurate and truthful details.
the setting, if you will. mid-morning, early-fall. it's probably a Saturday. the temperature calls for a light-jacket as the over-cast sky emits it's mixture of sunshine amongst the calming grey-blue cover of moisture-laden clouds.
walking toward an outdoor vendor's booth as the vendor stands proudly behind his u-shaped arrangement of cloth-covered display tables. these tables contain an assortment of hand-drawn bookmarks and sketches, along with, let's say, some reading materials, like magazines and a few books, both the hard-backed and paper-backed variety. also present are different combinations of bound-together materials, which are probably notebooks or notepads. each one has a different size, shape, thickness, and design.
perusing through places like this, a crucial, well-practiced defense strategy is used.
keeping an over-all casual demeanor and adhering to a strict no-eye-contact rule, this unknown vendor's booth is approached while a series of covert glances toward the wares on display are quickly performed. initially, a not-my-tempo or no-way-jose kind of vibe was formed. in order to bide some time, most likely, a few easy-to-decipher, interest-grabbing ganders towards a direction away from this particular merchant occurred.
a decision still not made, the tried-and-true apathetic nod-of-head, where two-to-three down-up movements as you plan to callously stroll past this offending concessionaire, was kept in mind and ready to be performed.
however, between a fanned-out stack of various flower-print 9x11's and a neatly organized array of light to dark shaded faux-leather bound 5x8.5s, basically hiding in plain sight, an innocuous orange item is spotted. a feeling arises. it's obviously camouflaged, no doubt, at least to any passer by lacking dignity, style, or taste.
getting closer, the item comes into clear view. with a palette of orange, white, and brown, it forms a perfect rectangle, concisely contained within it's own precision cut, sharp, rigid edges.
it's immediately obvious that this pad's particular conglomeration of bound materials was, in fact, nothing of the ordinary variety.
picking up the item, an aptly heft weight matches it's precedent set by observing the sturdy outer covering.
flipping it over, a sense of superior craftsmanship is given off. flipping back over to open the front cover, a set of accurately aligned factory-creases are noticed. opening the pad, the ability to fold it's front cover backwards over it's self is realized. gripping the pad, the cover stays out of the way, neatly positioned behind the pad's heftier, solid cardboard, backside.
it's clear that writing and/or carrying while open is made comfortable and easy.
noticing the thick, special paper inside the pad, you get goosebumps.
the vendor then states that it's imported from France.
money is thrown at the vendor and the notepad, in all it's glory, has a new owner, as immediately, there is love for what is formally known as the "Rhodia No 12 Pad".
the vendor states he has more notepads with different styles and sizes. they all get purchased. they all get loved. over time, a special life-long bond with a brand is formed.
the end.
so, yeah, i mean, Rhodia pads are pretty cool. btw, i am just an idiot. i have no affiliation with Rhodia pads. i merely wanted to spread the word about a well-made "life-changing" product.
oh. also. grid paper note pads kick ass. so does graph paper. i actually like graph paper better. don't tell my grid pads that, though.
Rhodia notebooks are great. Also check out Rite in the Rain. As a lefty I don't care for spiral-bound anything, but I use a pocket-size Rite in the Rain in the gym to track my exercise goals & results.
Ah, I see. I love the template idea. I had to look this up just now, but do you mean copy paper? Apparently copy paper is typically a bit thinner and not as bright white. I think my problem may be that I was originally picturing high-end, color quality paper.
I like very lightly printed graph paper. Very pale blue at 5 lines per inch.
I can ignore the lines for free hand, but they provide nice guidance for more structured drawings.
Cheap filler note paper is a source of difficulty when writing(ball pens will skip, dark inks will bleed, scratchy pencils and nibs will tear). The index cards work, but I would also go for the slightly more expensive paper brands one can find on JetPens. If you're going for a stationary experience, investing a little more in it goes a long way.
I like use a 5.5 x 8.5 or 9 x 12 Strathmore 300 Sketch tablet for notes. They are sturdy and the paper is quite good. They are a pain if you want to scan/copy them as the paper is either smaller or larger than standard letter size.
Yes I also use sketch pads with no lines (The grey spiral-bound ones sold by WHSmith in the UK). I don't understand the attraction of lines given that software is hard to describe without diagrams.
And longevity. I have my note books from 20 years ago on the same shelf as my notebooks from last year. Apart from pictures (I had a digital camera in the mid nineties) The number of files that have survived the transition between a dozen computers is not that high.
That's actually the only real downside to this system currently, I'm just using a cheap flimsy folder that can't really be used to write on without being on a surface itself. I'd like something a bit more firm, but that isn't big and bulky. Still on the hunt.
I still do it and it has worked for me from being an individual contributor, to leading a team, to leading a part of the org that has a tree of ~50 people across multiple contexts.
The way I see it, if you know the best way to retain information, why would you stop using it. I note down almost everything during meetings, 1-1s, agile rituals, etc. Very rarely I move things to a computer, most things I just need to write down even if I never read them again, others I re-read, others are to-dos. No organization, just a flow of braindump, and lots of little drawings everywhere and arrows connecting things and so on. If you'd read it you'd not understand anything, both because the handwriting is atrocious and because there's practically no structure.
> if you know the best way to retain information, why would you stop using it.
Because I can type something like 10x as fast as I can write by hand (I'm both extremely fast at typing and fairly slow at writing), but the recall benefit is not 10x.
I can recall anything I hear or see well enough that I'm not looking at double-digit multiples of effectiveness for any method over nothing, much less between methods.
The sheer volume of things I can take down typing with 9 fingers on a keyboard vs. writing with one pen outweighs any day-to-day advantage of how much better I would be able to recall the few things I would have the time to write down.
Likewise. Same reasons, same process, and I've found it just as helpful in middle management as I did when I was an individual contributor.
There's an additional benefit. This is the reason I started doing it in the first place: many years ago, as a junior engineer, I was obliged to spend long hours in daily meetings. I found that the only way I could avoid actually falling asleep was to take detailed, copious notes. It was only afterwards that I discovered I was retaining information better and forming a big-picture view of the work. Also, what took me another decade to discover, is that nice stationery -- which for me means a fountain pen and a good notebook -- can make this a positive pleasure.
> if you know the best way to retain information, why would you stop using it.
I wonder that myself. Earlier in my career, when the internet wasn't so great, we had to rely on textual communication for everything. This left the ideal 'paper' trail to look back on for reference. Everything well communicated, everything perfectly retained. It was unbelievably efficient.
Now that the technology has improved, easily transmitting voice and even video, there is a curious push in that direction. Communication quality has declined dramatically as you now have to suffer through a bumbling stream of consciousness instead of words someone put effort into writing, which adds significantly more human time involvement to get a point across, and once spoken the information is automatically lost save even more human best effort to retain what can and never perfectly so.
I likely shiny newfangled tech as much as the next guy, but there's a time and a place. Why we stopped using what worked best boggles the mind.
Thats a great way to put it, "high-write, low-read". I take a lot of notes and screenshots on calls, I may never need to go back and look but when I do look its always there. I use Onenote and the search is excellent in conjunction to the structure and tags I have build up around it. What works great is I have setup autohotkey to take a screenshot in the same area as the previous screenshot and insert it on my onenote page in context by hitting the F12 key. For me being visual with my notes is better than writing them.
Ctrl+win+s screenshots to clipboard in Win10. Ctrl+shift+z screenshots to OneNote (though an update overwrote it at one point, not sure if it's fixed in general).
You can use OneNote settings to determine how that capture is used, eg placing in the current page (I have it set to make a new page, but I almost exclusively capture to clipboard).
It's come to the point almost the opposite is the case: I actively try not to remember most information but try to make sure it's registered somewhere as plain text so that I can find it easily should I need it. People are surprised I can answer them so quickly when they ask about some trifle from last year - but it's only because I managed to register it (e.g. by refusing to proceed on the basis of an oral request and asking them to write an email instead).
Moreover, I choose what to remember very carefully as it's something that also influences my personality.
Notes were a kind of write only memory for me - I rarely referred to them, preferring the textbook or other resources, but I still wrote them because it's supposed to help retention.
I'm the same way. I discovered that taking notes was a fairly effective way to make sure I actually thoroughly read the material and that I don't just lapse into skimming the book. Not sure how important doing them in handwriting was, but it felt more useful.
Yes! these read/write, and reference/recall ratios are good measures of how we should do things. the article case is only valid for a certain range.
Maybe, for you, a system like mem.ai [1] is another step forward beyond the burdens of markdown wiki (for certain high-write/low-read use cases at least)
1- You "write" new information without each time asking yourself: where to put a new page in the hierarchy? what to name it? maybe I should include this into an existing page? which one? No. You just write "memos" (and maybe tag them).
2- Then, you are able to "reference" them without even recalling the exact keyword you used: You just ask a natural language question.
I found just the opposite in college. For me it was high write, low read, concerning my own notes. The only value to taking notes for me was the active nature of writing helped pin the information in my head. Other than assignment and test dates, which were just bullet lists, I rarely looked back at my notes.
I think that was the sole value of doing homework assignments and term papers. Going through the act of working out a problem, or researching then writing about a topic, is what reinforced the learning for me.
I keep a text document for things like code snippets but I still find paper notes helpful when I have meetings or just to keep track of what I’m trying to do as I work.
I also use Obsidian, and paired with a handwriting keyboard for Apple Pencil support (e.g. mazec; Apple's built-in scribble feature is too finnicky), it's been my Goldilocks note-taking method for the past few months.
I don't host it, per-se: I use VimWiki, and occasionally Obsidian for the pretty graph. VimWiki even has a static site generator, but I use Pandoc for that. For search I use FZF and ripgrep.
not OP (and biased) but I'm building https://acreom.com to do this and to support my own dev workflow. Made it into a product after realising other devs like it too.
very true, in my experience it's been hard to keep up by hand and much faster to type, but like handwritten notes i rarely reference meeting or project notes so i put little effort into organization. i settled on using onenote and different tabs for different teams
At work we have a search field, sure, but I've never encountered a successful search in our Confluence. It's all browser bookmarks and "can someone tell me where x is?" in Teams channels.
Our Confluence guru still swears to God that Confluence used to have search problems, but now it's perfect. Fortunately, Atlassian has made us move with their stupid "you can't host on premises, would you like to pay tenfold" move.
a notebook is a great column oriented database for when you cannot bring technology with you. I don't think there is any useful scenario for one otherwise
this. I write when I'm reviewing training material from a paid course and going to be testing for a cert, but I rarely write as part of my day-to-day work.
After the Federal Reserve adds money to the economy, they usually want to take some of it back out. They take money out either by selling bonds or through taxes. The goal of removing money from the economy is sometimes to control inflation, but it's debated whether "printing money" actually affects inflation.
The fed "printed" a shitton of money during Covid, dismissed all inflation concerns, and now, two years later, we're facing record inflation. I'd say there is a good chance that it does in fact affect inflation
Happy to see an article or w/e from you in 2020 correctly predicting the actual inflation and when it was going to occur. Saying everytime the fed does something that it'll cause inflation and then waiting years to say "Ha told you so!" is not impressive and not even p-hacking since you don't even have a p variable.
What's the argument that it doesn't affect inflation? If the feds printed infinity dollars, surely each dollar would become less as it approached infinity? Otherwise, we should just do that and give everyone money?
Are you implying that it's impossible to draw such a conclusions from particular events such as those of 2020? Or that an increase in the size of money supply does not promote price inflation, all else equal?
Don't think there is much credible evidence or opinion regarding the latter.
The empirical evidence that money supply increases don't necessarily cause infaltion is https://fred.stlouisfed.org/series/M2SL from 2009 to 2019. Money supply doubled and inflation was non-existent. Obviously this is an incredibly complex topic, but there was at least some reason to believe inflation wouldn't be as high as it has been. There are also many reasons beside money supply inflation for the rise in price inflation.
The key phrase is of course "all else equal". A lot was going on in that decade that could (and is) argued to have been an opposing deflationary force. Worldwide demographics and productivity improvements, in particular. (On a separate note, much of that is or will be slowing/reversing in the coming years.)
To argue that an increase in money supply wouldn't lead to price inflation (again, all else equal) implies that the difference would just be hoarded indefinitely rather than used to buy anything, which seems unlikely just on the face of it.
I'm just arguing against this general idea that "increase in money supply doesn't cause price inflation". Which doesn't even really make sense because prices are measured in units of money. But the further implication, that Fed policy has no impact on prices, is just wrong to me and reflects some kind of misunderstanding.
> Are you implying that it's impossible to draw such a conclusions from particular events such as those of 2020?
That's not my claim at all. In fact I've invited the person to link me to their article explaining their analysis of 2020 and why it would lead to inflation in 2022. My point is strictly that people always claim that X is going to cause inflation and then just wait until inflation occurs to say "Aha, X does cause inflation" while doing 0 analysis to show that it was X as opposed to literally any other reason.
Agreed, but that's not really relevant to the discussion.
> My point is strictly that people always claim that X is going to cause inflation and then just wait until inflation occurs to say "Aha, X does cause inflation" while doing 0 analysis to show that it was X as opposed to literally any other reason.
But we are talking about the money supply. Prices are measured in units of money. You are suggesting that there is not a reason to think that changes in the size of the money supply influence price inflation. That makes no sense. Unless that additional money is just being systematically hoarded which seems unlikely in the long run.
Put another way, a mismatch between the money supply and the demand for money (for use as a medium of exchange) is essentially what price inflation is, almost by definition. So whatever the underlying "cause" of inflation, it's also always fair to say that the money supply was or became too large to keep it in check.
I'm not sure how that graph convinced you of anything, it looks mostly like two random lines. Would be much nicer if there was some equation that correlated the two.
It does look like there are only 3 scenarios ('74, '80, '22) of a spike in m2 preceding a spike in inflation. But the m2 spike in '22 is so much larger (~2x) than '74 and '80 and the inflation spike is so much less (~0.7x) so the correlation of those variables based on those 3 samples seems poor.
But there's also '61, '67, '83, '01, '09, '11 where there was solid m2 growth or a spike and no inflation.
Is there any evidence the other way? I know, proving a negative, but I’d argue the null hypothesis here is “pumping money into the economy causes the economy to have more money”
But it should be possible for the fed to react to states opening, paycheck protection infusions, unemployment boosts, and stimulus checks.
Imo, once us states began reopening the fed should have carefully moderated their equity and qe buys maybe even selling positions they opened in April 2020 as early as July 2020. Combine that with vaccine timing around May 2021 where a single 50bps change could have eased in.
the subtext here, after they kept insisting that inflation is transitory and that we are not in a recession/soft landing messaging, is that they dont want to be seen as tightening into a downturn
In Europe we did not print (that much) money and still got inflation.
In fact, the countries that use the same euro currently posted different inflation rates. In your economic model we should have evenly distributed inflation.
> the countries that use the same euro currently posted different inflation rates.
this is expected.
> In your economic model we should have evenly distributed inflation.
no one expects inflation to occur uniformly. its well understood that one of the prime distortionary factors that result from money printing is that the price level does not adjust uniformly, but responds to where the money is spent. This is bad for inequality because typically the newly printed dollars are preferentially routed to politically connected client groups who then use these new (unearned) funds to purchase assets at prices that have not had time to adjust to the increased money supply.
How do taxes cause money to exit the economy? The government spends every cent it takes in from taxes (and some more): what happens is just redistribution.
So (e.g.) it takes taxes from overpaid SV software engineers and makes Social Security payments, buys missiles from Lockheed Martin, pays interest on debt, etc.
No; the Federal Reserve has essentially complete control over the monetary base.
I see this argument made assuming that REST service creators are not aware of L3 REST but the fact that it never caught on is at least some proof of its ill-fitness to the general problem. Nowadays we have many more options that do what L3 REST tries to do (OData, GraphQL, etc) and most APIs at least conform to L2 REST. This is a classic case of friction between design intention and actual user experience: there was a push-door with a handle, and users aren't using the handle, they're just pushing it.
It's good for IoT and automation because it's fundamentally a framework for discrete functional reactive programming. It could be good for any context where you need to tie together a bunch of events from different contexts that all depend on each other to drive some other behavior. You can design design nodes and flows that minimize state and keep it local.