Portability | portable (Haskell2010) |
---|---|
Stability | provisional |
Maintainer | julian.fleischer@fu-berlin.de |
Safe Haskell | None |
Every java methods returns in priniciple either Nothing or Just a value. This is quite cumbersome to work with. This module contains utility functions for working with Maybe values in the java monad.
This module offers the orphan instance (!)
instance JavaObject a => JavaObject (Maybe a)
This instance allows you to apply toString
and the like
without unwrapping a Maybe
value.
Note that the asObject
function provided by this instance
is undefined (since null
is not an object). This is also the
reason why this instance is not included in Foreign.Java by
default. Invoking it will call error NullPointerException
.
In other words: This fine module will bring back all the joy of
Java you might miss in Haskell :-)
toString
will return null
for Nothing
.
hashCode
will return 0
for Nothing
.
classOf
will return the class for java.lang.Void
on Nothing
,
as this is a class for which there gare no object instances. This is
only a stopgap and slightly incorrect, as null is not an object,
and does therefor not have a class.