[Haskell-cafe] (SPAM 3)Re: handling NULL value in database query with Maybe (or other ...)

Michael Walker mike at barrucadu.co.uk
Tue Dec 18 19:06:34 UTC 2018

On Tue, 18 Dec 2018 at 15:34, Damien Mattei <mattei at oca.eu> wrote:
> ok well i do not want to open a discussion here, but i do not see any
> benefit in Haskell using Nothing and Just compared to other language,
> it's the same than if i had written in C something like :
> if (x == NULL)
>    printf("NULL\n");
> else
>    printf("%s",*x);
> i expected more from Haskell...

Well, you have to remember to do that in C, but in Haskell the
compiler won't let you use a "Maybe a" as an "a".  They're totally
different things.

That seems a pretty huge benefit to me, even ignoring everything else.
What more could you want?

Michael Walker (http://www.barrucadu.co.uk)

More information about the Haskell-Cafe mailing list