class instance with nested types

Lars Lundgren d95lars@dtek.chalmers.se
Fri, 27 Oct 2000 12:14:58 +0200 (MEST)


On Fri, 27 Oct 2000, Matthias Höchsmann wrote:

> Hello,
> 
> I have the following problem:
> 
> basic datatypes
> 
> > type Sequence a = [a]
> > data Tree a = N a (Forest a) deriving (Ord,Eq,Show)
> > type Forest a = Sequence (Tree a)
> 
> i want to construct a class Xy
> 
> > class Xy s a where
> >      test :: s a -> a
> 
> and make an instance for list of characters
> 
> > instance Xy [] Char where
> >      test [a] = a
> 
> this works, and an instance for a forest and tried something like this
> 
> > instance  ([] Tree) Char where
> > test x@(N a xs):txs = a
> 

Don't you mean

test (N a xs:txs) = a

?

/Lars L