Linear types for Haskell in the style of Linear/Non-Linear logic.
This iteration of the code accompanies a paper presented at the Haskell Symposium 2017: "The Linearity Monad"
This project uses stack to provide a reproducible build system. To build the
project, make sure to install stack, and then run stack setup
to install the
correct version of ghc and necessary packages in isolation. Next, run stack build
to compile the project or stack ghci
to load the project in ghci
.
LNLHask.cabal
: cabal file, lists dependenciesstack.yaml
: stack configuration file, lists ghci version and extra dependenciessrc
: Haskell source codesrc/Prelim.hs
: preliminary data about type-level natural numbers, booleans, and listssrc/Types.hs
: linear typessrc/Classes.hs
: type classes corresponding to the predicates about contextssrc/Interface.hs
: interface to linear terms using type classessrc/DeepEmbedding.hs
: implementation of language as a deep embeddingsrc/ShallowEmbedding.hs
: implementation of language as a shallow embeddingsrc/examples/
: implementation of domain-specific languagessrc/examples/Array.hs
: implementation of mutable functional arrayssrc/examples/FileHandles.hs
: implementation of functional file handlessrc/examples/LinTrans.hs
: linear algebra library for quantum computing examplesrc/examples/Quantum.hs
: implementation of the quantum lambda calculussrc/examples/Sessions.hs
: implementation of session typessrc/examples/ByteString.hs
: preliminary (work in progress) implementation ofByteString
s
TODO for efficiency
X change representation of ECtx X LANGUAGE StrictData -- make data structures strict, as long as I don't construct any infinite data strucures X more radical: turn on Strict extension
- change VPlus back to VLeft and VRight as strict
- small speedup: replace proxy by type application X idea: implement Ctx as IntMap (exists σ. LVal sig σ)
- dynamically switch between concurrent and single-threaded join implementation
- check out different array implementations---Repa, Vector X make Range strict - or look for "interval trie" data structures
- quickcheck automatically using template haskell prop_
- unboxed types--not in IO monad or anything