[Haskell-cafe] f(g(x), h(y)) - Correct syntax

news at lyra.net news at lyra.net
Mon Feb 11 09:27:40 EST 2008


Hallo!

I have this code:
----------------------------------------
q1 :: EName -> [ApprenticeInfo]
q1 c = [apprenticeInfo n | n <- allApprentices, member ((sq4
c) (firstOf5(n))) == True]

sq4 :: ESurname -> [IDB]
sq4 c = (sq3 (sq1 (c)))

firstOf5 :: (a,b,c,d,e) -> a
firstOf5 (n,_,_,_,_) = n

member :: [IDB] -> IDB -> Bool
member [] y = False
member(x:xs) y = (x==y) || member xs y
----------------------------------------
sq4 works correctly and returns [IDB]
Unfortunately member ((sq4 c) (firstOf5(n))) gives this
error:

Type error in application
*** Expression     : sq4 c (firstOf5 n)
*** Term           : sq4
*** Type           : ESurname -> [IDB]
*** Does not match : a -> b -> c

As far as I see it I'm not writing the correct syntax for a
function of 2 functions. 
I have 
g(x): Esurname->[IDB]
h(y): (IDB,_,_,_,_) -> IDB
f(x,y): ([IDB], IDB) -> Bool 
I want to obtain f(g(x), h(y)) and I obtain something else.
Where am I wrong?

Thanks 


More information about the Haskell-Cafe mailing list