3 ms·
From https://gitlab.haskell.org/ghc/ghc/-/wikis/linear-types https://gitlab.haskell.org/ghc/ghc/-/wikis/linear-types : "The centrepiece of our design is to avo
by pgustafs 6y ago
From https://gitlab.haskell.org/ghc/ghc/-/wikis/linear-types https://gitlab.haskell.org/ghc/ghc/-/wikis/linear-types :
"The centrepiece of our design is to avoid code duplication. Crucially, the same types can be used in linear and non-linear contexts. For example, the linear-base library uses the same types as base. So libraries developed with linear-base will be compatible with libraries developed with base."
- tuukkah 6y agoWhy can't base and linear-base be the same implementation too?
- nimih 6y agoThe proposal discusses this briefly[1]. The idea seems to be that datatypes themselves remain identical (constructors being linear by default, even with -XNoLinearTypes), but functions are allowed to have more precise signatures. edit: I'm not knowledgeable enough about this stuff to know if the idea is to just refine the type signature but keep implementations identical, or whether implementations themselves need to change. [1] https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0111-linear-types.rst#base https://github.com/ghc-proposals/ghc-proposals/blob/master/p...
- tuukkah 6y agoThanks for the pointer! Emphasis mine: "Because linear functions only strengthen the contract of unrestricted functions, a number of functions of base can get a more precise type. However, for pedagogical reasons, to prevent linear types from interfering with newcomers' understanding of the Prelude, this proposal does not modify base. Instead, we expect that users will publish new libraries on Hackage including more precisely typed base functions. One such library has already started here."
- srtjstjsj 6y agoPrelude needs to change its name to Pedagogue. It's drifting ever farther from how people use the language to solve real problems.