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

Crypt Master cryptmaster at hotmail.com
Tue Jul 20 14:23:16 EDT 2004


*grin* its so obvious once you know the answer :-)

Thx


----Original Message Follows----
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))}

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



More information about the Haskell-Cafe mailing list