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:  How to Update Cabal? (Brent Yorgey)
   2. Re:  A little explanation! (David Thomas)
   3. Re:  A little explanation! follow up (Dimitri DeFigueiredo)
   4.  Problem installing EclipseFp in Eclipse (Robert Weisser)


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

Message: 1
Date: Wed, 30 Apr 2014 14:19:26 -0400
From: Brent Yorgey <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] How to Update Cabal?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Wed, Apr 30, 2014 at 07:40:10PM +0200, Norbert Melzer wrote:
> Probably one needs to ensure that ~/.cabal/bin is in the PATH-variable
> before the path that cabal normally lives in. Alternatively you have to use
> sudo and the --global switch for cabal (not recommended).

*If* you ever have to install something globally with cabal, note that
you should use

  cabal install --global --root-cmd=sudo

and NOT 'sudo cabal install --global'.  This is so that cabal will
only take root privileges for the actual copying/installation, and not
pollute your package cache, etc. with files owned by root.

*But* as Norbert says (and I strongly agree), it is not recommended to
use --global with cabal, unless you know what you are doing and
why.

-Brent

> Am 30.04.2014 18:22 schrieb "Daniel Trstenjak" <[email protected]>:
> 
> >
> > Hi Ari,
> >
> > On Wed, Apr 30, 2014 at 12:18:08PM -0400, Ari King wrote:
> > > Is it best to clone the cabal git repo and install as described here? In
> > which
> > > case, should I remove the existing cabal installation from "/usr/bin"?
> >
> > It's just:
> >
> >    cabal install cabal-install
> >
> >
> > Greetings,
> > Daniel
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://www.haskell.org/mailman/listinfo/beginners
> >

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



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

Message: 2
Date: Wed, 30 Apr 2014 11:32:18 -0700
From: David Thomas <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] A little explanation!
Message-ID:
        <cajudvcgxdzarzescnh_yke3qwe05l4y7cgcxo+prmppp+v1...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

I think this one is most clear removing only one point:

elementAt_w'pf n = last . take (n + 1)

No line noise, simple composition of two functions.  Extremes of point
free style are frequently harmful, but understanding it is worthwhile
and sensibly limited application can improve readability.  I'm not
sure I'd call the example here "extreme" but it's certainly
approaching it (in terms of what I find easily readable).


On Wed, Apr 30, 2014 at 11:16 AM, Kyle Murphy <[email protected]> wrote:
> On the point of it being "retarded" there's some merit to that in that it's
> written in point-free (or as some joking call it, pointless) style. The idea
> is to remove the explicit variables and so the functions are re-arranged and
> composed such that all the variables come at the end of the statement and
> you're left with nothing but a chain of functions at the start (which can
> sometimes be easier to understand since it's just function composition). The
> downside, as you've seen is that it often hurts readability and so there are
> some that are strongly opposed to point-free style. If used carefully, and
> things are broken into smaller easier to understand chunks (via for instance
> let or where clauses) it can still be readable even using point-free style,
> but it's really dependent on both the skill of the person writing the
> statement, and the familiarity and skill of the person reading the
> statement. When in doubt about legibility it's better to avoid point-free
> style, in particular if you start having to do strange things like apply the
> (.) operator to itself (E.G. "(f .) . g" or similar) you're probably being
> to clever for your own good. I wouldn't go so far as to say you should
> *never* use point-free style, but you should seriously consider if you're
> trying to just be clever and show off, or if it really is making the
> statement simpler to understand via more clearly showing how the functions
> are composed.
>
>
> -R. Kyle Murphy
> --
> Curiosity was framed, Ignorance killed the cat.
>
>
> On Wed, Apr 30, 2014 at 1:19 PM, Michael Orlitzky <[email protected]>
> wrote:
>>
>> On 04/30/2014 11:29 AM, Gilberto Melfe wrote:
>> > Hello everybody !
>> >
>> > Could someone explain me exactly how this function works?
>> >
>> > elementAt_w'pf = (last .) . take . (+ 1)
>> >
>> > It's a posted solution to: 99 Haskell problems, problem 3.
>> >
>> > I'm having trouble with the "(last .) ." thing!
>> >
>>
>> It's not your fault, that solution is retarded. Once you remove all of
>> the intentional obfuscation, it looks like,
>>
>>   elementAt_w'pf n xs = last (take (n + 1) xs)
>>
>> which is easy to understand. You can un-retard it step-by-step:
>>
>>     elementAt_w'pf = (last .) . take . (+ 1)
>>
>> <=> elementAt_w'pf n = ((last .) . take . (+ 1)) n
>>
>>                      = (last .) ((take . (+ 1)) n)
>>
>>                      = (last .) (take (n + 1))
>>
>>                      = last . (take (n + 1))
>>
>> <=> elementAt_w'pf n xs = (last . (take (n + 1))) xs
>>
>>                         = last (take (n + 1) xs)
>>
>> All I've used above is the precedence of the function composition
>> operator, and the fact that (f . g) x = f (g x).
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>


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

Message: 3
Date: Wed, 30 Apr 2014 12:44:37 -0600
From: Dimitri DeFigueiredo <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] A little explanation! follow up
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Thanks everyone. It seems I asked the follow-up question too soon.
Michael's or David's proposed "reformulations"

elementAt_w'pf n xs = last (take (n + 1) xs)
or
elementAt_w'pf n = last . take (n + 1)

are so much easier to read than the original

elementAt_w'pf = (last .) . take . (+ 1)

that I will defer learning how to read the original version for now. It 
seems learning to quickly decipher that beast in one's head is not a 
prerequisite to being an effective haskell programmer. So, I'll just 
parse it at my slow pace for now. I think I can see how pointfree style 
(which I really like) can be overused sometimes.

Thanks again. This list rocks! :-)

Dimitri


Em 30/04/14 12:15, Brent Yorgey escreveu:
> On Wed, Apr 30, 2014 at 11:25:58AM -0600, Dimitri DeFigueiredo wrote:
>> I have a follow up question on this one. Is code like this:
>>
>> elementAt_w'pf = (last .) . take . (+ 1)
>>
>> considered good haskell?
> Uses of composition sections like (last .) is not very common; I would
> not consider it good haskell (though tastes may differ).  On the other
> hand, point-free notation, used in moderation, is considered good
> Haskell style. For example, instead of
>
>    foo x = bar (baz (quux x))
>
> you should write
>
>    foo = bar . baz . quux
>
> In this case I would certainly consider the second definition better
> style than the first.
>
>> If so, will this ever become easy to read?
>> What do I do to practice reading this?
> Just read and write lots of code.  Try transforming things into and
> out of point-free notation as an exercise.
>
>> More specifically, how would I know in mind head, before asking the
>> type checker in GHCi to write this pipeline with the section (last .)
>> instead of simply making the (wrong) pipe:
>>
>> elementAt_w'pf = last . take . (+ 1)
> Simply by working out the types in your head.  This becomes much
> easier with practice.
>
>> I am used to using pipes in the unix shell, but in the shell there is
>> always only one input and one output. There is no currying going on
>> and so it is very clear what we are dealing with. How do I learn
>> this?
> There is always only one input and one output in Haskell as well.  The
> thing that makes it more complicated is that unlike in the shell,
> those inputs and outputs can themselves be functions.
>
> -Brent
>
>>
>> Em 30/04/14 09:53, Kyle Murphy escreveu:
>>> Near as I can tell, this is basically having to do with partial
>>> application and the order of precedence for the (.) operator. A
>>> great way to look at this stuff is using the :t command in GHCi and
>>> checking out the types involved.
>>>
>>> Prelude> :t (.)
>>> (.) :: (b -> c) -> (a -> b) -> a -> c
>>>
>>> Prelude> :t last
>>> last :: [a] -> a
>>>
>>> Prelude> :t (last .)
>>> (last .) :: (a -> [c]) -> a -> c
>>>
>>> Looking back at the type for (.) and plugging in "[a]" in place of
>>> "b" and "a" in place of "c" we get:
>>> ([b] -> b) -> (a -> [b]) -> a -> b
>>>
>>> and since "last" takes the place of the first function we can
>>> reduce that to:
>>> (a -> [b]) -> a -> b
>>>
>>> GHCi used "c" where we used "b" but you can clearly see the
>>> signatures are identical other than that detail.
>>>
>>> What we're left with is, (last .) is used to take a function from
>>> some type "a" that returns a list of type "b", and a "a" value, and
>>> then returns the last value from that list of "b" types.
>>>
>>>
>>> -R. Kyle Murphy
>>> --
>>> Curiosity was framed, Ignorance killed the cat.
>>>
>>>
>>> On Wed, Apr 30, 2014 at 11:29 AM, Gilberto Melfe
>>> <[email protected] <mailto:[email protected]>> wrote:
>>>
>>>     Hello everybody !
>>>
>>>     Could someone explain me exactly how this function works?
>>>
>>>     elementAt_w'pf = (last .) . take . (+ 1)
>>>
>>>     It's a posted solution to: 99 Haskell problems, problem 3.
>>>
>>>     I'm having trouble with the "(last .) ." thing!
>>>
>>>     Hope someone can help!
>>>
>>>     Thank You!
>>>
>>>     Gilberto
>>>
>>>     _______________________________________________
>>>     Beginners mailing list
>>>     [email protected] <mailto:[email protected]>
>>>     http://www.haskell.org/mailman/listinfo/beginners
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> [email protected]
>>> http://www.haskell.org/mailman/listinfo/beginners
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners



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

Message: 4
Date: Thu, 01 May 2014 00:18:05 +0200
From: "Robert Weisser" <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Problem installing EclipseFp in Eclipse
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

I decided to try out Eclipse with the EclipseFP plug-in for Haskell.
I downloaded Eclipse, and then started to install EclipseFP. At
some point, I got a screen which said that I needed to install
buildwrapper and scion-browser. It offered to install both
of them, and optionally install hoogle, hlint, stylish-haskell,
SourceGraph, and cabal-dev. The option to install the additional
items was pre-checked. I left it checked. The installation of
buildwrapper, etc. took a long time. It seemed to be going well
until I saw the messages below, which say that installing SourceGraph
will likely break several other packages, most of which were part
of the EclipseFP installation.

I am not a complete novice with Haskell but I am a complete novice
with Cabal. I'm not sure what to do. Here are some options I have
considered:

1. Use --force-reinstalls and hope for the best.

2. Try to resolve the problem with Cabal, although I don't know to
do this.

3. Use EclipseFP without SourceGraph and cabal-dev.

4. Use EclipseFP without SourceGraph, but install cabal-dev using
cabal on the command line.

5. Forget about Eclipse altogether, and go back to using vim.

Any advice would be appreciated.

By the way, I am using Haskell Platform 7.6.3.

Here are the messages I saw in the Eclipse console window:

<terminated> Installing executable SourceGraph

Resolving dependencies...
In order, the following would be installed:
asn1-types-0.2.3 (new package)
asn1-encoding-0.8.1.3 (new package)
asn1-parse-0.8.1 (new package)
bktrees-0.3.1 (new package)
byteable-0.1.1 (new package)
cereal-0.4.0.1 (new package)
colour-2.3.3 (new package)
cpphs-1.18.2 (new version)
crypto-pubkey-types-0.4.2.2 (new package)
cryptohash-0.11.4 (new package)
digest-0.0.1.2 (new package)
dlist-0.5 (new version)
aeson-0.7.0.3 (reinstall) changes: dlist-0.7.0.1 -> 0.5
data-default-instances-dlist-0.0.1 (reinstall) changes: dlist-0.7.0.1 -> 0.5
data-default-0.5.3 (reinstall)
cookie-0.4.1.1 (new package)
haskell-src-exts-1.13.5 (new version)
hslua-0.3.12 (new package)
mime-types-0.1.0.4 (new package)
multiset-0.2.2 (new package)
pandoc-types-1.12.3.2 (new package)
pem-0.2.2 (new package)
polyparse-1.8 (new version)
publicsuffixlist-0.1 (new package)
http-client-0.3.2 (new package)
regex-pcre-builtin-0.94.4.8.8.34 (new package)
highlighting-kate-0.5.6.1 (new package)
resourcet-0.4.10.2 (new version)
securemem-0.1.3 (new package)
crypto-cipher-types-0.0.9 (new package)
cipher-aes-0.2.7 (new package)
cipher-rc4-0.1.4 (new package)
crypto-random-0.0.7 (new package)
cprng-aes-0.5.2 (new package)
crypto-numbers-0.2.3 (new package)
crypto-pubkey-0.2.4 (new package)
socks-0.5.4 (new package)
temporary-1.1.2.5 (new package)
text-stream-decode-0.1.0.5 (new package)
conduit-1.0.17.1 (new version)
http-client-conduit-0.2.0.1 (new package)
wl-pprint-text-1.1.0.2 (new package)
graphviz-2999.16.0.0 (new package)
x509-1.4.11 (new package)
x509-store-1.4.4 (new package)
x509-system-1.4.5 (new package)
x509-validation-1.5.0 (new package)
tls-1.2.6 (new package)
connection-0.2.1 (new package)
http-client-tls-0.2.1.1 (new package)
http-conduit-2.0.0.10 (new package)
xml-1.3.13 (new package)
texmath-0.6.6.1 (new package)
yaml-0.8.8.2 (reinstall) changes: conduit-1.1.1 -> 1.0.17.1, resourcet-1.1.2
-> 0.4.10.2
zip-archive-0.2.2.1 (new package)
pandoc-1.12.3.3 (new package)
Graphalyze-0.14.0.2 (new package)
SourceGraph-0.7.0.5 (new package)
cabal: The following packages are likely to be broken by the reinstalls:
stylish-haskell-0.5.10.0
scion-browser-0.3.1
persistent-template-1.3.1.3
persistent-sqlite-1.3.0.5
persistent-1.3.0.6
buildwrapper-0.8.0
dynamic-cabal-0.3.1
Use --force-reinstalls if you want to install anyway.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140501/225d792b/attachment.html>

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

Subject: Digest Footer

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


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

End of Beginners Digest, Vol 70, Issue 57
*****************************************

Reply via email to