[Haskell-cafe] How do I include polymorphic function type signatures in a data element ?

Henning Thielemann iakd0 at clusterf.urz.uni-halle.de
Tue Jul 20 12:50:51 EDT 2004


On Tue, 20 Jul 2004, Crypt Master wrote:

> Exmaple:
> 
> <CODE>
> type Fitness = Integer
> data Population a = Population [(Fitness, a)]
>                     deriving (Show)
> 
> data GAParams = GAParams { randomNums :: [Integer] ,
>                            someFunc :: (Int->Int->(Population a))}
> </CODE>

Like for 'Population a' you have to specify a type parameter for
'GAParams', i.e.

              |
              v

data GAParams a = GAParams { randomNums :: [Integer] ,
                             someFunc :: (Int->Int->(Population a))}




More information about the Haskell-Cafe mailing list