norswap

aka Nicolas Laurent

  • Home
  • About
  • Site Map
  • 🔗 Github
  • 🔗 Twitter
  • RSS Feed
  • ✉️ Blog as Newsletter
  • I'm dropping a little library called "okayfail" implementing a Result<Value, Error> type for TypeScript. (Like the Rust Result type, or the NeverThrow TypeScript library.)

    My favorite feature is the ability to do checked/typed exceptions via generators:

    declare const numberResult: Result<number, Error>
          declare function fNumberResult(): Result<number, string>
          declare const shouldSum: boolean
          
          const foo: () => Result<number, Error | string> =
             fresult(function *() {
                 const v1 = yield* numberResult
                 // v1 is type `number`
                 // if the result fails, foo returns it immediately
                 const v2 = yield* fNumberResult()
                 // same            
                 return shouldSum ? v1 + v2 : okay(v1 - v2)
                 // can return either values or results,
                 // or a mix (the value types must match!)
             })
          

    Check out the code & docs here.

    30 Jun 2026
  • How TypeScript infers type variables 03 Jun 2026
  • How TypeScript distributes unions 31 May 2026
  • I have a wallet to sell you 01 Dec 2025
  • Lockonomics 22 Oct 2025
  • This blog has been rather less active than it should have been.

    I, however, have been busy, working at Optimism on Bedrock and Cannon.

    A lot of the action has instead been on my Twitter. See in particular this thread collecting the biggest hits.

    For discoverability and archival purpose, I've ported some of these tweet threads on the block, backdated to the original date. Here they are:

    • ZK Rollups vs Optimistic Rollups
    • How Cannon Works
    • Design of the $DJED Stablecoin
    • Velodrome and why it's a superior system for incentivizing liquidity
    • AMM Meditations 🍃
    25 Oct 2022
  • Optimism Bedrock vs Arbitrum Nitro 02 Oct 2022
  • AMM Meditations 🍃 16 Jul 2022
  • Velodrome and why it's a superior system for incentivizing liquidity 07 Jun 2022
  • Design of the $DJED Stablecoin 16 May 2022
  • How Cannon Works 11 Mar 2022
  • Olympus DAO: An Economic Analysis 28 Feb 2022
  • ZK Rollups vs Optimistic Rollups 18 Feb 2022
  • Olympus DAO from Primary Sources 15 Feb 2022
  • The Essence of Blockchains 11 Dec 2021
Previous | Next