Fergus Henderson <[EMAIL PROTECTED]> writes on 1 Jun 2000 


>> 'n' :: Char  does not hold a name in the constructor name space.

> Yes, but it is also far from self-expanatory.  With a constructor
> name, in a suitable environment you could just click on the
> constructor name and the environment would immediately pop up the
> declaration and documentation for that constructor and the type that
> it belongs to. 
> [..]

>> [..] 
>>   data Mode_sort = Sort_quick | Sort_merge | Sort_insert | Sort_other 
>>                    deriving(Eq,Ord,Enum,Show,Read)
>>   ...
>> Again, `Positive' would not do, it should be something like  
>> QuotRem_Positive, and so on.


> This is a problem with Haskell, IMHO.
>
> Mercury allows overloading of constructor names, so in Mercury you
> could use just `Positive' rather than `QuotRem_Positive'.  The type
> checker will resolve the ambiguity whenever possible. 


This is my wish for Haskell-2:  overloded constructor names.

In many cases, these name overlaps can be resolved. 


>>              f x y b = myRem 'c' ((myRem '_' x b)*(myRem '_' y b)) b
>> 
>> Now, it has to be, maybe,   remP  = rem QuotRem_positive
>>                             remO  = rem QuotRem_other
>>                             f x y = remP ((remO x b)*(remO x b)) b
>> Maybe,  Char  is better?

> No, IMHO Char would definitely not be better.
> In this case, I think separate functions would be best,
> a single function with a properly typed mode argument second best,
> and a single function with a `Char' mode argument worst.


About the type constructor for mode, I half-agree.
But about a single function - no.
If you require the single functions
                     sort_merge, sort_insert, sort_quick,
do you also require
                     tar_x, tar_xv, tar_v   instead of   tar <mode>
?
As to  quotRem - diveRem,  it has the three extra friends to export.


------------------
Sergey Mechveliani
[EMAIL PROTECTED]




Reply via email to