I am just wondering whether we would want to add the following to `MarshalError': -- wrap the result into a `Maybe' type (EXPORTED) -- -- * the predicate determines when the result is considered to be non-existing, -- ie, it is represented by `Nothing' -- -- * the second argument allows to map a result wrapped into `Just' to some -- other domain -- nothingIf :: (a -> Bool) -> (a -> b) -> a -> Maybe b nothingIf p f x = if p x then Nothing else Just $ f x -- instance for special casing null pointers (EXPORTED) -- nothingIfNull :: (Ptr a -> b) -> Ptr a -> Maybe b nothingIfNull = nothingIf (== nullPtr) These are the `Maybe' counterparts of the exception routines in MarshalError. This style of using `Maybe' for handling special return values isn't covered by the `Maybe'-related routines in `MarshalUtils'. Cheers, Manuel
Sun, 04 Feb 2001 17:15:16 +1100, Manuel M. T. Chakravarty <chak@cse.unsw.edu.au> pisze:
I am just wondering whether we would want to add the following to `MarshalError':
Maybe throwIf should be changed to failIf? The same function would work for both IO and Maybe. -- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTÊPCZA QRCZAK
participants (2)
-
Manuel M. T. Chakravarty -
qrczak@knm.org.pl