class Listy a b where
fromList :: [b] -> a
toList :: a -> [b]
lifted :: ([b] -> [b]) -> (a -> a)
lifted f = fromList . f . toList
data MyString = MyString { getString :: String } deriving Show
instance Listy MyString Char where
toList = getString
fromList = MyString
现在我需要编写例如 lifted (reverse::(String -> String)) (MyString "Foobar")
的代码。有什么技巧可以避免需要类型签名吗?