[Haskell-cafe] Qualified import syntax badly designed (?)

Neil Mitchell ndmitchell at gmail.com
Wed Jul 9 06:14:07 EDT 2008


Hi

> Just to say that I also like this design. A minor point would be; do we
>  really need the parentheses and commas? or could we not just use
>  indentation (I think this about module imports in general).

Yes, then you could just uses {a;b} to get the list which is actually
a newline list. I think this would be even better for module
declarations.

For example, in the module I'm currently working on:

module Hoogle.DataBase.TypeSearch.Graph(
    Graph, newGraph,
    GraphResult(..), ArgPos, Binding,
    graphSearch
    ) where

I dislike the fact that ,'s come after every line but the last - it
lacks consistency, and often requires 1 more line of diff when adding
somethign (add comma to previous line, and add the line). I would
rather write:

module Hoogle.DataBase.TypeSearch.Graph{
    Graph; newGraph
    GraphResult(..); ArgPos; Binding
    graphSearch
    } where

However, I think the new syntax for modules, and the new type of
declarations for modules, are separate issues.

>  Also I wouldn't mind 'as' for the names which are imported which would
>  be a bit of a work around for the debate as to whether I should design
>  my modules for qualified import or not. Suppose I make a 'NewList'
>  module and use the default names then someone could do:
>  import Data.NewList
>   unqualified map  as nlMap
>               find as nlFind
>               lookup as nlLookup

I believe old versions of Haskell had this, and it was considered too
confusing. Consider:

import Prelude unqualified (+) as (-)

Also people reading the code will find it easier to know N =
Data.NewList (one mapping), than three mappings as you have.

Thanks

Neil


More information about the Haskell-Cafe mailing list