[Haskell-cafe] Imports at bottom, why not?

Magnus Therning magnus at therning.org
Tue Apr 22 18:31:22 UTC 2014


On Tue, Apr 22, 2014 at 03:18:44PM -0300, Thiago Negri wrote:
> The desired editor features are written in the haskell spec?
> I'm talking about the language in an editor/IDE agnostic way.
> If the IDE/editor is hiding it for you, it is because the language failed
> to be good enough to be "out of the way".
> So, I guess this is a +1.

Yay for top posting!

Well, collapsing (or folding) is a language agnostic way of hiding
away anything you like.  Do consider that what you want to hide
changes with the task at hand.

/M

> 2014-04-22 15:04 GMT-03:00 Ben Foppa <benjamin.foppa at gmail.com>:
> 
> > Why not have an editor that collapses them?
> >
> >
> > On Tue, Apr 22, 2014 at 1:59 PM, Thiago Negri <evohunz at gmail.com> wrote:
> >
> >> When reading code, I find it quite distracting to have to get past the
> >> import list to reach the actual module code, as the import list can be (and
> >> often is) quite big.
> >>
> >> So, why not issue import statements at the bottom of a module file?
> >>
> >> Likewise, we can use "where" statements to define names used in a
> >> function after using them, so they don't distract the reader.
> >>
> >> I'm against imports at the middle of the file.
> >> But I guess being able to issue them at the end of the module could make
> >> sense if you want to get the reader straight to the code.
> >>
> >> A language pragma could be used to select between top imports or bottom
> >> imports (can't use both).
> >>
> >> What do you think?
> >>
> >> Example:
> >>
> >> """
> >> {-# LANGUAGE LateImports #-}
> >> module Foo where
> >>
> >> bar :: String
> >> bar = "quux"
> >>
> >> baz :: Fiz
> >> baz = mkFiz
> >>
> >> import Fiz (Fiz, mkFiz)
> >> """
> >>
> >>
> >> _______________________________________________
> >> Haskell-Cafe mailing list
> >> Haskell-Cafe at haskell.org
> >> http://www.haskell.org/mailman/listinfo/haskell-cafe
> >>
> >>
> >

> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4 
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus

The results point out the fragility of programmer expertise: advanced
programmers have strong expectations about what programs should look like,
and when those expectations are violated--in seemingly innocuous
ways--their performance drops drastically.
     -- Elliot Soloway and Kate Ehrlich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140422/47d56feb/attachment.sig>


More information about the Haskell-Cafe mailing list