RE: [Haskell-cafe] RFE: Extensible algebraic user-defined data types?

2005-04-29 Thread Simon Peyton-Jones
| Regarding reusing constructor names across several datatypes: is it | possible to qualify them with their enclosing datatype name, like | Maybe.Nothing where there is a name conflict? Then I might reuse | Nothing in my hypothetical data type, and it would be NEither.Nothing | if conflicting with

RE: [Haskell-cafe] RFE: Extensible algebraic user-defined data types?

2005-04-29 Thread Simon Peyton-Jones
| Suppose I want to extend this datatype to the one including | possibility of neither Left or Right (i. e. None). Currently I have to | use Maybe Either, so my options are: | | Just (Left a) | Just (Right b) | Nothing | | If I could extend the Either datatype I might have (syntax may be |

Re: [Haskell-cafe] RFE: Extensible algebraic user-defined data types?

2005-04-29 Thread Keean Schupke
David Menendez wrote: The downside is that a function that might normally be typed Either A B - C now will have the type: (HTypeIndexed l, HTypeProxied l, HOccurs (Proxy (Left A)) l, HOccurs (Proxy (Right B)) l) = TIC l - C But it will accept a TIC (HEither A B) and a TIC

RE: [Haskell-cafe] RFE: Extensible algebraic user-defined data types?

2005-04-29 Thread Philippa Cowderoy
On Fri, 29 Apr 2005, Simon Peyton-Jones wrote: 2. Use sub-typing, so that a value (Left x) is *both* in type Either and in type NEither. This opens a very large and complicated design space, as Ben mentioned. I've been playing with this design space for a while and think there's at least one

Re: [Haskell-cafe] RFE: Extensible algebraic user-defined data types?

2005-04-29 Thread Jacques Carette
Philippa Cowderoy [EMAIL PROTECTED] wrote: On Fri, 29 Apr 2005, Simon Peyton-Jones wrote: 2. Use sub-typing, so that a value (Left x) is *both* in type Either and in type NEither. This opens a very large and complicated design space, as Ben mentioned. I've been playing with this design space

[Haskell-cafe] RFE: Extensible algebraic user-defined data types?

2005-04-28 Thread Dimitry Golubovsky
Hi, Is it possible to have such a feature in the future versions of the Haskell language? For example, there is an Either datatype which is Left a| Right b. Suppose I want to extend this datatype to the one including possibility of neither Left or Right (i. e. None). Currently I have to use

Re: [Haskell-cafe] RFE: Extensible algebraic user-defined data types?

2005-04-28 Thread David Menendez
Benjamin Franksen writes: On Thursday 28 April 2005 16:48, Dimitry Golubovsky wrote: PS Or is there a similar feature in the language already? Not one I know of. The type-indexed co-products from Appendix C of the HList paper[1] are along those lines, but probably not convenient enough for