« Return to Thread: Need help from a newby

Re: Need help from a newby

by ChrisK-5 :: Rate this Message:

Reply to Author | View in Thread

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::[Pkg]->[Table]->[([Pkg],[Pkg])]
> 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?

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

 « Return to Thread: Need help from a newby