5 comments

  • vatsachak2 hours ago
    Types are puzzles. A good Rustacean will make sure that the pieces fit to make the picture.<p>That&#x27;s why in crates where I need to make sure certain functions are called in order, I use a Ticket&lt;T&gt;, where one function returns a Ticket&lt;Func1Done&gt; with the output and the other has to consume it as an input.<p>The typestate pattern is a specialization of making only valid states representable
    • binary13220 minutes ago
      why not just create a wrapper type for the payload that is returned by func1 and func2 takes it as a parameter?
    • LtdJorge1 hour ago
      One of my favorite useful patterns
  • arpinum1 hour ago
    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 &#x2F; 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 &#x2F; validation &#x2F; 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.
  • doyougnu53 minutes ago
    This was a talk at the FUNARCH workshop at this year’s ICFP.<p>Here’s the livestream: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;live&#x2F;c0pw1iVs_Q0?is=hwm2xa4cZOcqF5tW" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;live&#x2F;c0pw1iVs_Q0?is=hwm2xa4cZOcqF5tW</a><p>Well post the individual talks in the following days!
  • michaelnoguera3 hours ago
    pdf: <a href="https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;pdf&#x2F;10.1145&#x2F;3830438.3830958" rel="nofollow">https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;pdf&#x2F;10.1145&#x2F;3830438.3830958</a>
  • sourdecor42 minutes ago
    Could someone compare this to ST in Idris?