Questioning apfelmus definitely gives me pause, but...
id :: a - a-- arity 1
id = ($) :: (a - b) - (a - b) -- arity 2
I agree with the arities given above (but without quotes) and see no
ill-definedness to arity.
But these are two different classes of functions.
On 10 Dec 2007, at 11:33 AM, Dan Weston wrote:
Questioning apfelmus definitely gives me pause, but...
id :: a - a-- arity 1
id = ($) :: (a - b) - (a - b) -- arity 2
I agree with the arities given above (but without quotes) and see
no ill-definedness to arity.
On 7 Dec 2007, at 12:39 PM, Dan Weston wrote:
Luke Palmer wrote:
On Dec 7, 2007 7:57 PM, Luke Palmer [EMAIL PROTECTED] wrote:
On Dec 7, 2007 7:41 PM, Dan Weston [EMAIL PROTECTED] wrote:
Luke Palmer wrote:
You can project the compile time numbers into runtime ones:
Yes, that works well if I
On Dec 7, 2007 6:27 AM, Victor Nazarov [EMAIL PROTECTED] wrote:
Cool solution and not so complicated and ad-hoc. But I'd like to ask
isn't the following definition is more natural and simple?
nary 0 x [] = x
nary n f (x:xs) | n 0 = nary (n-1) (f $ read x) xs
Sometimes it helps to write type
On Dec 7, 2007 4:46 PM, Luke Palmer [EMAIL PROTECTED] wrote:
On Dec 7, 2007 6:27 AM, Victor Nazarov [EMAIL PROTECTED] wrote:
nary 0 x [] = x
nary n f (x:xs) | n 0 = nary (n-1) (f $ read x) xs
Sometimes it helps to write type signatures for functions. As in this
case, where you'll find
On Dec 7, 2007 2:52 PM, [EMAIL PROTECTED] wrote:
In fact, that distinction is possible. The following article
How to write an instance for not-a-function
http://okmij.org/ftp/Haskell/typecast.html#is-function-type
specifically describes a method of writing an instance which
On Dec 7, 2007 6:21 PM, Dan Weston [EMAIL PROTECTED] wrote:
This is great! Two questions:
1) I want to make sure the function arity matches the list length (as a
runtime check). I think I can do this with an arity function using
Data.Typeable. I came up with:
arity f = a (typeOf f) where
This is great! Two questions:
1) I want to make sure the function arity matches the list length (as a
runtime check). I think I can do this with an arity function using
Data.Typeable. I came up with:
arity f = a (typeOf f) where
a tr | typeRepTyCon tr /= mkTyCon - = 0
| otherwise =
On Dec 7, 2007 8:39 PM, Dan Weston [EMAIL PROTECTED] wrote:
compose f g = f . g
compose' f g x = f (g x)
Are you saying that these two exactly equivalent functions should have
different arity? If not, then is the arity 2 or 3?
Prelude :t let compose f g = f . g in compose
let
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 function
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 function),
On Dec 7, 2007 7:57 PM, Luke Palmer [EMAIL PROTECTED] wrote:
On Dec 7, 2007 7:41 PM, Dan Weston [EMAIL PROTECTED] 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 function
is. But I want
On Dec 7, 2007 7:41 PM, Dan Weston [EMAIL PROTECTED] 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 function
is. But I want to be able to have the compiler deduce the arity of the
function
12 matches
Mail list logo