Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • Could someone compare this to ST in Idris?
  • Maybe I am missing something but where is the entire source code?
  • Hi everyone! I am one of the authors (Falk), so feel free to ask me questions :)
  • Types increases particular types of correctness. There are more types of correctness.

    Our apps are built on what we call features. Our own in house database Dip participates in the correctness enforcement exercise.

    We built what we call an architecture compiler arcc which is a glorified linter (intentionally underselling) but enforces CQRS violations and other architectural violations at compile time.

    Query features cannot invoke Command features by construction. Queries cannot even invoke a Dip insert/update/remove().

    Our tooling now ensures all CRUD Dip.insert/update/query/remove() now accepts and returns appropriate schema types. It also ensures all Features.invoke() also accepts and returns appropriate handler types. arcc also enforces that a feature cannot even do Dip CRUD on an alien collection/table other than the feature leaf's owned collection.

    Pushing this further we are increasingly approaching a state where entire implementations compress to literal names of features and nothing else.

    The endgame is blank src/ for a massive ERP backend.

    Note: zero ai in code. Pure architecture.

  • I use Typestates and Newtypes extensively. The metric that shows Typestate and Newtypes are beneficial is: How many method calls or parameters can be called / used that compile but are not valid use cases. You want to minimise this number. I love having a type state where I can only make 1 or 2 method calls because the state enforces there are only a few parsing / validation / transition methods available. And there is only one valid way to supply the parameters, I cannot use the strings in the wrong location. I only wish we had named parameters like ObjC.
  • This was a talk at the FUNARCH workshop at this year’s ICFP.

    Here’s the livestream: https://www.youtube.com/live/c0pw1iVs_Q0?is=hwm2xa4cZOcqF5tW

    Well post the individual talks in the following days!

  • Types are puzzles. A good Rustacean will make sure that the pieces fit to make the picture.

    That's why in crates where I need to make sure certain functions are called in order, I use a Ticket<T>, where one function returns a Ticket<Func1Done> with the output and the other has to consume it as an input.

    The typestate pattern is a specialization of making only valid states representable

Explore Birbla archives