[Haskell-cafe] Renaming constructors for readability

Dougal Stanton ithika at gmail.com
Tue Nov 13 17:50:41 EST 2007

On 13/11/2007, Henning Thielemann <lemming at henning-thielemann.de> wrote:
> On Tue, 13 Nov 2007, Dougal Stanton wrote:
> > -- int a = 3;
> > -- int *pa = &a;
> > ampersand :: t -> Pointer t
> > ampersand a = Just a
> What's bad about using 'ampersand' function as replacement for the
> constructor 'Just'?

I also wanted to use it in pattern matching but have the advantage of
all the stuff already written for Maybe. (Note this was an example I
made up on the spur of the moment anyway.) I'd often thought it would
be nice when adapting standard data structures for specific programs.

data Tree a = Leaf a | Branch a [Tree a]
data FS a = File a | Folder a [FS a]

Once you've got one it would be nice to repurpose it with more
appropriate names. Just an idea! :-)

Dougal Stanton
dougal at dougalstanton.net // http://www.dougalstanton.net

More information about the Haskell-Cafe mailing list