Matthew Sackman wrote:
Andres Loeh <[EMAIL PROTECTED]> wrote:
class OneStep a
    data OS a :: *
instance OneStep (Cons v t)
    data OS (Cons v t) = t

class TwoStep a
    data TS a :: *
instance (OneStep a, OneStep b) => TwoStep a
instance (OneStep a, OneStep (OS a)) => TwoStep a
?

Doesn't seem to work. Ok, my original was wrong as I had no constructor
on the associated type. So below are 2 versions, one with fundeps, which
works, one with associated type synonynms which doesn't work, which
made me remember the warnings about how type synonynms aren't fully
implemented yet, and so I wrote a third version with indexed types, but
whilst I can make it work, wrapping up values in indexed types gets
really really messy.

Yes, it's messy with indexed data families as they force you to introduce all these new constructors and the corresponding wrapping and unwrapping code. As Tom wrote in another message in this thread, you really do want to use indexed synonyms families (aka associated type synonyms) here. They will do what you want. We are currently working on completing the implementation of
synonym families.[1]

Manuel

[1] For those who wonder why this is taking so long, we are working on a system
    that is actually significantly more general than what we described in the
    ICFP05 paper.  In particular, we want synonym families to play nice with
    GADTs.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to