
Hi all, A while ago I made an unusual visual front-end for Haskell: http://www.youtube.com/watch?v=5KtFlGEVFGE https://github.com/yaxu/texture It applies functions that are both proximal in Euclidean space, and type-compatible. It 'compiles' to Haskell, piped into ghci, but I (probably unwisely) wrote it in C, and ended up having to implement some crazed version of the Haskell type system there to get it working. Now I have idea for making this more interesting and practical (for live music-making, if nothing else), and would like to re-write it all in Haskell. Testing type compatibility of expressions is foxing me though. For example, say I have (++) and [1,2,3]. I then want to see if a value of type (Num a => [a]) can be applied to a function of type ([a] -> [a] -> [a]). I've been looking at Data.Typeable.funResultTy to do this, e.g.: funResultTy (typeOf ((++) :: [a] -> [a] -> [a])) (typeOf ([1,2,3] :: Num a => [a])) But I get this: Ambiguous type variable `a0' in the constraint: (Typeable a0) arising from a use of `typeOf' Being a bit more specific doesn't help: funResultTy (typeOf ((++) :: Typeable a => [a] -> [a] -> [a])) (typeOf ([1,2,3] :: (Typeable a, Num a) => [a])) I guess funResultTy doesn't work when polymorphism is involved.. Perhaps I could just use the ghc-as-a-library stuff to parse and typecheck code - would that be the way forward? Any pointers much appreciated! Best wishes alex -- http://yaxu.org/