Hello,
could someone please give me an example of the partial application of the
following curried function:
add' :: Int - Int - Int
add' a b = a + b
Normally, add' 1 should work, but it doesn't.
Many thanks.
phiroc
___
Haskell-Cafe mailing list
I'd like to write a very simple Haskell script that when given a URL, looks
up the page, and returns a string of HTML. I don't see an HTTP library in
the standard libs, and the one in Hackage requires Windows machines have GHC
and MinGW to be installed and in the PATH.
Is there a simple way to
Quoth [EMAIL PROTECTED], nevermore,
could someone please give me an example of the partial application of the
following curried function:
add' :: Int - Int - Int
add' a b = a + b
Normally, add' 1 should work, but it doesn't.
I think this is what you mean. If not, then please advice. This
phiroc:
Hello,
could someone please give me an example of the partial application of the
following curried function:
add' :: Int - Int - Int
add' a b = a + b
Normally, add' 1 should work, but it doesn't.
Prelude let add' :: Int - Int - Int ; add' a b = a + b
Prelude let add1
On Thu, Jan 18, 2007 at 10:26:25AM +0100, [EMAIL PROTECTED] wrote:
To: haskell-cafe@haskell.org
From: [EMAIL PROTECTED]
Date: Thu, 18 Jan 2007 10:26:25 +0100
Subject: [Haskell-cafe] Partial application
Hello,
could someone please give me an example of the partial application of the
Hello,
what is so great about currying?
What are its uses, apart from letting one define functions with less
parentheses?
Many thanks.
Phiroc
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On Thu, Jan 18, 2007 at 11:00:26AM +0100,
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote
a message of 15 lines which said:
what is so great about currying?
The name is very cool.
What are its uses, apart from letting one define functions with less
parentheses?
Partial applications.
Hi,
I've often wondered the same as the above poster. Something like
readWebPage (in the same style as readFile) would be a really handy
function. Do no libraries provide this?
(if not, can one start providing it? MissingH?)
Thanks
Neil
On 1/18/07, Alistair Bayley [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] skrev:
Hello,
what is so great about currying?
What are its uses, apart from letting one define functions with less
parentheses?
Letting one apply them with less extra characters:
add x y = x + y
map (add 2) [1..5]
instead of
add (x,y) = x + y
let add2 y = add(2,y) in map
what is so great about currying?
What are its uses, apart from letting one define functions with less
parentheses?
Well, from an academic viewpoint, it's very interesting to see a
function defined as a composition of functions. From a practical
viewpoint, it's just really handy. It saves you
Hi,
Phiroc wrote:
what is so great about currying?
What are its uses, apart from letting one define functions with less
parentheses?
Chris Eidhof wrote:
it's just really handy. It saves you a lot of tedious typing
I agree. But I think there is more to it than that.
Currying is more than
John Ky wrote:
I want to learn how to use FFI with Win32, so I'm looking through the
GHC source code. I encountered the function
terminateProcess :: ProcessHandle - IO ()
terminateProcess ph = do
withProcessHandle_ ph $ \p_ -
case p_ of
ClosedHandle _ - return p_
OpenHandle
Hi Pedro,
On Fri, Jan 05, 2007 at 05:51:43PM +, Pedro Baltazar Vasconcelos wrote:
I noticed that GHC generates slower code on an Linux amd64 bit platform than
the 32-bit version on a cheaper 32-bit machine.
CPUTime for running sieve of Erathostenes to generate 10,000 primes:
Is it
On Jan 16, 2007, at 7:22 PM, David House wrote:
Hey all,
I've written a chapter for the Wikibook that attempts to teach some
basic Category Theory in a Haskell hacker-friendly fashion.
http://en.wikibooks.org/wiki/Haskell/Category_theory
In the section on the category laws you say that the
On 18/01/07, Chris Eidhof [EMAIL PROTECTED] wrote:
That's exactly what I love about haskell: it saves me from a
lot of unnecessary typing. After all, I'm a lazy programmer ;)
Lazy languages for lazy programmers 8)
On 18/1/2007, Johan Grönqvist [EMAIL PROTECTED] wrote:
add x y = x + y
map
Hi all,
An interesting question came up in #haskell the other day, and I took
the resulting discussion and wrapped it up into a simple tutorial for
the wiki. Since I'm quite a newbie to haskell myself, I'd appreciate
any double-checking of my logic and, of course, any other
comments/suggestions.
Hello fellow Haskell Hackers,
I announce release 0.1 of piggybackGHC, a small utility package for
using GHC for lexing and parsing Haskell source code.
Description: The modules in this package provide several functions
for conveniently lexing and parsing Haskell modules. The library uses
the
there is a Network.HTTP module, but it is not easy to use
what you want is the equivalent of perl's LWP::Simple, which provides
get() and head() functions
i have heard that this is being worked on, in the meantime i personally
use this wrapper:
http://www.b7j0c.org/content/haskell-http.html
Hi
Isn't _|_ = \x - _|_?
_|_ `seq` () = _|_
(\x - _|_) `seq` () = ()
Whether this is the fault of seq or not is your call...
Thanks
Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
http://www.b7j0c.org/content/haskell-http.html
by the way, if you cut and paste from this page, you may get html
entities in place of some haskell chars, so use the direct download
link:
http://www.b7j0c.org/dev/haskell/lib/Network/HTTP/Simple.hs
On 18/01/07, Joachim Breitner [EMAIL PROTECTED] wrote:
(.) :: (b - c) - (a - b) - a - c
id :: a - a
therefore b = a
therefore _|_ :: a - c
(This is mostly rough guesswork, I might be totally wrong)
That much is right, but remember that just because _|_ has type a - c
doesn't mean it takes a
Hi,
Am Donnerstag, den 18.01.2007, 16:45 + schrieb David House:
On 18/01/07, Joachim Breitner [EMAIL PROTECTED] wrote:
(.) :: (b - c) - (a - b) - a - c
id :: a - a
therefore b = a
therefore _|_ :: a - c
(This is mostly rough guesswork, I might be totally wrong)
That much is
Ulf Norell skrev:
On Jan 16, 2007, at 7:22 PM, David House wrote:
In the section on the category laws you say that the identity morphism
should satisfy
f . idA = idB . f
This is not strong enough. You need
f . idA = f = idB . f
(I do not know category theory, but try to learn from
On 18/01/07, Joachim Breitner [EMAIL PROTECTED] wrote:
But if _|_ can take on any type, it can take on a - b. And in what way
does it then differ from \x - _|_?
_|_ is bottom.
\x - _|_ is a function that takes a value and returns bottom.
You can tell them apart, using seq, as Neil showed, but
On 18/01/07, David House [EMAIL PROTECTED] wrote:
You can tell them apart, using seq, as Neil showed, but apart from
that I guess they're unique. If you had:
s/unique/the same/
--
-David House, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
On 18/01/07, Johan Gršnqvist [EMAIL PROTECTED] wrote:
f = idA . f = (h . g) . f = h . (g . f) = h . idB = h
Thus in the figure f=h must hold, nad one arrow can be removed from the
graph.
The point from here was to conclude that this graph can't represent a
category, not that f = h. You
Johan Gršnqvist wrote:
Ulf Norell skrev:
On Jan 16, 2007, at 7:22 PM, David House wrote:
In the section on the category laws you say that the identity
morphism should satisfy
f . idA = idB . f
This is not strong enough. You need
f . idA = f = idB . f
(I do not know category theory,
On 18/01/07, Daniel Fischer [EMAIL PROTECTED] wrote:
Since I don't know whether I would have to register to modify the wiki or
something (and don't know what markup to use either), I just send you a few
corrections by e-mail.
Thanks; I've corrected them all, with the exceptions of the ones
I wrote:
Will (id :: A - A $!) do the trick?
Ulf Norell wrote:
The problem is not with id, it's with composition. For any f and g we
have
f . g = \x - f (g x)
So _|_ . g = \x - _|_ for any g.
OK, so then how about
f .! g = ((.) $! f) $! g
-Yitz
Hello,
my original query concerning partial application was triggered by the
following statement from Thomson's The Craft of Functional
Programming, p. 185:
multiplyUC :: (Int, Int) - Int
multiplyUC (x,y) = x * y
multiply :: Int - Int - Int
multiply x y = x * y
In the case of
On Jan 18, 2007, at 16:15 , Philippe de Rochambeau wrote:
When I read this, I thought that you could partially apply
multiply by typing multiply 2 at the ghci prompt. However, this
generated an error:
interactive:1:0:
No instance for (Show (Int - Int))
arising from use of
Philippe de Rochambeau wrote:
my original query concerning partial application was triggered by the
following statement from Thomson's The Craft of Functional
Programming, p. 185:
multiplyUC :: (Int, Int) - Int
multiplyUC (x,y) = x * y
multiply :: Int - Int - Int
multiply x y = x * y
Andrew Wagner wrote:
Hi all,
An interesting question came up in #haskell the other day, and I took
the resulting discussion and wrapped it up into a simple tutorial for
the wiki. Since I'm quite a newbie to haskell myself, I'd appreciate
any double-checking of my logic and, of course, any
Hello,
is there a way to trace a list comprehension such as
concat1 :: [[a]] - [a]
concat1 xss = [ x | xs - xss, x - xs ]
I would like to see what gets stored in xs.
Cheers,
phiroc
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Jan 18, 2007, at 17:00 , Philippe de Rochambeau wrote:
concat1 :: [[a]] - [a]
concat1 xss = [ x | xs - xss, x - xs ]
I would like to see what gets stored in xs.
Offhand:
import Debug.Trace
concat1 :: Show a = [[a]] - [a]
concat1 xss = [ x | xs - xss, x - trace (show xs) xs ]
(The
Hello,
does anyone know where I can find examples that use the
Graphics.X11.Xlib.Window module.
Thanks.
phiroc
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Hello,
I would like to use the sqrt function on Fractional numbers.
(mysqrt :: (Fractional a) = a-a)
Half of the problem is solved by:
Prelude :t (realToFrac.sqrt)
(realToFrac.sqrt) :: (Fractional b, Real a, Floating a) = a - b
For the other half I tried:
Prelude :t
Alistair Bayley wrote:
I'd like to write a very simple Haskell script that when given a URL, looks
up the page, and returns a string of HTML. I don't see an HTTP library in
the standard libs...
Neil Mitchell wrote:
MissingH?
MissingPy.
It would be great to have a full-featured native
I don't see a much better way than using something like Newton-
Raphson and testing for some kind of convergence. The Fractional
class can contain many things; for instance it contains rational
numbers. So your mysqrt function would have to be able to cope with
returning arbitrary
Has anybody been able to get hs-plugins to work with ghc6.6?
http://www.nabble.com/Re%3A-hs-plugins-runtime-error-with-GHC-6.6%3A-index-out-of-range-p7163027.html
- a
--
PGP/GPG: 5C9F F366 C9CF 2145 E770 B1B8 EFB1 462D A146 C380
___
Haskell-Cafe
Lennart Augustsson wrote:
I don't see a much better way than using something like Newton-
Raphson and testing for some kind of convergence. The Fractional
class can contain many things; for instance it contains rational
numbers. So your mysqrt function would have to be able to cope with
Adam Megacz wrote:
Has anybody been able to get hs-plugins to work with ghc6.6?
Don made some updates to it after 6.6 was released (see the darcs repo),
but I can't build it due to what looks like a bug in the GHC install
process (the wrong one of two incompatible versions of Typeable.h gets
On Jan 18, 2007, at 23:02 , Bryan O'Sullivan wrote:
Adam Megacz wrote:
Has anybody been able to get hs-plugins to work with ghc6.6?
Don made some updates to it after 6.6 was released (see the darcs
repo), but I can't build it due to what looks like a bug in the GHC
install process (the
hi all
Since I am very new to haskell and still learning, I hope I will not
annoy poeple by asking the following question.
what is the simplest way to implement the following code in haskell?
it's just printing the
contents of 2D array.
for(i = 0; i imax; i++){
for(n = 0; n nmax;
On 1/19/07, Fernan Bolando [EMAIL PROTECTED] wrote:
hi all
Since I am very new to haskell and still learning, I hope I will not
annoy poeple by asking the following question.
what is the simplest way to implement the following code in haskell?
it's just printing the
contents of 2D array.
On 1/19/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:
On 1/19/07, Fernan Bolando [EMAIL PROTECTED] wrote:
hi all
Since I am very new to haskell and still learning, I hope I will not
annoy poeple by asking the following question.
what is the simplest way to implement the following code in
On 1/19/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:
On 1/19/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:
On 1/19/07, Fernan Bolando [EMAIL PROTECTED] wrote:
hi all
Since I am very new to haskell and still learning, I hope I will not
annoy poeple by asking the following question.
47 matches
Mail list logo