[Haskell-cafe] Re: distinguish functions from non-functions in a
jonathanccast at fastmail.fm
Fri Dec 7 15:53:32 EST 2007
On 7 Dec 2007, at 12:39 PM, Dan Weston wrote:
> Luke Palmer wrote:
>> On Dec 7, 2007 7:57 PM, Luke Palmer <lrpalmer at gmail.com> wrote:
>>> On Dec 7, 2007 7:41 PM, Dan Weston <westondan at imageworks.com> wrote:
>>>> Luke Palmer wrote:
>>>>> You can project the compile time numbers into runtime ones:
>>>> Yes, that works well if I know a priori what the arity of the
>>>> is. But I want to be able to have the compiler deduce the arity
>>>> of the
>>>> function (e.g. by applying undefined until it is no longer a
>>>> precisely so I don't have to supply it myself.
>>>> Function arity is (I think) something already known to GHC, so I
>>>> know why we can't get at it too.
>>> No, it is not. Consider:
>>> compose f g x = f (g x)
>>> What is the arity of f?
>> Oh, you're saying at run-time, given an object.
> No, at compile time. Type is static.
What about a type that contains lexical type variables?
For that matter, what about a type that ends in a type variable, e.g.
head :: [a] -> a
Is the arity of
head (x:xn) = x
Different from that of
head' :: [a -> b] -> a -> b
head' (x:xn) = x
More information about the Haskell-Cafe