
28 Dec
2010
28 Dec
'10
2:32 p.m.
Maybe something like this would work for you (requires the TypeFamilies extension). class FromMaybe a where type Maybe' a fromMaybe :: a -> Maybe' a -> a instance FromMaybe Int where type Maybe' Int = Maybe Int fromMaybe = Data.Maybe.fromMaybe instance FromMaybe String where type Maybe' String = Maybe String fromMaybe = Data.Maybe.fromMaybe instance (FromMaybe a, FromMaybe b) => FromMaybe (a, b) where type Maybe' (a, b) = (Maybe' a, Maybe' b) fromMaybe (x, y) (a, b) = (fromMaybe x a, fromMaybe y b) - Jake McArthur