[Haskell] Annoying naming clashes

Tom Pledger tpledger at ihug.co.nz
Fri Jun 11 22:27:25 EDT 2004


Ben.Yu at combined.com wrote:

>Hi, when writing haskell code. It is so annoying that name clashes keep
>happening.
>
>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!
>

Hi.

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)

Regards,
Tom




More information about the Haskell mailing list