[Haskell-cafe] data constructor names

2013-06-22 Thread Brian Lewis
Say you write
data Callback = Error ... | ...
because one of the kinds of callbacks you need to model is an error
callback.

Then, later, you write
data Error = ...
to model some error that can happen.

They're both good names, but there's a conflict. So I started thinking I
should prefix my constructor names like
data Callback = CallbackError ... | ...
It will work, but it's not the nicest looking.

I discovered I can write
data Callback = Callback'Error ... | ...
Where can I find the syntax reference to see what's allowed? Will people
kill me if I start doing this?

I could import qualified, but in my case, there would be too many
modules.

Thanks for any advice.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] data constructor names

2013-06-22 Thread Suzuki Tomohiro
I found syntax reference here.

http://www.haskell.org/onlinereport/syntax-iso.html


consym-(: {symbol | :})reservedop

symbol-ascSymbol | uniSymbolspecial | _ | : |  | '
constrs-constr1 | ... | constrn(n=1)



Regards,
Tomo

On Saturday, June 22, 2013, Brian Lewis wrote:

 Say you write
 data Callback = Error ... | ...
 because one of the kinds of callbacks you need to model is an error
 callback.

 Then, later, you write
 data Error = ...
 to model some error that can happen.

 They're both good names, but there's a conflict. So I started thinking I
 should prefix my constructor names like
 data Callback = CallbackError ... | ...
 It will work, but it's not the nicest looking.

 I discovered I can write
 data Callback = Callback'Error ... | ...
 Where can I find the syntax reference to see what's allowed? Will people
 kill me if I start doing this?

 I could import qualified, but in my case, there would be too many
 modules.

 Thanks for any advice.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org javascript:;
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] data constructor names

2013-06-22 Thread Tom Ellis
On Sat, Jun 22, 2013 at 04:26:14AM -0500, Brian Lewis wrote:
 Say you write
 data Callback = Error ... | ...
[...]
 
 Then, later, you write
 data Error = ...
[...]
 
 They're both good names, but there's a conflict.

What do you mean by a conflict?  That's fine as far as the compiler is
concerned because constructors live in a different namespace from types.

If you meant it will be too confusing for the programmer that's fair enough.

Tom

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] data constructor names

2013-06-22 Thread Tobias Dammers
On Sat, Jun 22, 2013 at 12:15:07PM +0100, Tom Ellis wrote:
 On Sat, Jun 22, 2013 at 04:26:14AM -0500, Brian Lewis wrote:
  Say you write
  data Callback = Error ... | ...
 [...]
  
  Then, later, you write
  data Error = ...
 [...]
  
  They're both good names, but there's a conflict.
 
 What do you mean by a conflict?  That's fine as far as the compiler is
 concerned because constructors live in a different namespace from types.
 

I think he meant something like:

data Callback = Error Error | Success

data Error = Error String

...in which case there is a clash for the identifier Error at the
value level.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe