[Haskell-cafe] Creating an alias for a function
michael rice
nowgate at yahoo.com
Tue Oct 6 22:45:52 EDT 2009
Thanks all!
There's ALWAYS seems to be a neat way to do what's needed with Haskell.
Michael
--- On Tue, 10/6/09, Joe Fredette <jfredett at gmail.com> wrote:
From: Joe Fredette <jfredett at gmail.com>
Subject: Re: [Haskell-cafe] Creating an alias for a function
To: "michael rice" <nowgate at yahoo.com>
Cc: haskell-cafe at haskell.org
Date: Tuesday, October 6, 2009, 10:03 PM
Well, you can drop the arguments entirely, and let the type be inferred to get
car = head
which is pretty nice. You could use an INLINE hint to make the compiler replace it before compilation, though I don't think it would change performance much...
/Joe
On Oct 6, 2009, at 10:01 PM, michael rice wrote:
> How do I create an alias for a function, like giving CAR the same functionality as HEAD. I know I can do it by creating a definition (see below), but is there a better way, like Scheme's
>
> (define head car)
>
> car :: [a] -> a
> car x = head x
>
> The reason for doing this is to more closely mirror legacy code.
>
> Michael
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091006/0fd92ad7/attachment.html
More information about the Haskell-Cafe
mailing list