
Apologies - I've noticed some mistakes corrected as follows: Brian Hulley wrote:
class //x a b where x : a -> b
class //FooCon a b where FooCon : a -> b
class //x a b | a -> b where -- I think this fundep is correct x :: a->b -- I can never get used to having to write :: instead of : class //FooCon a b | b -> a where FooCon :: a->b
This is a lot more powerful than just OOP, because we could have different views of a data type, selecting out those components which are relevant to particular operations:
data Element = TerminalPunct | TerminalValue | NonTerminal | Push | Pop data Action = Push | Pop data Insertion = TerminalValue | NonTerminal | Push
without having to artificially construct various injections...
No - these are not in fact views. A view would be given by multiple predicates eg (//Push a,//Pop a) => ... a ... as normal. Regards, Brian.