1 -- !!! One method class from Sergey Mechveliani
2 -- showed up problematic newtype dict rep.
6 class MBConvertible a b where cm :: a -> b -> Maybe b
8 c :: MBConvertible a b => a -> b -> b
12 _ -> error "c a b failed"
15 instance MBConvertible Int Int where cm a _ = Just a
17 instance (MBConvertible a b,Integral b) => MBConvertible a (Ratio b)
19 cm a f = case cm a (numerator f) of Just a' -> Just (a'%1)
22 main = let f = 1%1 :: Ratio Int