Send Beginners mailing list submissions to
        beginners@haskell.org

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
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

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


Today's Topics:

   1. Re:  cabal install errors (Gregory Guthrie)
   2. Re:  cabal install errors (Stephen Tetley)
   3. Re:  cabal install errors (Gregory Guthrie)
   4. Re:  cabal install errors (Stephen Tetley)
   5. Re:  cabal install errors (Henk-Jan van Tuyl)
   6. Re:  cabal install errors (Gregory Guthrie)
   7. Re:  cleanest way to unwrap a list? (Jack Henahan)
   8. Re:  cleanest way to unwrap a list? (Christopher Howard)
   9. Re:  cleanest way to unwrap a list? (Jack Henahan)


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

Message: 1
Date: Mon, 13 Aug 2012 07:31:19 -0500
From: Gregory Guthrie <guth...@mum.edu>
Subject: Re: [Haskell-beginners] cabal install errors
To: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <08ef9da445c4b5439c4733e1f35705ba01e265dd1...@mail.cs.mum.edu>
Content-Type: text/plain; charset="us-ascii"

I didn't get any concrete remedy for this, or its underlying cause.

Does it mean that this package is incompatible with others currently installed, 
and I am supposed to make a choice to uninstall or break them by forcing this, 
or ...???

-------------------------------------------
> I tried this:
>      C:\Users\haskell>cabal install regex-tdfa
>      Resolving dependencies...
>      In order, the following would be installed:
>      regex-base-0.93.2 (reinstall) changes: array-0.3.0.2 -> 0.4.0.0, 
> base-4.3.1.0
>      -> 4.5.0.0, bytestring-0.9.1.10 -> 0.9.2.1, containers-0.4.0.0 -> 
> 0.4.2.1,
>      mtl-2.0.1.0 -> 2.1.2
>      regex-tdfa-1.1.8 (new package)
>      cabal: The following packages are likely to be broken by the reinstalls:
>      regex-posix-0.95.1
>      regex-compat-0.95.1
>      haskell-platform-2011.3.0.0
>      regex-posix-0.94.4
>      regex-compat-0.93.1
>      haskell-platform-2011.2.0.1
>      regex-posix-0.95.1
>      regex-compat-0.95.1
>      haskell-platform-2012.2.0.0
>      Use --force-reinstalls if you want to install anyway.
> 
> So what to do?
> >>cabal -V
> cabal-install version 0.14.0
> using version 1.14.0 of the Cabal library GHCi version 7.4.1
> HaskellPlatform-2012.2.0.0
> -------------------------------------------



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

Message: 2
Date: Mon, 13 Aug 2012 17:40:03 +0100
From: Stephen Tetley <stephen.tet...@gmail.com>
Subject: Re: [Haskell-beginners] cabal install errors
To: Gregory Guthrie <guth...@mum.edu>
Cc: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <cab2tprbwyfw5rtn-ja7ceibhgxxlzccvzsv8tex7o_xiz_5...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

The latest regex-tdfa is compatible with with the packages you have
installed, but cabal-install evidently wants to update all of
regex-tdfa's dependencies which thus breaks things.

Presumably cabal-install has an option not to transitively update
dependencies? As I don't use cabal-install I don't know it myself.



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

Message: 3
Date: Mon, 13 Aug 2012 11:41:46 -0500
From: Gregory Guthrie <guth...@mum.edu>
Subject: Re: [Haskell-beginners] cabal install errors
To: Stephen Tetley <stephen.tet...@gmail.com>
Cc: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <08ef9da445c4b5439c4733e1f35705ba01e265dd1...@mail.cs.mum.edu>
Content-Type: text/plain; charset="us-ascii"

Wouldn't this indicate some errors in the cabal install setup with the package?

So the solution is to get the package, and install directly?
Thanks.

-------------------------------------------
> Subject: Re: [Haskell-beginners] cabal install errors
> 
> The latest regex-tdfa is compatible with with the packages you have 
> installed, but cabal-
> install evidently wants to update all of regex-tdfa's dependencies which thus 
> breaks things.
> 
> Presumably cabal-install has an option not to transitively update 
> dependencies? As I don't use
> cabal-install I don't know it myself.



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

Message: 4
Date: Mon, 13 Aug 2012 18:38:24 +0100
From: Stephen Tetley <stephen.tet...@gmail.com>
Subject: Re: [Haskell-beginners] cabal install errors
To: Gregory Guthrie <guth...@mum.edu>
Cc: "beginners@haskell.org" <beginners@haskell.org>
Message-ID:
        <CAB2TPRBhViLhh-1Uk-iAQs67ioFT5++4+rLxax1WO+PqK3V=a...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

The .cabal file in regex-tdfa is pretty relaxed about version numbers,
so I don't see see an error there.

If it were me I'd install it form local with runhaskell Setup.hs
configure; runhaskell Setup.hs build; runhaskell Setup.hs install



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

Message: 5
Date: Mon, 13 Aug 2012 22:59:34 +0200
From: "Henk-Jan van Tuyl" <hjgt...@chello.nl>
Subject: Re: [Haskell-beginners] cabal install errors
To: "beginners@haskell.org" <beginners@haskell.org>, "Gregory Guthrie"
        <guth...@mum.edu>
Message-ID: <op.wizy9kdvpz0...@zen5.arnhem.chello.nl>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
        delsp=yes

On Mon, 13 Aug 2012 14:31:19 +0200, Gregory Guthrie <guth...@mum.edu>  
wrote:

> I didn't get any concrete remedy for this, or its underlying cause.
>
> Does it mean that this package is incompatible with others currently  
> installed, and I am supposed to make a choice to uninstall or break them  
> by forcing this, or ...???
>

Maybe the information on the Cabal FAQ[0] helps.

Regards,
Henk-Jan van Tuyl


[0] http://www.haskell.org/cabal/FAQ.html#dependencies-conflict


-- 
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--



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

Message: 6
Date: Mon, 13 Aug 2012 16:19:39 -0500
From: Gregory Guthrie <guth...@mum.edu>
Subject: Re: [Haskell-beginners] cabal install errors
To: Henk-Jan van Tuyl <hjgt...@chello.nl>, "beginners@haskell.org"
        <beginners@haskell.org>
Message-ID:
        <08ef9da445c4b5439c4733e1f35705ba01e265dd1...@mail.cs.mum.edu>
Content-Type: text/plain; charset="us-ascii"

Thanks, I'll try that, but it looks like it could be a lot of maintenance and 
manual cleanup!

I haven't knowingly done any manual upgrades of core packages, but I have done 
"update"s as asked by cabal when it thinks the database is getting old. I have 
had such pedestrian usage that I would not have expected to have goofed up the 
database!  :-)

Cabal seems to be more troublesome that other various package managers like 
apt, etc...
-------------------------------------------
> 
> Maybe the information on the Cabal FAQ[0] helps.
> 
> Regards,
> Henk-Jan van Tuyl
> 
> 
> [0] http://www.haskell.org/cabal/FAQ.html#dependencies-conflict
> 
> 



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

Message: 7
Date: Mon, 13 Aug 2012 18:21:02 -0400
From: Jack Henahan <jhena...@uvm.edu>
Subject: Re: [Haskell-beginners] cleanest way to unwrap a list?
To: Christopher Howard <christopher.how...@frigidcode.com>
Cc: Haskell Beginners <beginners@haskell.org>
Message-ID: <44714faf-a719-4ede-a6b6-667c96e25...@uvm.edu>
Content-Type: text/plain; charset=iso-8859-1

Another vote for 

    map (map (+1)) [[1,2],[2,3]]

though I rather prefer

    (map . map) (+1) [[1,2],[2,3]]

or even

    (map . map) (+1) $ [[1,2],[2,3]]

====
Jack Henahan
jhena...@uvm.edu


On Aug 13, 2012, at 1:21 AM, Christopher Howard 
<christopher.how...@frigidcode.com> wrote:

> Hi. Is the some generic, clean syntax to unwrap a nested list, modify
> the value, and put it back together? Say, for example, I have the list
> [[1,2],[3,4]] and want to add 1 to each inner element, resulting in
> [[2,3],[4,5]].
> 
> After reading about the list monad, I was rather excited, because I
> (mistakenly) thought something like this would work:
> 
> code:
> --------
> a = do b <- [[1,2],[3,4]]
>       c <- b
>       return (c + 1)
> --------
> 
> That would be awesome, because I would be able to modify the list at
> each level of unwrapping, while leaving the code very neat and readable.
> However, what the above example actually does is produce a /single/ list
> from the values:
> 
> code:
> --------
> *Main> a
> [2,3,4,5]
> --------
> 
> Obviously wishing won't change how the list monad works, but I thought
> it might be worth asking if there is some other monad or syntactic trick
> that does something along the lines of what I am looking for.
> 
> -- 
> frigidcode.com
> indicium.us
> 
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners




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

Message: 8
Date: Mon, 13 Aug 2012 14:41:27 -0800
From: Christopher Howard <christopher.how...@frigidcode.com>
Subject: Re: [Haskell-beginners] cleanest way to unwrap a list?
To: Haskell Beginners <beginners@haskell.org>
Message-ID: <50298297.8040...@frigidcode.com>
Content-Type: text/plain; charset="utf-8"

On 08/12/2012 09:37 PM, Shakthi Kannan wrote:
> Hi,
> 
> --- On Mon, Aug 13, 2012 at 10:51 AM, Christopher Howard
> <christopher.how...@frigidcode.com> wrote:
> | Say, for example, I have the list
> | [[1,2],[3,4]] and want to add 1 to each inner element, resulting in
> | [[2,3],[4,5]].
> \--
> 
> Like this?
> 
> ghci> let xxs = [[1,2], [3,4]]
> 
> ghci> [ [ x+1 | x <- xs] | xs <- xxs ]
> [[2,3],[4,5]]
> 
> SK
> 

Thanks everyone for the responses. I found the list comprehension
approach satisfactory, as it allows me to cleanly modify each layer of
the nested array as I unwrap it:

code:
--------
b = [[ x+1
    | x <- xs ++ [3] ]
    | xs <- [[1,2],[3,4]] ]

*Main> b
[[2,3,4],[4,5,4]]
--------

The only downside is that I have to write the layers out in reverse of
the way I would normally think of them, but that isn't too big of a
challenge.

I'm not sure how that would be done with map in a way that would be neat
and readable and wouldn't require declaring extra identifiers. I can't
give a fair evaluation of the Lens approach because I don't understand
enough of the theory yet.

-- 
frigidcode.com
indicium.us

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 554 bytes
Desc: OpenPGP digital signature
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20120813/b64eba8a/attachment-0001.pgp>

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

Message: 9
Date: Mon, 13 Aug 2012 19:06:41 -0400
From: Jack Henahan <jhena...@uvm.edu>
Subject: Re: [Haskell-beginners] cleanest way to unwrap a list?
To: Christopher Howard <christopher.how...@frigidcode.com>
Cc: Haskell Beginners <beginners@haskell.org>
Message-ID: <e487a7c8-77fe-47fb-a0a2-5f3170a8b...@uvm.edu>
Content-Type: text/plain; charset=us-ascii

Equally,

    let map' = map . map
    map' (+1) . map (++[3]) $ [[1,2],[3,4]]
    -- [[2,3,4],[4,5,4]]

And you can really keep stacking those up. I think this approach will be 
cleaner in the long run.

For instance, let's start naming our parts.
   
   let list = [[1,2],[3,4]]
   let map' = map . map
   let addOne = map' (+1)
   let appendThree = map (++[3])
   let reverseInner = map reverse

So, from here we can do the following:
   
   list
   -- [[1,2],[3,4]]

   -- the first example
   addOne list
   -- [[2,3],[4,5]]
   
   -- now the second example
   addOne . appendThree $ list
   -- [[2,3,4],[4,5,4]]

   -- now add one to all members of the list, append three to the list, reverse 
the inner lists,
   -- then add one to all members of the new list

   addOne . reverseInner . appendThree . addOne $ list
   -- [[4,4,3],[4,6,5]]

Now how would you construct that as a list comprehension? With the method I've 
proposed, you need
only use map to operate on the nested lists themselves and map' to operate on 
the elements of those
lists.

====
Jack Henahan
jhena...@uvm.edu
      

On Aug 13, 2012, at 6:41 PM, Christopher Howard 
<christopher.how...@frigidcode.com> wrote:

> On 08/12/2012 09:37 PM, Shakthi Kannan wrote:
>> Hi,
>> 
>> --- On Mon, Aug 13, 2012 at 10:51 AM, Christopher Howard
>> <christopher.how...@frigidcode.com> wrote:
>> | Say, for example, I have the list
>> | [[1,2],[3,4]] and want to add 1 to each inner element, resulting in
>> | [[2,3],[4,5]].
>> \--
>> 
>> Like this?
>> 
>> ghci> let xxs = [[1,2], [3,4]]
>> 
>> ghci> [ [ x+1 | x <- xs] | xs <- xxs ]
>> [[2,3],[4,5]]
>> 
>> SK
>> 
> 
> Thanks everyone for the responses. I found the list comprehension
> approach satisfactory, as it allows me to cleanly modify each layer of
> the nested array as I unwrap it:
> 
> code:
> --------
> b = [[ x+1
>    | x <- xs ++ [3] ]
>    | xs <- [[1,2],[3,4]] ]
> 
> *Main> b
> [[2,3,4],[4,5,4]]
> --------
> 
> The only downside is that I have to write the layers out in reverse of
> the way I would normally think of them, but that isn't too big of a
> challenge.
> 
> I'm not sure how that would be done with map in a way that would be neat
> and readable and wouldn't require declaring extra identifiers. I can't
> give a fair evaluation of the Lens approach because I don't understand
> enough of the theory yet.
> 
> -- 
> frigidcode.com
> indicium.us
> 
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners




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

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 50, Issue 14
*****************************************

Reply via email to