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.  Gtk2Hs + Sourceview on Windows ([email protected])
   2.  Unable to Cabal Upgrade (aditya siram)
   3.  Re: Unable to Cabal Upgrade (Andy Stewart)
   4. Re:  Re: Unable to Cabal Upgrade (aditya siram)
   5.  Searching Maybe lists (aditya siram)
   6. Re:  Searching Maybe lists (Antoine Latter)
   7. Re:  Searching Maybe lists (Antoine Latter)
   8. Re:  Searching Maybe lists (Alexander Dunlap)


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

Message: 1
Date: Wed, 13 May 2009 14:30:51 -0400
From: [email protected]
Subject: [Haskell-beginners] Gtk2Hs + Sourceview on Windows
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII

Hi,

I have ghc 6.10.1 and gtk2hs 0.10.0 installed on my windows vista
computer. Both were installed using the installer on the webpages.
I am able to use gtk, glade etc but not sourceview or cairo. In a forum
I found that those have to be enabled using ./configure --enable-sourceview
(similar for cairo). But my windows installation does not seem to have
a script configure. What am I supposed to do?

Thanks,
Michael




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

Message: 2
Date: Thu, 14 May 2009 18:23:42 -0500
From: aditya siram <[email protected]>
Subject: [Haskell-beginners] Unable to Cabal Upgrade
To: beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Hi all,
I'm unable to cabal upgrade with the following error:
Resolving dependencies...
cabal: dependencies conflict: ghc-6.10.1 requires process ==1.0.1.1 however
process-1.0.1.1 was excluded because ghc-6.10.1 requires process ==1.0.1.0

I am currently running ghc 6.10.1 and process 1.0.1.1.

thanks ...
deech
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090514/750fb3e3/attachment-0001.html

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

Message: 3
Date: Fri, 15 May 2009 09:45:33 +0800
From: Andy Stewart <[email protected]>
Subject: [Haskell-beginners] Re: Unable to Cabal Upgrade
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

Hi,

aditya siram <[email protected]> writes:

> Hi all,
> I'm unable to cabal upgrade with the following error:
> Resolving dependencies...
> cabal: dependencies conflict: ghc-6.10.1 requires process ==1.0.1.1 however
> process-1.0.1.1 was excluded because ghc-6.10.1 requires process ==1.0.1.0
>
> I am currently running ghc 6.10.1 and process 1.0.1.1.
It's a bug of Cabal.
I think developers will fix this problem in the feature.

Now you can do below step for fix this problem:

1-> execute command "ghc-pkg list"
Find same package from two list, and use command "ghc-pkg unregister
PackageName --force" remove same pacakge.

2-> execute command "ghc-pkg unregister procss-1.0.1.1 --force"

I think that's okay.

And don't use "cabal upgrade" command until developers fix this problem.

If you want install some package, please use command "cabal install"

  -- Andy



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

Message: 4
Date: Thu, 14 May 2009 23:06:03 -0500
From: aditya siram <[email protected]>
Subject: Re: [Haskell-beginners] Re: Unable to Cabal Upgrade
To: Andy Stewart <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

I'm not sure why but installing GHC 6.10.3 fixed the issue. I was able to
'cabal upgrade' after that.
-deech

On Thu, May 14, 2009 at 8:45 PM, Andy Stewart <[email protected]>wrote:

> Hi,
>
> aditya siram <[email protected]> writes:
>
> > Hi all,
> > I'm unable to cabal upgrade with the following error:
> > Resolving dependencies...
> > cabal: dependencies conflict: ghc-6.10.1 requires process ==1.0.1.1
> however
> > process-1.0.1.1 was excluded because ghc-6.10.1 requires process
> ==1.0.1.0
> >
> > I am currently running ghc 6.10.1 and process 1.0.1.1.
> It's a bug of Cabal.
> I think developers will fix this problem in the feature.
>
> Now you can do below step for fix this problem:
>
> 1-> execute command "ghc-pkg list"
> Find same package from two list, and use command "ghc-pkg unregister
> PackageName --force" remove same pacakge.
>
> 2-> execute command "ghc-pkg unregister procss-1.0.1.1 --force"
>
> I think that's okay.
>
> And don't use "cabal upgrade" command until developers fix this problem.
>
> If you want install some package, please use command "cabal install"
>
>  -- Andy
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090514/f17c53bd/attachment-0001.html

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

Message: 5
Date: Mon, 18 May 2009 21:56:00 -0500
From: aditya siram <[email protected]>
Subject: [Haskell-beginners] Searching Maybe lists
To: beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Hi all,
I would like to define a function that takes a list and a function that
evaluates each member of the list to a Maybe value and output the first
element in the list that evaluates to 'Just y', or 'Nothing' once the list
has been completely processed. So something like:

findMaybe :: [a] -> (a -> Maybe b) -> Maybe b

The problem is that I don't want it to go through the entire list, but
short-circuit when it hits a 'Just ...'. So far I have:

orMaybe :: Maybe a -> Maybe a -> Maybe a
orMaybe m1 m2 = case (m1,m2) of
                  (_, Just a) -> Just a
                  (Just a, _) -> Just a
                  _           -> Nothing

findMaybe :: [a] -> (a -> Maybe b) -> Maybe b
findMaybe as f = foldr (\a sofar -> sofar `orMaybe` (f a)) Nothing as

'findMaybe', as far as I can tell, traverses the entire input list which is
undesirable for long lists. How can I fix it?

Curiously, the regular 'Data.List.find' function that applies a Boolean
predicate to each member of the list also seems to first traverse the entire
list using 'filter' and then grabs the head of the result.

Thanks ...
-deech
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090518/067465a8/attachment-0001.html

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

Message: 6
Date: Mon, 18 May 2009 22:23:44 -0500
From: Antoine Latter <[email protected]>
Subject: Re: [Haskell-beginners] Searching Maybe lists
To: aditya siram <[email protected]>
Cc: beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

On Mon, May 18, 2009 at 9:56 PM, aditya siram <[email protected]> wrote:
> Hi all,
> I would like to define a function that takes a list and a function that
> evaluates each member of the list to a Maybe value and output the first
> element in the list that evaluates to 'Just y', or 'Nothing' once the list
> has been completely processed. So something like:
>
> findMaybe :: [a] -> (a -> Maybe b) -> Maybe b
>

There are a couple of ways, the first one I could think of was:

> findMaybe xs f = mconcat $ map f xs

where mconcat is found in Data.Monoid

Antoine


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

Message: 7
Date: Mon, 18 May 2009 22:26:46 -0500
From: Antoine Latter <[email protected]>
Subject: Re: [Haskell-beginners] Searching Maybe lists
To: aditya siram <[email protected]>
Cc: beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

On Mon, May 18, 2009 at 9:56 PM, aditya siram <[email protected]> wrote:
>
> Curiously, the regular 'Data.List.find' function that applies a Boolean
> predicate to each member of the list also seems to first traverse the entire
> list using 'filter' and then grabs the head of the result.
>

Ah!  I just thought I'd point out that 'filter' does not necessarily
traverse the entire list if all you do with the result is grab the
head - it only traverses enough of the list to figure out what the
head of the list should be (or even that it exists).

Haskell is lazy :-)

Antoine


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

Message: 8
Date: Mon, 18 May 2009 20:50:26 -0700
From: Alexander Dunlap <[email protected]>
Subject: Re: [Haskell-beginners] Searching Maybe lists
To: aditya siram <[email protected]>
Cc: beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

On Mon, May 18, 2009 at 7:56 PM, aditya siram <[email protected]> wrote:
> Hi all,
> I would like to define a function that takes a list and a function that
> evaluates each member of the list to a Maybe value and output the first
> element in the list that evaluates to 'Just y', or 'Nothing' once the list
> has been completely processed. So something like:
>
> findMaybe :: [a] -> (a -> Maybe b) -> Maybe b
>
> The problem is that I don't want it to go through the entire list, but
> short-circuit when it hits a 'Just ...'. So far I have:
>
> orMaybe :: Maybe a -> Maybe a -> Maybe a
> orMaybe m1 m2 = case (m1,m2) of
>                   (_, Just a) -> Just a
>                   (Just a, _) -> Just a
>                   _           -> Nothing
>
> findMaybe :: [a] -> (a -> Maybe b) -> Maybe b
> findMaybe as f = foldr (\a sofar -> sofar `orMaybe` (f a)) Nothing as
>
> 'findMaybe', as far as I can tell, traverses the entire input list which is
> undesirable for long lists. How can I fix it?
>
> Curiously, the regular 'Data.List.find' function that applies a Boolean
> predicate to each member of the list also seems to first traverse the entire
> list using 'filter' and then grabs the head of the result.
>
> Thanks ...
> -deech
>

find doesn't traverse the entire list. The filter function can
traverse the whole list, but only if you observe all of its values
afterwards. If you only look at the first value, like find does, then
filter only goes until it produces one value. This is because of
laziness.

We can test that filter doesn't examine the entire list by trying it
on an infinite list. If it traversed the entire list, it couldn't
possibly work on an infinite list!

$ ghci
GHCi, version 6.10.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> import Data.List
Prelude Data.List> find (==3) [1..]
Just 3
Prelude Data.List>

But it does work! It only looks at values until it finds one that
matches the predicate.

Alex


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

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


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

Reply via email to