Live data from Hacker News

Ask HN: What are you learning?

news.ycombinator.com

901–906 of 906 posts

Re: Ask HN: What are you learning?

#901
post #884

Earlier quoted context omitted.

This statement that you made—about side effects requiring monads—do you know a proof for that? I come from the other side, Milewski's book is to me "Functional Programming for Category Theorists".

Nope, no proofs :) Formalizing questions like this is one reason why I'm interested in category theory, so I don't think I have the tools to dig into this right now. But... "side effect" literally maens it doesn't show up in a normal input/output function signature, and in a pure functional language like Haskell, there are no side effects. Monads are a particular way of explicitly capturing side effects as a "separat…

Does this mean that you use a monad instead of a function?

Re: Ask HN: What are you learning?

#902
post #605

Earlier quoted context omitted.

Hey! Mine ( https://docxmanager.com ) is similar but for Microsoft Word on Windows :)

Super cool! That looks professional. I have a landing page up for people interested in the idea and want updates - https://simpleblog.io/

Great! I wish you will be success with your project.

Re: Ask HN: What are you learning?

#903
post #884

Earlier quoted context omitted.

Nope, no proofs :) Formalizing questions like this is one reason why I'm interested in category theory, so I don't think I have the tools to dig into this right now. But... "side effect" literally maens it doesn't show up in a normal input/output function signature, and in a pure functional language like Haskell, there are no side effects. Monads are a particular way of explicitly capturing side effects as a "separat…

Does this mean that you use a monad instead of a function?

First, a clarification: when looking at a monadic action `f : A -> T(B)`, the monad here is just `T`. The action itself is still just a function. The monad `T` lets you add some extra structure onto your usual output type in a principled way.

That being said, it's true that I'm using `T` itself in a function-like way. Category theory does blur the lines between the two ideas: monads are "functors" with some extra structure, and functors are ("just") functions between categories that preserve categorical structure. But it's critical to notice here (and it's apparent from the type `f : A -> T(B)`) that `T` is not the same kind of function that `f` is. `f` lets you move from one type to another, by mapping each value in one to a value of another. `T` lets you move from a whole category to another category, by mapping each object/type in one to an object/type of another, and mapping each arrow/function in one to an arrow/function of another.

In other words, monads occur at the type level, whereas functions occur at the value level [1]. That means that, colloquially, you can't just use a monad "instead of" a function, any more than you can use "Integer" instead of "42". But as I alluded to above, monads over partial orders are closure operators, and we can often model the evolution of data over time as a partial order. So in that domain, monads literally are functions, and the "side effect" of a closure operator is mutably updating a cell by moving its contents up in the order.

If you model the evolution of data as a partial order, you can indeed obtain monads that more closely resemble normal functions. But a partial order is just a particular kind of category, so even here we've built a separate little domain over which our monad exists. (Of course, functors are all about crossing those domains in principled ways.)

[1] That's why it's not "IO ()" or "Maybe Int" that are monads; it's "IO" and "Maybe" themselves, which are well-behaved functions from types to types.

Re: Ask HN: What are you learning?

#904
post #24

Clojure! I played around with common lisp a bit a some months ago, though I basically used none of the lisp specific features like macros. After reading a few blog posts on functional programming and "the lisp way" I have decided to buy a book on Clojure. My end goal (for now) is to build a basic website with a backend.

what book are you working through?

Re: Ask HN: What are you learning?

#905
At Miracle, Digital Marketing and Transformation Agency in Hong Kong, we help our clients improve digital services to make them simple, clear and fast. We help our client transform, create and improve their product in a digital way such as branding, web & app design, e-commerce solution, Digital Marketing strategy, Virtual Reality (VR) and Augmented Reality(AR), SEO. We are experts in their fields and enjoy challenging work. We work together to share knowledge and build our capability to improve user experiences. This helps us work smarter and more effectively. We are confident, capable and committed. We nurture curiosity and encourage our people to keep learning. We have flexible work arrangements and a supportive environment. We help our people balance their whole life and be the best version of themselves. https://www.miracles.com.hk/

Re: Ask HN: What are you learning?

#906
post #884

Earlier quoted context omitted.

Nope, no proofs :) Formalizing questions like this is one reason why I'm interested in category theory, so I don't think I have the tools to dig into this right now. But... "side effect" literally maens it doesn't show up in a normal input/output function signature, and in a pure functional language like Haskell, there are no side effects. Monads are a particular way of explicitly capturing side effects as a "separat…

Does this mean that you use a monad instead of a function?

I quite belatedly realized that you come from Category Theory, so most of my sibling reply is probably old news to you. Sorry!

The most charitable response would be "yes", but it really depends on how you model your domain. Most instances of monads in software are at the type level, not at the value level, and "function" doesn't usually make sense at the type level.

The example I gave of a monad over posets does arise in the semantics of logic programming, but I haven't seen explicit recognition of monads in that area. Not that I've looked that hard, yet.

Post reply on HN