[Haskell] Annoying naming clashes

Ben.Yu at combined.com Ben.Yu at combined.com
Mon Jun 14 11:06:30 EDT 2004

Then what will you do when naming operations in a class? Is it right that
care has to be taken in order not to conflict with other classes?

Say, I have a Person class where I want to define an operation "getName".
Is it wise to name it "getPersonName" instead?

I notice that FiniteMap always names operations and functions xxxFM,
although that looks ugly to me. Is that a general good thing to do when
naming operations?


                      Tom Pledger                                                                                                      
                      <tpledger at ihug.co        To:       Ben.Yu at combined.com                                                           
                      .nz>                     cc:       haskell at haskell.org                                                           
                      Sent by:                 Subject:  Re: [Haskell] Annoying naming clashes                                         
                      haskell-bounces at h                                                                                                
                      06/11/2004 09:27                                                                                                 

Ben.Yu at combined.com wrote:

>Hi, when writing haskell code. It is so annoying that name clashes keep
>I have to be careful about the data constructor names, about the class
>names, about the class member names.
>As a novice haskell programmer, I might be missing something here though.
>If somebody can kindly give me some instruction of how to work with names,
>appreicate it a lot!


Try using small modules and qualified names.

    module Illumination where
    data Illumination = Dark | Light

    module Weight where
    data Weight = Heavy | Light

    module UseBoth where
    import Illumination
    import Weight
    easyToCarry = (Illumination.Light, Weight.Light)


Haskell mailing list
Haskell at haskell.org

This message is intended only for the addressee and may contain information
that is confidential or privileged. Unauthorized use is strictly prohibited
and may be unlawful. If you are not the intended recipient, or the person
responsible for delivering to the intended recipient, you should not read,
copy, disclose or otherwise use this message, except for the purpose of
delivery to the addressee. If you have received this email in error, please
delete and advise us immediately.

More information about the Haskell mailing list