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
I get illegal type errors. Is it possible
to use nested types in a class ?
Hope you can help me
Matthias
|
- Re: class instance with nested types Matthias Höchsmann
- Re: class instance with nested types Lars Lundgren
- Re: class instance with nested types Matthias Höchsmann
- Re: class instance with nested types Andreas Rossberg
- Re: class instance with nested types Andreas Rossberg