Matthew Brecknell wrote: > Bertram Felgenhauer: > > How does > > > > class F a where > > data B a :: * > > data E a :: * > > wrap :: B a -> E a > > unwrap :: E a -> B a > > > > sound? 'B a' would represent the 'b' in your previous attempt, > > > > class F a b | a -> b where > > ... > > > > I'm with Simon in thinking that this code is suspicious.
It wasn't my code Simon was replying to. > For any given call to "wrap" or "unwrap", how is the compiler supposed > to determine which instance to use, given that "a" cannot be uniquely > determined from the type of the function? As far as my limited understanding goes this should work, because we are using an associated *data* type here. This means we can't have instances saying 'type B a = Int', we have to use either a newtype or a data declaration for that. As a side effect, the compiler can determine 'a' from 'B a'. This wouldn't be possible for associated type synonyms, but those aren't completely implemented yet anyway (again, as far as I know). Bertram _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe