Type Classes for Lightweight Substructural Types
Edward Gan (Facebook), Jesse A. Tov (Northeastern University), Greg, Morrisett (Harvard University)

TL;DR
This paper introduces a lightweight substructural type system using type classes, implemented in the Clamp language, enabling polymorphic and mutable reference types with minimal overhead.
Contribution
It recasts structural rules as type classes, integrating substructural types into standard functional languages efficiently.
Findings
Supports polymorphic substructural types
Enables expressive mutable references
Maintains type safety and inference in Haskell
Abstract
Linear and substructural types are powerful tools, but adding them to standard functional programming languages often means introducing extra annotations and typing machinery. We propose a lightweight substructural type system design that recasts the structural rules of weakening and contraction as type classes; we demonstrate this design in a prototype language, Clamp. Clamp supports polymorphic substructural types as well as an expressive system of mutable references. At the same time, it adds little additional overhead to a standard Damas-Hindley-Milner type system enriched with type classes. We have established type safety for the core model and implemented a type checker with type inference in Haskell.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
