I\'m having trouble with this program.
filterJust :: [Maybe a] -> [a]
filterJust [] = []
filterJust x = map fromJust (filter (isJust) x)
<
/=
can only be used on values of a type that implements Eq
((/=) :: (Eq a) -> a -> a -> Bool
).Maybe a
supports Eq
only if a
does (there's an instance (Eq a) => Eq (Maybe a)
).filterJust
works for all types a
, even those that don't implement Eq
: [Maybe a] -> [a]
Therefore filterJust
can't use /=
.