
Hello, i'm trying to wrap functions (a -> b -> ... -> z) of any arity to functions of type ([String] -> y), where list of strings replaces the typed arguments. one attempt looks like this (here written with type families, you can replace it by functional dependencies or what ever): type family Res x type instance Res x = x type instance Res (x->y) = Res y class Nary x where nary :: x -> [String] -> Res x instance Nary x where nary x [] = x instance Nary (x->y) where nary f (x:xs) = nary (f $ read x) xs i hope you can get the idea. the problem is, that you cannot distinguish type (x->y) from z, so these instances are overlapping. the odd thing is. you can get this to work, if you have a terminating type as result type (for example (IO x)). then you can work with all types (IO x), (a -> IO x), (a -> b -> IO x), ... but i don't want this delimiter IO! any ideas? greetings Philipp N. -- View this message in context: http://www.nabble.com/distinguish-functions-from-non-functions-in-a-class-in... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.