haskell - Why am I getting the "Equations for ... have different numbers of arguments" message? -
the following function compiles , works:
shares :: maybe (int, l.bytestring) -> maybe int shares = case of nothing -> nothing (x, y) -> x but when rewritten in following form:
shares :: maybe (int, l.bytestring) -> maybe int shares nothing = nothing shares (x, y) = x i errors
equations ‘shares’ have different numbers of arguments i think it's same essentially.
in haskell, arguments function separated spaces. therefore, last equation has 2 arguments: just of type a -> maybe a , (x, y) of type (int, l.bytestring). since want 1 argument, should instead read:
shares (just (x, y)) = x
Comments
Post a Comment