[Haskell-cafe] Need help from a newby
ph_kittichai at yahoo.com
Thu Nov 1 22:46:24 EDT 2007
> karle wrote:
>> My declaration is as followed:-
>> type Address = Int
>> data Port = C | D deriving(Eq,Show)
>> data Payload = UP[Char] | RTDP(Address,Port) deriving(Eq,Show)
>> data Pkgtype = RTD | U deriving(Eq,Show)
>> type Pkg = (Pkgtype,Address,Payload)
>> type Table = [(Address,Port)]
>> findport [(pt,ad,pa)] [(a,p)]
>> | ( p == C) = ([pt,ad,a],)
>> | otherwise = (,[pt,ad,a])
>> Error received:-
>> Type error in explicitly typed binding
>> *** Term : [(a,p)]
>> *** Type : [(a,b)]
>> *** Does not match : [Table]
>> Can anyone please help?
> There seems to be several things that look wrong.
> Could you explain what findport is supposed to be doing?
> findport is just to check if the port in the Table is equal to C then it
> will place the packet in the first of the list. Otherwise it will place
> the packet in the second of the list.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
View this message in context: http://www.nabble.com/Need-help-from-a-newby-tf4735009.html#a13541442
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe