[Haskell-beginners] [Haskell-Beginners] Just
KC
kc1956 at gmail.com
Tue Jun 14 17:29:57 CEST 2011
"Just" is a context adder to a pure value; so now the value can exist
or be "Nothing".
data Maybe a = Just a | Nothing
The Maybe data type is an instance of monad to implement its behaviour.
Without the Maybe type one would have to use the output value of a
function to signal an error; e.g. -1; so the Maybe type makes code a
lot cleaner.
On Tue, Jun 14, 2011 at 8:00 AM, John Sampson <jrs.idx at ntlworld.com> wrote:
> What does the word "Just" mean in Haskell code? What is its purpose?
>
> Regards
>
> _John Sampson_
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
--
--
Regards,
KC
More information about the Beginners
mailing list