[Haskell-cafe] A question about functional dependencies

alpheccar misc at alpheccar.org
Sun Dec 23 13:00:08 EST 2007


I have defined a function on types thanks to functional dependencies.

I use it like that:

myFunction :: (TypeFunction MyComplexType f) => f -> f

f is unique for MyComplexType. Is there a way to name f ?

I would like to write:

myFunction :: SimplifiedType -> SimplifiedType

where

TypeFunction MyComplexType SimplifiedType is an instance of the class  
TypeFunction.

Of course, I don't want to write explicitly SimplifiedType otherwise  
I could just do

type SimplifiedType = ...

The idea is that I build a MyComplexType using type synonyms and type  
constructors. But, the result has a shape which is too complex. I  
simplify it into a canonical form that I can use in some algorithms  
at the type level.

I suspect I will have to use the type constraint and that there is no  
way to name the result of a computation at the type level ?

Thanks,
Christophe.





More information about the Haskell-Cafe mailing list