Is it possible to write a function arity :: a -> Integer to determine the arity of arbitrary functions, such that
> arity map
2
> arity foldr
3
> arity id
1
> arity "hello"
0
?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s easy with
OverlappingInstances:Upd Found problem. You need to specify non-polymorphic type for polymorphic functions:
Don’t know how to solve this yet.
Upd2 as Sjoerd Visscher commented below “you have to specify a non-polymorphic type, as the answer depends on which type you choose”.