Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  foldl by foldr (Matt Andrew)
   2.  diagrams installation trouble (Scott N. Walck)


----------------------------------------------------------------------

Message: 1
Date: Mon, 17 May 2010 12:14:01 +1000
From: Matt Andrew <[email protected]>
Subject: Re: [Haskell-beginners] foldl by foldr
To: [email protected]
Message-ID: <m2y6fjp95i.wl%[email protected]>
Content-Type: text/plain; charset=US-ASCII

Thanks everyone for all the help: I've now been able to understand the function 
and have a better understanding of partial application to boot.

Appreciate it,

Matt Andrew

At Fri, 14 May 2010 11:43:03 -0700,
John Bender wrote:
> 
> [1  <multipart/alternative (7bit)>]
> [1.1  <text/plain; ISO-8859-1 (7bit)>]
> Matt,
> 
> I was having issues with the very same problem not too long ago and I wrote
> a blog post about how it illustrates the power of partial application.
> 
> http://nickelcode.com/2009/04/12/haskell-learnings/
> 
> Sorry for the blog plug, I just didn't see any reason to copy and paste the
> content. I make no claims about the quality of my writing but it does
> include some basic expansions of the execution/thunks for understanding.
> 
> Best
> 
> On Fri, May 14, 2010 at 6:58 AM, Brent Yorgey <[email protected]>wrote:
> 
> > On Fri, May 14, 2010 at 12:29:01PM +1000, Matt Andrew wrote:
> > >
> > > The thing I am having trouble understanding is what the 'id'
> > > function is doing in a function that expects 3 arguments and is
> > > given 4 (foldr).
> >
> > "Number of arguments" in Haskell is a red herring.  In fact, every
> > Haskell function takes exactly *one* argument.  Functions which appear
> > to "take more than one argument" are really functions which take one
> > argument and return another function (which takes the next argument,
> > and so on).  That's why the type of a "multi-argument" function is written
> > like
> >
> >  X -> Y -> Z -> ...
> >
> > which can also be written more explicitly as
> >
> >  X -> (Y -> (Z -> ...))
> >
> > Polymorphic functions (like foldr) can also be deceiving as far as
> > "number of arguments" goes.  For example, consider id:
> >
> >  id :: a -> a
> >
> > Looks like this takes only one argument, right?  Well, what if  a = (Int ->
> > Int):
> >
> >  id :: (Int -> Int) -> (Int -> Int)
> >
> > which can also be written
> >
> >  id :: (Int -> Int) -> Int -> Int
> >
> > so now it looks like id "takes two arguments" -- an (Int -> Int)
> > function, and an Int.  Of course, the real answer is that id always
> > takes exactly one argument, just like any other function; but
> > sometimes that argument may itself be a function, in which case
> > the result can be applied to additional argument(s).
> >
> > -Brent
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://www.haskell.org/mailman/listinfo/beginners
> >
> [1.2  <text/html; ISO-8859-1 (quoted-printable)>]
> 
> [2  <text/plain; us-ascii (7bit)>]
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners


------------------------------

Message: 2
Date: Mon, 17 May 2010 12:06:29 -0400
From: "Scott N. Walck" <[email protected]>
Subject: [Haskell-beginners] diagrams installation trouble
To: [email protected]
Message-ID: <20100517160629.gb19...@walck-nsf>
Content-Type: text/plain; charset=us-ascii

Hi folks,

I'm trying to install Brent Yorgey's diagrams library.  I'm having
trouble getting the Haskell bindings to the Cairo library installed
correctly and/or visible.

As you can see below, I have the Haskell Cairo stuff installed at
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1

I did this with something like
$ sudo aptitude install libghc6-cairo-dev
In other words, I used the ubuntu package system to install this.

You can also see that ghc-pkg does not see this installation.
I thought I might be able to fix the problem by registering
these packages with 'ghc-pkg register', but I can't get that
to work.

Finally (and this is not shown below) I tried to compile gtk2hs from
source.  I seem to have had a successful './configure' step, but then
I fail at the 'make' step, for a similar reason.  The system can't
find the cairo and similar files at /usr/lib/haskell-packages

One more point about my system might be important.
I installed GHC 6.10 using the ubuntu installer, then
compiled 6.12 from source, then installed the most recent
haskell-platform.

I would greatly appreciate any help you all could provide.

Thanks,

Scott



wa...@walck-nsf:~/computer/haskell/Yorgey$ cd diagrams-new/
wa...@walck-nsf:~/computer/haskell/Yorgey/diagrams-new$ runhaskell Setup.lhs 
configure
Configuring diagrams-0.2.9...
Setup.lhs: At least the following dependencies are missing:
cairo >=0.9 && <0.11, colour >=2.2.1 && <2.4, containers ==0.2.*
wa...@walck-nsf:~/computer/haskell/Yorgey/diagrams-new$ runhaskell Setup.lhs 
configure --user
Configuring diagrams-0.2.9...
Setup.lhs: At least the following dependencies are missing:
cairo >=0.9 && <0.11, containers ==0.2.*
wa...@walck-nsf:~/computer/haskell/Yorgey/diagrams-new$ ghc-pkg list
/usr/local/lib/ghc-6.12.1/package.conf.d:
    Cabal-1.8.0.2
    GLUT-2.1.2.1
    HTTP-4000.0.9
    HUnit-1.2.2.1
    OpenGL-2.2.3.0
    QuickCheck-2.1.0.3
    array-0.3.0.0
    base-3.0.3.2
    base-4.2.0.0
    bin-package-db-0.0.0.0
    bytestring-0.9.1.5
    cgi-3001.1.7.2
    containers-0.3.0.0
    deepseq-1.1.0.0
    directory-1.0.1.0
    (dph-base-0.4.0)
    (dph-par-0.4.0)
    (dph-prim-interface-0.4.0)
    (dph-prim-par-0.4.0)
    (dph-prim-seq-0.4.0)
    (dph-seq-0.4.0)
    extensible-exceptions-0.1.1.1
    ffi-1.0
    fgl-5.4.2.2
    filepath-1.1.0.3
    (ghc-6.12.1)
    (ghc-binary-0.5.0.2)
    ghc-prim-0.2.0.0
    haskell-platform-2010.1.0.0
    haskell-src-1.0.1.3
    haskell98-1.0.1.1
    hpc-0.5.0.4
    html-1.0.1.2
    integer-gmp-0.2.0.0
    mtl-1.1.0.2
    network-2.2.1.7
    old-locale-1.0.0.2
    old-time-1.0.0.3
    parallel-2.2.0.1
    parsec-2.1.0.1
    pretty-1.0.1.1
    process-1.0.1.2
    random-1.0.0.2
    regex-base-0.93.1
    regex-compat-0.92
    regex-posix-0.94.1
    rts-1.0
    stm-2.1.1.2
    syb-0.1.0.2
    template-haskell-2.4.0.0
    time-1.1.4
    unix-2.4.0.0
    utf8-string-0.3.4
    xhtml-3000.2.0.1
    zlib-0.5.2.0

/home/walck/.ghc/x86_64-linux-6.12.1/package.conf.d:
    GLFW-0.4.2
    binary-0.5.0.2
    colour-2.3.1
    darcs-2.4.1
    dataenc-0.13.0.2
    dimensional-0.8
    gnuplot-0.3.4
    hashed-storage-0.4.11
    haskeline-0.6.2.2
    mmap-0.4.1
    monoid-transformer-0.0.2
    non-negative-0.0.5.1
    numeric-prelude-0.1.3.4
    numtype-1.0
    storable-record-0.0.2.2
    terminfo-0.3.1.2
    transformers-0.2.1.0
    utf8-string-0.3.6
    utility-ht-0.0.5.1

wa...@walck-nsf:~/computer/haskell/Yorgey/diagrams-new$ dpkg -L 
libghc6-cairo-dev
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libghc6-cairo-dev
/usr/share/doc/libghc6-cairo-dev/changelog.gz
/usr/share/doc/libghc6-cairo-dev/copyright
/usr/share/doc/libghc6-cairo-dev/changelog.Debian.gz
/usr/lib
/usr/lib/haskell-packages
/usr/lib/haskell-packages/ghc6
/usr/lib/haskell-packages/ghc6/lib
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/cairo.package.conf
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/libHScairo.a
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/HScairo.o
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Drawing
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Drawing/Cairo.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Drawing/Paths.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Drawing/Patterns.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Drawing/Text.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Drawing/Transformations.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Fonts
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Fonts/FontOptions.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Surfaces
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Surfaces/Image.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Surfaces/PDF.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Surfaces/PNG.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Surfaces/PS.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Surfaces/SVG.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Surfaces/Surface.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal/Utilities.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Matrix.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Types.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo/Internal.hi
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/imports/Graphics/Rendering/Cairo.hi
wa...@walck-nsf:~/computer/haskell/Yorgey/diagrams-new$ ls -l 
/usr/lib/haskell-packages/ghc6/lib/
total 20
drwxr-xr-x 3 root root 4096 2010-05-04 08:25 cairo-0.10.1
drwxr-xr-x 3 root root 4096 2010-05-04 16:48 curl-1.3.5
drwxr-xr-x 4 root root 4096 2010-05-04 08:25 glib-0.10.1
drwxr-xr-x 3 root root 4096 2010-05-04 16:00 gtk-0.10.1
drwxr-xr-x 3 root root 4096 2010-05-04 08:25 mtl-1.1.0.2
wa...@walck-nsf:~/computer/haskell/Yorgey/diagrams-new$ ghc-pkg register 
/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/cairo.package.conf 
Reading package info from 
"/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/cairo.package.conf" ... done.
cairo-0.10.1: missing id field
cairo-0.10.1: dependency "base-4.1.0.0" doesn't exist (use --force to override)
cairo-0.10.1: dependency "mtl-1.1.0.2" doesn't exist (use --force to override)
cairo-0.10.1: dependency "glib-0.10.1" doesn't exist (use --force to override)
cairo-0.10.1: dependency "bytestring-0.9.1.4" doesn't exist (use --force to 
override)
wa...@walck-nsf:~/computer/haskell/Yorgey/diagrams-new$ ghc-pkg register 
/usr/lib/haskell-packages/ghc6/lib/glib-0.10.1/glib.package.conf 
Reading package info from 
"/usr/lib/haskell-packages/ghc6/lib/glib-0.10.1/glib.package.conf" ... done.
glib-0.10.1: missing id field
glib-0.10.1: dependency "base-4.1.0.0" doesn't exist (use --force to override)
wa...@walck-nsf:~/computer/haskell/Yorgey/diagrams-new$ 

-- 
Scott N. Walck
Associate Professor of Physics
Lebanon Valley College
Annville, PA 17003
phone: 717-867-6153
fax:   717-867-6075
email: [email protected]



------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 23, Issue 23
*****************************************

Reply via email to