[Haskell-cafe] multiple declarations error in Haskell - should it be relaxed?

Jeffrey Brown jeffbrown.the at gmail.com
Fri Nov 28 21:09:01 UTC 2014


The problem seems to boil down to the fact that (at least in every IDE I am
aware of) the order in which the compiler reads your code is the same as
the order in which the code is displayed to you as you write it.

A general solution would be to extend the IDE to allow hyperlinks, ignored
by the compiler, from one part of the code to another. It is something one
could write in Emacs Lisp, to work across multiple languages.

On Fri, Nov 28, 2014 at 3:53 AM, Tom Ellis <
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:

> On Fri, Nov 28, 2014 at 11:44:16AM +0000, Andrew Butterfield wrote:
> > Condsider the following Haskell program (fragment):
> >
> > f 0 = “zero”
> > g 0 = “NULL”
> > f n = “non-zero”
> > g n = “PRESENT”
> >
> > This will result in two “Multiple Declaration” errors.
>
> Here's a somewhat silly answer, but it may be of help.
>
> data T = F | G
>
> fun :: T -> Int -> String
> fun F 0 = "zero"
> fun G 0 = "NULL"
> fun F n = "non-zero"
> fun G n = "PRESENT"
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141128/92455187/attachment.html>


More information about the Haskell-Cafe mailing list