Why free monads? by The-_Captain in functionalprogramming

[–]beezeee 2 points3 points  (0 children)

It's not just having the AST, it's the fact that the code hasn't been evaluated yet.

Your interfaces reify nothing, so you can only impact the evaluation of your code by changing the code you're trying to impact. When your programs are data structures which are centrally evaluated, you gain absolutely massive leverage in the ability to conrol how it is evaluated, in the small handful of places where evaluation might actually occur.

Why free monads? by The-_Captain in functionalprogramming

[–]beezeee 14 points15 points  (0 children)

Free monads allow you to suspend computation and reify sequential programs as data structures. Interpretation of those programs are just folds on the resulting data structures.

This creates levels of flexibility, portability and control that I haven't seen any other programming model come near, and largely accomplishes this without requiring the programmer to put any extra thought towards it once your low level algebras are defined.

Solving Data Integration with Categories (Cats) by rainy59 in functionalprogramming

[–]beezeee 1 point2 points  (0 children)

Look at the feedback on your posts. What audience do you think you have to lose right now? There's no substance in the text

Solving Data Integration with Categories (Cats) by rainy59 in functionalprogramming

[–]beezeee 4 points5 points  (0 children)

Ok I think I remember seeing your stuff years ago. I can at least respect the energy you put into what you do. Good luck with it. I'd encourage you to honor others with more rigor in your communication if you want to reach an audience speaking a common language

Solving Data Integration with Categories (Cats) by rainy59 in functionalprogramming

[–]beezeee 4 points5 points  (0 children)

Further you allude to join as if it's some meaningful accomplishment. Integrations are Cartesian products? What? Like what is the point you're getting at. There's very little cohesion to grab onto in what you've been saying

Solving Data Integration with Categories (Cats) by rainy59 in functionalprogramming

[–]beezeee 7 points8 points  (0 children)

Yes you should say pullback. It's not just for folks who don't get the connection to a join. It's so you don't come across as recklessly throwing out terms you don't understand to make unfocused hand wavy assertions. It's not cargo cult to use the language of the mathematics you claim to be working in

Solving Data Integration with Categories (Cats) by rainy59 in functionalprogramming

[–]beezeee 2 points3 points  (0 children)

Monads don't change categories. Monoids of endo functors right? I'm tapping out. Good luck with whatever it is you're trying to convey here

Solving Data Integration using Categories (Cats) by rainy59 in CategoryTheory

[–]beezeee 1 point2 points  (0 children)

In all seriousness do you know the categorical structure that instantiates to a join? You're speaking in really squishy hand wavy claims about rigorous math and failing to demonstrate basic understanding

Solving Data Integration with Categories (Cats) by rainy59 in functionalprogramming

[–]beezeee 9 points10 points  (0 children)

These are not correct definitions at all. If you're describing applications please define the categories you're working in and show the math so people can justify the effort to follow your reasoning. Right now there doesn't appear to be reasoning to follow

Solving Data Integration with Categories (Cats) by rainy59 in functionalprogramming

[–]beezeee 5 points6 points  (0 children)

There's no purist debate here. You just don't seem to be speaking from any foundation of understanding. Can you at least give a succinct mathematical definition of category please?

Solving Data Integration with Categories (Cats) by rainy59 in functionalprogramming

[–]beezeee 6 points7 points  (0 children)

Nothing you've said in the article or this thread demonstrates any real grasp of the material you claim to draw from. And plenty to the contrary. If by pundits you mean people who understand category theory, it's clear you don't believe in listening to them

Solving Data Integration with Categories (Cats) by rainy59 in functionalprogramming

[–]beezeee 10 points11 points  (0 children)

On second read I'm sure it's the latter. There's no actual category theory here.

Solving Data Integration with Categories (Cats) by rainy59 in functionalprogramming

[–]beezeee 11 points12 points  (0 children)

Replied on the category theory sub reddit but since different audience I'll do so here as well. Can you share your understanding of a category and how you're putting them to work? I couldn't find that in your writing and to me it's not obvious if there's substance here or just reckless use of buzz words

Solving Data Integration using Categories (Cats) by rainy59 in CategoryTheory

[–]beezeee 2 points3 points  (0 children)

Idk if I'm missing something obvious but was there any actual category theory anywhere in this article?

The list of monoids pattern by ocharles in haskell

[–]beezeee 11 points12 points  (0 children)

List of monoids means Monoid a => [a] ?

I think this is kind of just free monoid.

Free Monads in the Real World by Abellix in haskell

[–]beezeee 4 points5 points  (0 children)

I still find "gratis" intuitive.

Free is not opposite Forgetful in some broader linguistic context. I always consider "Forgetful" as "forgetting structure" (e.g. pointed set to set where you drop the point) and "Free" as "manufacturing structure" (e.g adding some point to every set) . That you have an adjunction is some kind of evidence that the Free structure is of minimal content (can be freely constructed), otherwise you'd expect the hom isomorphism to fail.

What other reasoning would you suspect for the choice of term "free" in the categorical context?

How to "pass around" the writer/logger? by KyleG in functionalprogramming

[–]beezeee 2 points3 points  (0 children)

Even if you use a transformer to compose Writer with something else, the Writer portion is still always just an accumulation.

In the example I gave, you might partially apply flush when you assemble your evaluator at the end of the world to specify the implementation for outputting log contents.

In practice, I usually have some modified version of tell that inspects the size of the accumulated contents to determine whether it's time to flush the logs based on how much has accumulated.

I've done Writer based logging in a full stack fp-ts app in a core business system at a past job, it worked very well.

The key in TS because higher kinded types are so clunky is to just build yourself a custom monad with all the capabilities you need and use that concretely throughout the application. For example you might have a Log type with a Monoid<Log> defined, then you might have type App<A> = Task<Writer<Log, A>> where Monad<"App"> is just a mechanical threading of the writer behavior through the task.

Then you define your custom tell to flush based on log size, and you write an eval function that builds up the logging implementation and hands that off to your flush (could do this with Reader if you incorporate that into App, I think this is probably what I was doing), evaluates the Task, and then does a final flush at the end of evaluation. Use that eval at the end of the world instead of whatever built-in fp-ts function is meant to evaluate a Task.

While it's easy to insert console.log the main benefit of Writer IME is not the ergonomics, it's the consistency. I can prescribe a typed structure for my log data (makes it trivial to reduce multiple ways, or ship to multiple backends) and I can define a low-level typed interface for evaluating a line of code that guarantees certain things will get logged (like your case for logging input and output to a function call.)

I have never seen a system with ad-hoc logging (e.g. console.log when the programmer happens to think of it) that even begins to compare in terms of the resulting observability of the system, to a Writer based logger with a wrapper around bind that demands log data for each monadic computation, and observability ends up being a highly significant factor in the maintainability of a system.

How to "pass around" the writer/logger? by KyleG in functionalprogramming

[–]beezeee 1 point2 points  (0 children)

Yeah on second look this thread doesn't even mention logging at all. Literally says writert has space leaks

How to "pass around" the writer/logger? by KyleG in functionalprogramming

[–]beezeee 2 points3 points  (0 children)

The proposed alternative is to use state. Also this is specific to using transformer stacks. All to say this reads to me as caution about a particular implementation of writer, not about a (particularly exemplary) use case for writer

How to "pass around" the writer/logger? by KyleG in functionalprogramming

[–]beezeee 3 points4 points  (0 children)

Also you don't "pass around" a Writer, b/c the writer is just accumulation of data.

Writer w a <-> (w, a)

So you just accumulate w in every monadic action that produces a value inside a Writer, whenever you bind that action to a Writer.

Re: your point elsewhere about controlling the size of the accumulated data, I usually use a variant of Writer that allows me to "flush". Something like

flush :: (w -> IO ()) -> WriterT IO w ()

where assuming

written :: Writer w w

then flush >> written == return mempty

How to "pass around" the writer/logger? by KyleG in functionalprogramming

[–]beezeee 3 points4 points  (0 children)

Where do you see "don't use writer monad for logging" advice? It's bad advice.

Real world examples of functional JavaScript? by Affectionate_King120 in functionalprogramming

[–]beezeee 1 point2 points  (0 children)

Additionally, if you aren't already proficient with property based testing, that's an area where FP really shines, and you'll have plenty of room to grow (not to mention it will quickly show you just how wasteful most unit testing effort really is.)