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: Fast tree manipulation (Heinrich Apfelmus)
   2.  Installing hmatrix on OS X (Duncan Mortimer)
   3.  Just clarifying the "pred" and "succ" functions  in Haskell
      (Andy Elvey)
   4. Re:  Just clarifying the "pred" and "succ"        functions in
      Haskell (Brandon S. Allbery KF8NH)
   5. Re:  Just clarifying the "pred" and "succ"        functions in
      Haskell (Andy Elvey)
   6. Re:  Just clarifying the "pred" and "succ"        functions in
      Haskell (Brandon S. Allbery KF8NH)
   7. Re:  Installing hmatrix on OS X (Lyndon Maydwell)
   8.  Re: Installing hmatrix on OS X (Heinrich Apfelmus)


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

Message: 1
Date: Fri, 05 Feb 2010 11:54:29 +0100
From: Heinrich Apfelmus <[email protected]>
Subject: [Haskell-beginners] Re: Fast tree manipulation
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8

Gabi wrote:
> I didn't see any mature zipper libraries to efficiently manipulate trees.
> Can you point me to any mature libs ?

There's

   http://hackage.haskell.org/package/rosezipper

for  Data.Tree  and

   http://hackage.haskell.org/package/zipper

for generic data types. Not sure if they count as "mature", but zippers
are straightforward to implement anyway. You could even roll your own,
it's very simple.


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



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

Message: 2
Date: Sat, 6 Feb 2010 13:25:43 +1000
From: Duncan Mortimer <[email protected]>
Subject: [Haskell-beginners] Installing hmatrix on OS X
To: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

Hi all,

I'm trying to install the easyVision library on OS X, following the
notes at http://mit.edu/harold/Public/easyVisionNotes.html.

However, despite a few hours web trawling and hacking away with
various cabal options, I can't get "hmatrix" to install.  I'm using OS
X 10.5.8 with GHC 6.10.4.   I installed gsl using macports, as
suggested in the notes above, but cabal doesn't seem to be able to
find it.  The error I'm getting is:

[13:22:35 dmorti hmatrix-0.8.2.0]$ cabal install hmatrix
Resolving dependencies...
[1 of 1] Compiling Main             (
/var/folders/05/05Ltg9vxE+a1hR422nbuE++++TI/-Tmp-/hmatrix-0.8.2.05810/hmatrix-0.8.2.0/Setup.lhs,
/var/folders/05/05Ltg9vxE+a1hR422nbuE++++TI/-Tmp-/hmatrix-0.8.2.05810/hmatrix-0.8.2.0/dist/setup/Main.o
)
Linking 
/var/folders/05/05Ltg9vxE+a1hR422nbuE++++TI/-Tmp-/hmatrix-0.8.2.05810/hmatrix-0.8.2.0/dist/setup/setup
...
Configuring hmatrix-0.8.2.0...
Checking foreign libraries... FAIL
 *** Sorry, I can't link GSL.
 *** Please make sure that the appropriate -dev packages are installed.
 *** You can also specify the required libraries using
 *** cabal install hmatrix --configure-option=link:lib1,lib2,lib3,etc.
setup: Package hmatrix-0.8.2.0 can't be built on this system.
cabal: Error: some packages failed to install:
hmatrix-0.8.2.0 failed during the building phase. The exception was:
exit: ExitFailure 1

It appears that others have also had this error, but have been able to
fix it up by including "--extra-lib-dirs" and "--extra-include-dirs"
options, or using "ld-options: -framework vecLib".  I've tried both of
these approaches, but still get the same errors.

Can anyone offer any suggestions?

Thanks very much for your help,
Duncan Mortimer


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

Message: 3
Date: Sat, 06 Feb 2010 18:27:24 +1300
From: Andy Elvey <[email protected]>
Subject: [Haskell-beginners] Just clarifying the "pred" and "succ"
        functions       in Haskell
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi all -

I'm doing a public-domain package of "functional" programs" in C, and 
that involves trying to replicate (in C) a number of Haskell functions. 

The two that I'm looking at now are "pred" and "succ".  I've seen the 
examples on zvon.org, which give "pred 5" as being 4, and "pred B" as 
being "A".   Ok, that's fine, no problem. 

However, is my understanding correct that this can be extended to lists 
(arrays in C) so that (for example)  for a list ["foo", "bar", "baz"] 
,   "pred "bar" " would give you "foo" , and "succ "bar" "  would give 
you "baz"? 

Thanks in advance - bye for now -
- Andy 


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

Message: 4
Date: Sat, 6 Feb 2010 00:54:37 -0500
From: "Brandon S. Allbery KF8NH" <[email protected]>
Subject: Re: [Haskell-beginners] Just clarifying the "pred" and "succ"
        functions in Haskell
To: Andy Elvey <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

On Feb 6, 2010, at 00:27 , Andy Elvey wrote:
> However, is my understanding correct that this can be extended to  
> lists (arrays in C) so that (for example)  for a list ["foo", "bar",  
> "baz"] ,   "pred "bar" " would give you "foo" , and "succ "bar" "   
> would give you "baz"?


No.  Leaving aside that you don't manipulate lists that way in  
Haskell, "bar" is a random value of type String (which is [Char]), not  
a member of an enumeration.  For comparison:

 > data MyType = Foo | Bar | Baz deriving Enum;
 > -- pred Bar = Foo, succ Bar = Baz

Some languages (e.g. Perl) do give an enumerable value to Strings, but  
`succ "Bar"' would be something like "Baq".  (This could be done in  
Haskell, with some pain; it starts with `instance (Enum a, Bounded a)  
=> Enum [a] where...'.)  You can't go from a string like "Bar" to  
whatever lists might contain that string (and what if multiple lists  
contained it?), so there's no way to get an interpretation like that;  
you would need an enumerator which had access both to the list and the  
member in question, whereas Enum has access only to the type.  (There  
exist dependent type systems where you could encode that information  
into a defined (sub)type, but Haskell doesn't support it directly.)

What you *can* do is that, because the types of list and array indexes  
are members of Enum, you can for example use Data.List.index to  
determine the index (if any!) of that item in your list, then take  
prev or succ of that.  Beware of running off the end of the list,  
though.  (It's also more complicated for arrays because array indexes  
are themselves defined by a typeclass `Ix'.)

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [email protected]
system administrator [openafs,heimdal,too many hats] [email protected]
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : 
http://www.haskell.org/pipermail/beginners/attachments/20100206/e33481eb/PGP-0001.bin

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

Message: 5
Date: Sat, 06 Feb 2010 19:31:49 +1300
From: Andy Elvey <[email protected]>
Subject: Re: [Haskell-beginners] Just clarifying the "pred" and "succ"
        functions in Haskell
To: "Brandon S. Allbery KF8NH" <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Brandon S. Allbery KF8NH wrote:
> On Feb 6, 2010, at 00:27 , Andy Elvey wrote:
>> However, is my understanding correct that this can be extended to 
>> lists (arrays in C) so that (for example)  for a list ["foo", "bar", 
>> "baz"] ,   "pred "bar" " would give you "foo" , and "succ "bar" "  
>> would give you "baz"?
>
>
> No.  Leaving aside that you don't manipulate lists that way in 
> Haskell, "bar" is a random value of type String (which is [Char]), not 
> a member of an enumeration.  For comparison:
>
> > data MyType = Foo | Bar | Baz deriving Enum;
> > -- pred Bar = Foo, succ Bar = Baz
>
> Some languages (e.g. Perl) do give an enumerable value to Strings, but 
> `succ "Bar"' would be something like "Baq".  (This could be done in 
> Haskell, with some pain; it starts with `instance (Enum a, Bounded a) 
> => Enum [a] where...'.)  You can't go from a string like "Bar" to 
> whatever lists might contain that string (and what if multiple lists 
> contained it?), so there's no way to get an interpretation like that; 
> you would need an enumerator which had access both to the list and the 
> member in question, whereas Enum has access only to the type.  (There 
> exist dependent type systems where you could encode that information 
> into a defined (sub)type, but Haskell doesn't support it directly.)
>
> What you *can* do is that, because the types of list and array indexes 
> are members of Enum, you can for example use Data.List.index to 
> determine the index (if any!) of that item in your list, then take 
> prev or succ of that.  Beware of running off the end of the list, 
> though.  (It's also more complicated for arrays because array indexes 
> are themselves defined by a typeclass `Ix'.)
Hi Brandon - thanks very much for that! 
Ok.  Yes, that is exactly what I was after.  I was indeed thinking that 
"pred" and "succ" related to the "previous" and "next" elements in a 
list, but I now see that that is not the case.

So, I may look at doing what I would call  "lpred" and lsucc" - the 
predecessor and successor of a list element.
I'm somewhat surprised that (from what I can tell) Haskell doesn't seem 
to have those two functions for a list. I may be wrong....

Anyway - thanks again. Bye for now -
- Andy



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

Message: 6
Date: Sat, 6 Feb 2010 01:45:58 -0500
From: "Brandon S. Allbery KF8NH" <[email protected]>
Subject: Re: [Haskell-beginners] Just clarifying the "pred" and "succ"
        functions in Haskell
To: beginners beginners <[email protected]>,        Andy Elvey
        <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

Andy Elvey wrote:
> So, I may look at doing what I would call "lpred" and lsucc" - the  
> predecessor and successor of a list element. I'm somewhat surprised  
> that (from what I can tell) Haskell doesn't seem to have those two  
> functions for a list. I may be wrong....
Again, lists don't work that way; a list in Haskell is a single  
immutable object, you can pull items from it using (!!), head, etc.,  
but you can't have a pointer into the "middle" of a list.  You can  
have a sublist (for example, `tail ["foo", "bar", "baz"]' = `["bar",  
"baz"]') --- but you can't get from there to the "foo", as it isn't  
part of that new list.  (This despite the fact that what `tail' gives  
you is going to be shared in actual storage with the original list.   
You don't have a backpointer into that original list to follow.)  This  
is actually a feature of the Haskell model:  it's usually easier to  
reason about these kinds of structures, where you can treat any  
operation as producing a new object and the Haskell compiler takes  
care of optimizations for you (shared representations, possibly  
recognizing that it can quietly do an update-in-place because you  
can't possibly reach the old value, etc.).

You may want to take a look at the Seq type defined in the Data.Seq  
module, though; you have a `view' (what you can think of as a cursor)  
on a given Seq which can be moved back and forth.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [email protected]
system administrator [openafs,heimdal,too many hats] [email protected]
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : 
http://www.haskell.org/pipermail/beginners/attachments/20100206/e705b3a9/PGP-0001.bin

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

Message: 7
Date: Sat, 6 Feb 2010 16:52:19 +0800
From: Lyndon Maydwell <[email protected]>
Subject: Re: [Haskell-beginners] Installing hmatrix on OS X
To: Duncan Mortimer <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

I'm having a similar error when trying to install HMatrix on OS X as
well. Interested if anyone can find a solution.

On Sat, Feb 6, 2010 at 11:25 AM, Duncan Mortimer <[email protected]> wrote:
> Hi all,
>
> I'm trying to install the easyVision library on OS X, following the
> notes at http://mit.edu/harold/Public/easyVisionNotes.html.
>
> However, despite a few hours web trawling and hacking away with
> various cabal options, I can't get "hmatrix" to install.  I'm using OS
> X 10.5.8 with GHC 6.10.4.   I installed gsl using macports, as
> suggested in the notes above, but cabal doesn't seem to be able to
> find it.  The error I'm getting is:
>
> [13:22:35 dmorti hmatrix-0.8.2.0]$ cabal install hmatrix
> Resolving dependencies...
> [1 of 1] Compiling Main             (
> /var/folders/05/05Ltg9vxE+a1hR422nbuE++++TI/-Tmp-/hmatrix-0.8.2.05810/hmatrix-0.8.2.0/Setup.lhs,
> /var/folders/05/05Ltg9vxE+a1hR422nbuE++++TI/-Tmp-/hmatrix-0.8.2.05810/hmatrix-0.8.2.0/dist/setup/Main.o
> )
> Linking 
> /var/folders/05/05Ltg9vxE+a1hR422nbuE++++TI/-Tmp-/hmatrix-0.8.2.05810/hmatrix-0.8.2.0/dist/setup/setup
> ...
> Configuring hmatrix-0.8.2.0...
> Checking foreign libraries... FAIL
>  *** Sorry, I can't link GSL.
>  *** Please make sure that the appropriate -dev packages are installed.
>  *** You can also specify the required libraries using
>  *** cabal install hmatrix --configure-option=link:lib1,lib2,lib3,etc.
> setup: Package hmatrix-0.8.2.0 can't be built on this system.
> cabal: Error: some packages failed to install:
> hmatrix-0.8.2.0 failed during the building phase. The exception was:
> exit: ExitFailure 1
>
> It appears that others have also had this error, but have been able to
> fix it up by including "--extra-lib-dirs" and "--extra-include-dirs"
> options, or using "ld-options: -framework vecLib".  I've tried both of
> these approaches, but still get the same errors.
>
> Can anyone offer any suggestions?
>
> Thanks very much for your help,
> Duncan Mortimer
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>


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

Message: 8
Date: Sat, 06 Feb 2010 11:34:43 +0100
From: Heinrich Apfelmus <[email protected]>
Subject: [Haskell-beginners] Re: Installing hmatrix on OS X
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8

Duncan Mortimer wrote:
> I'm trying to install the easyVision library on OS X, following the
> notes at http://mit.edu/harold/Public/easyVisionNotes.html.
> 
> However, despite a few hours web trawling and hacking away with
> various cabal options, I can't get "hmatrix" to install.  I'm using OS
> X 10.5.8 with GHC 6.10.4.   I installed gsl using macports, as
> suggested in the notes above, but cabal doesn't seem to be able to
> find it.  The error I'm getting is:
> 
> [13:22:35 dmorti hmatrix-0.8.2.0]$ cabal install hmatrix
> Resolving dependencies...
> [1 of 1] Compiling Main             (
> /var/folders/05/05Ltg9vxE+a1hR422nbuE++++TI/-Tmp-/hmatrix-0.8.2.05810/hmatrix-0.8.2.0/Setup.lhs,
> /var/folders/05/05Ltg9vxE+a1hR422nbuE++++TI/-Tmp-/hmatrix-0.8.2.05810/hmatrix-0.8.2.0/dist/setup/Main.o
> )
> Linking 
> /var/folders/05/05Ltg9vxE+a1hR422nbuE++++TI/-Tmp-/hmatrix-0.8.2.05810/hmatrix-0.8.2.0/dist/setup/setup
> ....
> Configuring hmatrix-0.8.2.0...
> Checking foreign libraries... FAIL
>  *** Sorry, I can't link GSL.
>  *** Please make sure that the appropriate -dev packages are installed.
>  *** You can also specify the required libraries using
>  *** cabal install hmatrix --configure-option=link:lib1,lib2,lib3,etc.
> setup: Package hmatrix-0.8.2.0 can't be built on this system.
> cabal: Error: some packages failed to install:
> hmatrix-0.8.2.0 failed during the building phase. The exception was:
> exit: ExitFailure 1
> 
> It appears that others have also had this error, but have been able to
> fix it up by including "--extra-lib-dirs" and "--extra-include-dirs"
> options, or using "ld-options: -framework vecLib".  I've tried both of
> these approaches, but still get the same errors.
> 
> Can anyone offer any suggestions?

hmatrix  uses a custom configure script which I think is supposed to
make live easier for Linux users. Unfortunately, it doesn't work on
MacOS X; you have to deactivate it. If I remember correctly, you can do
this with changing the build type to

   build-type: Simple

in the cabal file. Then, add the relevant libraries

   extra-lib-dirs: /opt/local/lib/
   extra-include-dirs: /opt/local/include/
   extra-libraries: gsl
   framework: Accelerate
   -- or  framework: vecLib  for earlier versions of MacOS X

and off you go.


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



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

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


End of Beginners Digest, Vol 20, Issue 11
*****************************************

Reply via email to