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

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Fri Nov 28 11:53:35 UTC 2014


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"


More information about the Haskell-Cafe mailing list