tag:blogger.com,1999:blog-7094652.post546527167012739511..comments2024-03-23T14:36:09.980+00:00Comments on Neil Mitchell's Blog (Haskell etc): Writing code by typesNeil Mitchellhttp://www.blogger.com/profile/13084722756124486154noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7094652.post-67066870988692164272007-02-01T15:28:00.000+00:002007-02-01T15:28:00.000+00:00I've hacked the emacs haskell-mode a bit to give m...I've hacked the emacs haskell-mode a bit to give more support for quick type lookup / display / insertion and jumping around definitions. I definitely work like this sometimes, leaving "undefined" stubs around to fill in as it becomes clear. haskell-mode really can do a lot more than it is currently though, maybe sometime I'll get around to it.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7094652.post-55671903701936552007-02-01T14:21:00.000+00:002007-02-01T14:21:00.000+00:00Rank-2 types are mostly useful when you need to pr...Rank-2 types are mostly useful when you need to prove certain things about a program.<br /><br />For example, both the foldr/build and destroy/unfoldr optimizations and runST would be dangerously incorrect if you could apply them to functions with non-polymorphic types. But thanks to the rank-2 types in the signatures of build, destroy and runST, this is impossible.<br /><br />All a rank-2 type says, in essence, is that "this argument must be a genuinely polymorphic function". This corresponds to the notion of a "natural transformation" in category theory, i.e., a mapping which doesn't know anything about the types it manipulates, and which therefore can't go poking around inside them.<br /><br />Wadler's "free theorems" paper (useful when optimizing) also relies on the same guarantees.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7094652.post-63451540003459156002007-02-01T10:58:00.000+00:002007-02-01T10:58:00.000+00:00Thomas: The Epigram editor is based on Emacs, so i...Thomas: The Epigram editor is based on Emacs, so it can be done.<br /><br />Jim: I was writing an abstraction/alternative to Data.Generics which doesn't use rank-2 types, and giving an implementation in terms of gfoldl because it has native compiler support. I see it as <i>removing</i> some rank-2 types from a conceptually useful API.Neil Mitchellhttps://www.blogger.com/profile/13084722756124486154noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-84812237921220065692007-02-01T10:19:00.000+00:002007-02-01T10:19:00.000+00:00Thomas, take a look at Shim, a project to integra...Thomas, take a look at Shim, a project to integrate the ghc-api in an Emacs mode based on Slime:<br />http://shim.haskellco.de/trac/shimPepe Iborrahttps://www.blogger.com/profile/18294801014514561748noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-61714023206733203632007-02-01T03:51:00.000+00:002007-02-01T03:51:00.000+00:00On 1/3/07, Neil Mitchell <ndmitchell@gmail.com&...On 1/3/07, Neil Mitchell <ndmitchell@gmail.com> wrote:<br /><br />As for beginner issues with rank-2 types, I've been learning Haskell for years now, and have never felt the need for a rank-2 type. If the interface for some feature requires rank-2 types I'd call that an abstraction leak in most cases.<br />--------------------------------<br />A change of heart? :-)Jim Applehttps://www.blogger.com/profile/11080395413026172939noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-30016471883335413122007-01-31T22:02:00.000+00:002007-01-31T22:02:00.000+00:00I've been thinking about similar tool-support. I ...I've been thinking about similar tool-support. I wonder how Visual Haskell is doing with this kind of stuff. Since, I use Emacs and have no intention to use any Windows machine at all in the near future, that doesn't play a major role, either. Hacking this into the Emacs Haskell mode would be a huge effort, too, so I guess we'll just have to wait for The Haskell Editor (Yi or Qi or something ..)Thomas Schillinghttps://www.blogger.com/profile/04274984206279511399noreply@blogger.com