...
> type Table = Signal (Address,Port) 
...
> lookup_pr::Signal Table->AbstExt Pkg->AbstExt Pkg 
> lookup_pr t (Prst(x,y,z)) 
>     |(delive_adr_A t == y && x == U) = (Prst(x,y,z)) 
>     |otherwise = look_if_RTD_pkG_A t (Prst(x,y,z)) 
...
> Type error in application
> *** Expression     : delive_adr_A t
> *** Term           : t
> *** Type           : Signal Table
> *** Does not match : Signal (Int,Port)


when a "Table" is a "Signal (Address,Port)" then
what is a "Signal Table" ?

btw is this some sort of homework?
writing your mail should not have been easier than just reading the error 
message:

in the expression "delive_adr_A t" (look it up in your source)
there is that term "t" (which is a part of the expression);
"t" has the type "Signal Table" (why? look at its type definition in 
"lookup_pr::Signal Table->..."),
but in the expression it should have the type "Signal (Int,Port)".

so, now compare these two types. do "Signal Table" and "Signal (Int,Port)" 
equal? replace "Table" with its type alias from your sourcecode, and think 
about which type looks strange.


i don't want to be mean... but did you already attend a tutorial on haskell? to 
know the type of everything you write, is the key to eradicate bugs.

with the type system, you will write less runtime-bugs: just make them 
compile-time-bugs.
like this:

newtype Address = Address Int deriving(Eq,Show,Ord) -- or 
deriving(Eq,Show,Ord,Num)
data Port = C | D deriving(Eq,Show)
newtype AddressPort = AddressPort (Address,Port) deriving(Eq,Show)
data Payload = UP String | RTDP AddressPort deriving(Eq,Show)
data Pkgtype = RTD | U deriving(Eq,Show)
data Pkg = Pkg Pkgtype Address Payload
newtype Table = Table (Signal AddressPort)
or
newtype Table = Table AddressPort deriving(Eq,Show)



- marc

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to