HN user

presz

16 karma
Posts0
Comments15
View on HN
No posts found.

This is the same problem with cheating on tests and homework. By making getting a higher education degree mandatory for entry level jobs to be able to afford a normal life, people are incentiviced to get the degree, not the education. By tackling this particular case of students with fake disabilities, the universities will hurt people with real disabilities. Same thing with anti cheating measures that affect people that don't cheat. The root case of all this is making degrees mandatory on our society.

Use Your Type System 12 months ago

In TypeScript you can enable this by using BrandedTypes like this:

  type UserId = string & { readonly __tag: unique symbol };

In Python you can use `NewType` from the typing module:
  from typing import NewType
  from uuid import UUID

  UserId = NewType("UserId", UUID)

This is less a guide on how to do fp in Javascript, and more of a tutorial on how to implement a pure-functional-programming language in Javascript.

Javascript can do some functional programming, but it's not Haskell or OCaml. If you try to use it like that it quickly becomes a big mess and one that is not performant at all. You want to do pure, functional programming? Then write Haskell, or Elm, or Purescript.

I'm saying this as someone that loves fp, but is trying to get rid of a considerable chunk of fp-ts on a big codebase at work.

As a wise man once said, don't fight the language. Doing this deviates from Javascript semantics. It's a hack that is not actually helping people learn fp.

Also, please, don't do monads in Javascript! Monads are a solution for pure languages to deal with effects. Javascript can just do effects as it is!