I wrote a generic type to type converter in Haskell using classes as follows:
{-# LANGUAGE FlexibleInstances #-}
class Convertable a where
convert::a
instance Convertable (Int -> String) where
convert = show
instance Convertable (String -> Int) where
convert = read
main = do
let result = ((+1) . convert :: String -> Int) "1"
print result
But I need the explicit type String -> Int
in order to get it to work (which kind of negates the purpose of having a generic type converter....)
Why would this type declaration be needed at all, there is just one possibility that satisfies the types?