|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Need help from a newbyMy 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? |
|
|
Re: Need help from a newbykarle 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 |
|
|
Re: Need help from a newbySubstitute the definition of type Table into the error:
Type error in explicitly typed binding *** Term : [(a,p)] *** Type : [(a,b)] *** Does not match : [Table] where [Table] = [[(Address,Port)]] Do you see why the expression [ (a,p) ] cannot have type [ [ (Address, Port) ] ] ? Regards, Chris On 11/1/07, karle <ph_kittichai@...> 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? > -- > View this message in context: http://www.nabble.com/Need-help-from-a-newby-tf4735009.html#a13540531 > Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@... > http://www.haskell.org/mailman/listinfo/haskell-cafe > > Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |