Why am I getting the "Equations for ... have different numbers of arguments" message?

Viewed 3236

The following function compiles and works:

shares :: Maybe (Int, L.ByteString) -> Maybe Int                                                                                                                                                            
shares a =                                                                                                                                                                                                  
    case a of                                                                                                                                                                                               
        Nothing        -> Nothing                                                                                                                                                                           
        Just (x, y)    -> Just x

But when rewritten in the following form:

shares :: Maybe (Int, L.ByteString) -> Maybe Int                                                                                                                                                            
shares Nothing = Nothing                                                                                                                                                                                    
shares Just (x, y) = Just x

I get errors

Equations for ‘shares’ have different numbers of arguments

I think it's same essentially.

1 Answers
Related