Can the compiler handle linear state for us? Yes, by teaching linear logic to type class constraints. Written up in an #ICFP 2021 submission by Jean-Philippe Bernardy, @RaeHaskell, @Lowert, @aspiwack, and @nicolasgwu (3/5)
https://t.co/HEOoiJyivw
@mpeytonjones@tweagio The main issue with implicit params is that you have to name them, such as "?x". If you want to use them to represent an "open file" capability for example, then maybe you call this capability "?open". But now you can't have multiple open files, as their tokens' name would clash!
Linear types in Haskell, research phase 2: https://t.co/iczbH0vO9X. This time we're focusing on much improved developer experience. Linear type class constraints are the secret sauce.
@mattoflambda Great trick!
With the next version of GHC (9 I think?) it will also be possible to write:
gross :: forall {k} (a :: k) b. C a b => b -> String
@taylorfausak@googleson78 Ah. That's because you don't have PolyKinds turned on in your ghci session, so the kinds get defaulted to Type. Try `:set -XPolyKinds` first!