Re: Multiple imports on a single line
2017-02-01 22:39 GMT+01:00 Vassil Ognyanov Keremidchiev: > Yes, but it could be a bit more denser without so much repetition of > "import", like: > > import Data.Text, qualified Data.Map as M, qualified Vector as V hiding > (Vector) > > i.e. the same as current situation, but allow for multiple imports for the > same word "import" comma separated. What do you think? The difference in > syntax is not so much different, than just allowing commas. > I think this is worse than separate imports, each on a separate line. The Python people have even put something like this into a PEP: https://www.python.org/dev/peps/pep-0008/#imports This is for a very good reason: The one-liners have very few visual hints for the reader to comprehend it quickly. So even if Haskell allowed this comma-separated chain of imports, code containing it probably wouldn't survive a code review in most companies, where maintainability is the prime goal. I often see a confusion between greater expresiveness (good goal) and having to type less (largely irrelevant goal). By all means make the module system more expressive, but try to avoid "clever" things for convenience. ___ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
Re: Multiple imports on a single line
Yes, but it could be a bit more denser without so much repetition of "import", like: import Data.Text, qualified Data.Map as M, qualified Vector as V hiding (Vector) i.e. the same as current situation, but allow for multiple imports for the same word "import" comma separated. What do you think? The difference in syntax is not so much different, than just allowing commas. 2017-02-01 23:23 GMT+02:00 Malcolm Wallace: > You can already write this, with only a tiny bit of syntax: > > module MyApp where > import Data.Text; import Data.Foldable; import Control.Concurrent > > Whether it is good style is another matter, but all compilers will > certainly accept it. > > Regards, > Malcolm > > > On 1 Feb 2017, at 14:18, Vassil Ognyanov Keremidchiev wrote: > > Hello! > > What do you think about an idea to have multiple imports on a single line, > like: > > module MyApp where > import Data.Text, Data.Foldable, Control.Concurrent > ... > > > That way we could write more concise and short code as Haskell promises. > This will be useful for small programs like scripts, small tools, > tutorials, examples, etc. > > Best regards, > Vassil Keremidchiev > ___ > Haskell-prime mailing list > Haskell-prime@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime > > > ___ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
Re: Multiple imports on a single line
You can already write this, with only a tiny bit of syntax: module MyApp where import Data.Text; import Data.Foldable; import Control.Concurrent Whether it is good style is another matter, but all compilers will certainly accept it. Regards, Malcolm On 1 Feb 2017, at 14:18, Vassil Ognyanov Keremidchiev wrote: > Hello! > > What do you think about an idea to have multiple imports on a single line, > like: > > module MyApp where > import Data.Text, Data.Foldable, Control.Concurrent > ... > > That way we could write more concise and short code as Haskell promises. This > will be useful for small programs like scripts, small tools, tutorials, > examples, etc. > > Best regards, > Vassil Keremidchiev > ___ > Haskell-prime mailing list > Haskell-prime@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime ___ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
Aw: Re: Multiple imports on a single line
I like this idea. How about some more syntactic sugar? {-# LANGUAGE ImportSugar #-} import [Data.[Text, Foldable q-as F, Vector (Vector), Vector q-as V hiding (Vector)], Control.Concurrent, Data.List q (sum)] - tree structure, one import per leaf - prefix qualified -> postfix q - qualified/as -> q-as or q as or q/as or qas > Gesendet: Mittwoch, 01. Februar 2017 um 16:34 Uhr > Von: "Francesco Ariis"> An: haskell-prime@haskell.org > Betreff: Re: Multiple imports on a single line > > On Wed, Feb 01, 2017 at 04:18:13PM +0200, Vassil Ognyanov Keremidchiev wrote: > > Hello! > > > > What do you think about an idea to have multiple imports on a single line, > > like: > > > > module MyApp where > > import Data.Text, Data.Foldable, Control.Concurrent > > ... > > Hello Vassil, > how would qualified/as work? > Would import statement like this: > > import Data.Text, qualified Data.Foldable as F, Control.Concurrent > > be allowed? > > ___ > Haskell-prime mailing list > Haskell-prime@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime > ___ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
Re: Multiple imports on a single line
likewise, why not use semicolon? per se we already can do mulitple lines on a single line via semicolon :) On Wed, Feb 1, 2017 at 10:34 AM, Francesco Ariiswrote: > On Wed, Feb 01, 2017 at 04:18:13PM +0200, Vassil Ognyanov Keremidchiev > wrote: > > Hello! > > > > What do you think about an idea to have multiple imports on a single > line, > > like: > > > > module MyApp where > > import Data.Text, Data.Foldable, Control.Concurrent > > ... > > Hello Vassil, > how would qualified/as work? > Would import statement like this: > > import Data.Text, qualified Data.Foldable as F, Control.Concurrent > > be allowed? > > ___ > Haskell-prime mailing list > Haskell-prime@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime > ___ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
Re: Multiple imports on a single line
On Wed, Feb 01, 2017 at 04:18:13PM +0200, Vassil Ognyanov Keremidchiev wrote: > Hello! > > What do you think about an idea to have multiple imports on a single line, > like: > > module MyApp where > import Data.Text, Data.Foldable, Control.Concurrent > ... Hello Vassil, how would qualified/as work? Would import statement like this: import Data.Text, qualified Data.Foldable as F, Control.Concurrent be allowed? ___ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
Multiple imports on a single line
Hello! What do you think about an idea to have multiple imports on a single line, like: module MyApp where import Data.Text, Data.Foldable, Control.Concurrent ... That way we could write more concise and short code as Haskell promises. This will be useful for small programs like scripts, small tools, tutorials, examples, etc. Best regards, Vassil Keremidchiev ___ Haskell-prime mailing list Haskell-prime@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime