I'm trying to write something like this in Haskell:
length . nub . intersect
but it doesn't work.
*Main Data.List> :t intersect
intersect :: Eq a => [a] -> [a] -> [a]
*Main Data.List> :t nub
nub :: Eq a => [a] -> [a]
*Main Data.List> :t length
length :: [a] -> Int
Based on the type, my understanding is that intersect
returns a type of [a]
and donates to nub
, which takes exactly a type of [a]
, then also returns a type of [a]
to length
, then finally the return should be an Int
. What's wrong with it?