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

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to