4 ms·
Incredible work, congrats, the evolution of GHC is quite impressive. A better description of what linear types can be useful for is at https://www.tweag.io/blog
by greg7mdp 6y ago
Incredible work, congrats, the evolution of GHC is quite impressive. A better description of what linear types can be useful for is at https://www.tweag.io/blog/2017-03-13-linear-types/ https://www.tweag.io/blog/2017-03-13-linear-types/.
- whateveracct 6y ago-XLinearTypes down, -XDependentTypes to go :)
- guerrilla 6y agoOnce that happens, the world will change :)
- QuinnWilton 6y agoWadler might argue that linear types being merged changed the world! http://www.cs.ioc.ee/ewscs/2010/mycroft/linear-2up.pdf http://www.cs.ioc.ee/ewscs/2010/mycroft/linear-2up.pdf
- nine_k 6y agoHaskell still has sort of a way to emulate dependent types in many practical cases, without a ton of work or a huge performance hit [1]. Direct support could be nice, though. [1]: http://okmij.org/ftp/Computation/lightweight-static-guarantees.html http://okmij.org/ftp/Computation/lightweight-static-guarante...
- mboes 6y agoTweag is onto that too. :) See https://www.reddit.com/r/haskell/comments/gtnayl/whats_the_status_on_dependent_types_in_ghc_as_of/ https://www.reddit.com/r/haskell/comments/gtnayl/whats_the_s... for a recent update.
- _bxg1 6y ago> the linear arrow says this: a function that has type A⊸BA⊸B is a function that has an AA available to compute with, but it can only use it once. Not twice, not zero times: just once. Superficially this sounds a lot like Rust's FnOnce. Is there a relation there? Edit: Actually it sounds like linear functions are more about using their arguments once, internally, as opposed to themselves being called once. So perhaps not. Still would appreciate any further commentary by someone with a better grasp on things than I have.
- archgoon 6y agoLinear types are stronger than FnOnce, in that a linear type must be used _exactly_ once. Rust doesn't enforce that if you pass in a function of type FnOnce that it is called.
- weavie 6y agoThats interesting. I don't quite understand how that would work. So can you work around that requirement by just going: if false then <use my type> else <do my things> Technically it is used exactly once, but really it will never be used..
- comex 6y agoThat wouldn't work, because the value must be used in all possible control paths. In this case, both the 'then' and 'else' branch would have to use the value.