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: Top beginner mistakes (Benjamin L.Russell)
   2. Re:  Top beginner mistakes (Francesco Bochicchio)
   3. Re:  Top beginner mistakes (Daniel Fischer)
   4.  Using The Cabal that comes with GHC 6.10 on      Windows (Glenn)
   5.  Re: Using The Cabal that comes with GHC 6.10 on  Windows
      (Andy Stewart)
   6.  defining own arbitrary :: Gen Int (ben)
   7. Re:  defining own arbitrary :: Gen Int (Thomas Davie)
   8. Re:  Using The Cabal that comes with GHC 6.10 on  Windows
      (Brandon S. Allbery KF8NH)
   9.  installing cabal with 6.10 - ubuntu (B)


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

Message: 1
Date: Thu, 05 Mar 2009 22:20:39 +0900
From: Benjamin L.Russell <dekudekup...@yahoo.com>
Subject: [Haskell-beginners] Re: Top beginner mistakes
To: beginners@haskell.org
Message-ID: <h3kvq4hq7e6mgvneblp9jn5s3bbsqp0...@4ax.com>
Content-Type: text/plain; charset=us-ascii

On Thu, 5 Mar 2009 12:19:55 +0000 (UTC), 7stud
<bbxx789_0...@yahoo.com> wrote:

>Benjamin L. Russell <DekuDekuplex <at> Yahoo.com> writes:
>> Those are excellent examples!
>> 
>> I have just added them to HaskellWiki on the following page, and
>> credited them to you:
>> 
>> Common Misunderstandings - HaskellWiki
>> http://www.haskell.org/haskellwiki/Common_Misunderstandings
>> 
>> Good work!
>> 
>
>Thanks!  I made a copy and paste error though.  The second example
>still has the equals sign:
>
>myfunction x y  =
>
>which would produce the same error message as the first example.
>The equals sign should be stricken from the second example.

Stricken.

>Also, no quotes around 7stud in the attribution! lol.

Quotes removed.

Thanks again!

-- Benjamin L. Russell
-- 
Benjamin L. Russell  /   DekuDekuplex at Yahoo dot com
http://dekudekuplex.wordpress.com/
Translator/Interpreter / Mobile:  +011 81 80-3603-6725
"Furuike ya, kawazu tobikomu mizu no oto." 
-- Matsuo Basho^ 



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

Message: 2
Date: Thu, 5 Mar 2009 19:13:34 +0100
From: Francesco Bochicchio <bieff...@gmail.com>
Subject: Re: [Haskell-beginners] Top beginner mistakes
To: beginners <beginners@haskell.org>
Message-ID:
        <a6e7dd140903051013q57d3189ajed1995dadae1e...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

2009/3/4 7stud <bbxx789_0...@yahoo.com>

> Here are my top three:
>
> ...




>
> 3) Not putting parentheses around arguments of the form x:xs
>
> dosomething x:xs = head xs
>
>
>
I have a variation here:

function [] = ...
function [x:xs] = ...

Another of mine is the classical:

print function arguments -- or variations

but I finally learned to use '$' here .



>
>
> In all three cases, the error messages don't help spot the problem.
>
>
> I think that part of the problem  is that haskell syntax is powerful but
terse, and therefore is not easy for a compiler to guess the intensions in
the programmers.
For instance, in any other language the expression 'map f'  would give the
error "missing second parameter",  while in haskell could be a partial
function application.

However, some of ghc messages could probably  be made more
'beginners-friendly'.

Ciao
---------
FB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090305/ced87139/attachment-0001.htm

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

Message: 3
Date: Thu, 5 Mar 2009 19:47:35 +0100
From: Daniel Fischer <daniel.is.fisc...@web.de>
Subject: Re: [Haskell-beginners] Top beginner mistakes
To: Francesco Bochicchio <bieff...@gmail.com>,  beginners
        <beginners@haskell.org>
Message-ID: <200903051947.35554.daniel.is.fisc...@web.de>
Content-Type: text/plain;  charset="iso-8859-1"

Am Donnerstag, 5. März 2009 19:13 schrieb Francesco Bochicchio:
> 2009/3/4 7stud <bbxx789_0...@yahoo.com>
>
> > Here are my top three:
> >
> > ...
> >
> > 3) Not putting parentheses around arguments of the form x:xs
> >
> > dosomething x:xs = head xs
>
> I have a variation here:
>
> function [] = ...
> function [x:xs] = ...
>
> Another of mine is the classical:
>
> print function arguments -- or variations
>
> but I finally learned to use '$' here .
>
> > In all three cases, the error messages don't help spot the problem.
> >

At least they give a source position, so you know where to look.
But yes, "parse error" is not very specific.

> >
> > I think that part of the problem  is that haskell syntax is powerful but
>
> terse, and therefore is not easy for a compiler to guess the intentions in
> the programmers.
> For instance, in any other language the expression 'map f'  would give the
> error "missing second parameter",  while in haskell could be a partial
> function application.
>
> However, some of ghc messages could probably  be made more
> 'beginners-friendly'.

Create a ticket if you encounter a particularly unhelpful error message.
If you can suggest a better message, all the better.

>
> Ciao
> ---------
> FB

Cheers,
Daniel



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

Message: 4
Date: Sat, 7 Mar 2009 10:42:06 +0000 (UTC)
From: Glenn <streb...@hotmail.com>
Subject: [Haskell-beginners] Using The Cabal that comes with GHC 6.10
        on      Windows
To: beginners@haskell.org
Message-ID: <loom.20090307t103559-...@post.gmane.org>
Content-Type: text/plain; charset=us-ascii

Hi,

I'm sure this should be very simple, but I can't find any obvious 
documentation in the GHC doco that tells me how to get started with Cabal.

I've installed GHC 6.10.1, which comes with Cabal.
However, it doesn't seem to come in executable form ?
So, I'm not sure what I need to do - build the executable, presumably ?
I could download the prebuilt executable version of Cabal, but it seems 
pointless to include it in GHC, and then go download another one.

Sorry for this stupid question !
Could anyone give me a hint on how to proceed ?

Thanks ! :)




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

Message: 5
Date: Sat, 07 Mar 2009 18:52:00 +0800
From: Andy Stewart <lazycat.mana...@gmail.com>
Subject: [Haskell-beginners] Re: Using The Cabal that comes with GHC
        6.10 on Windows
To: beginners@haskell.org
Message-ID: <87zlfxbo6n....@debian.domain>
Content-Type: text/plain; charset=us-ascii

Glenn <streb...@hotmail.com> writes:

> Hi,
>
> I'm sure this should be very simple, but I can't find any obvious 
> documentation in the GHC doco that tells me how to get started with Cabal.
>
> I've installed GHC 6.10.1, which comes with Cabal.
> However, it doesn't seem to come in executable form ?
> So, I'm not sure what I need to do - build the executable, presumably ?
> I could download the prebuilt executable version of Cabal, but it seems 
> pointless to include it in GHC, and then go download another one.
>
> Sorry for this stupid question !
> Could anyone give me a hint on how to proceed ?
Hi,

Default, GHC 6.10.1 just including Cabal, if you want use Cabal, you
have to install others package: HTTP, zlib, cabal-install.

Below the detail install method:
------------------------------> method start <------------------------------
1. Install HTTP package:
- Download http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HTTP
- Unpack and execute command:
  ghc --make Setup && ./Setup configure && ./Setup build && sudo ./Setup install
  
2. Install zlib package:
- Download http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib  
- Unpack and execute command:
  ghc --make Setup && ./Setup configure && ./Setup build && sudo ./Setup install
  
3. Install cabal-install package:
- Download 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/cabal-install
- Unpack and execute command:
  ghc --make Setup && ./Setup configure && ./Setup build && sudo ./Setup install
------------------------------> method end   <------------------------------

Then you can use cabal.

Enjoy!

  -- Andy



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

Message: 6
Date: Sat, 07 Mar 2009 13:54:33 +0100
From: ben <benedikt.ahr...@gmx.net>
Subject: [Haskell-beginners] defining own arbitrary :: Gen Int
To: beginners@haskell.org
Message-ID: <49b26e89.90...@gmx.net>
Content-Type: text/plain; charset=ISO-8859-1

Hello,

I would like to define my own arbitrary which should only give naturals,
i. e. which should behave like

instance Arbitrary Integer where
        arbitrary = elements ([0..]).

This definition gives a "multiple definition" error. Is there a way to
hide the definition of arbitrary::Gen Int of QuickCheck, such that I can
use my own definition ?

Thanks a lot in advance,
ben


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

Message: 7
Date: Sat, 7 Mar 2009 14:26:35 +0100
From: Thomas Davie <tom.da...@gmail.com>
Subject: Re: [Haskell-beginners] defining own arbitrary :: Gen Int
To: ben <benedikt.ahr...@gmx.net>
Cc: beginners@haskell.org
Message-ID: <7359927b-8688-4f32-8730-50bef5a0b...@gmail.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On 7 Mar 2009, at 13:54, ben wrote:

> Hello,
>
> I would like to define my own arbitrary which should only give  
> naturals,
> i. e. which should behave like
>
> instance Arbitrary Integer where
>        arbitrary = elements ([0..]).
>
> This definition gives a "multiple definition" error. Is there a way to
> hide the definition of arbitrary::Gen Int of QuickCheck, such that I  
> can
> use my own definition ?

The easiest way is to newtype it, and use fromIntegral to convert:

newtype Natural = N Integer

instance Arbitrary Integer where
   arbitrary = N <$> elements [0..]

instance Integral Natural where
   fromIntegral (N x) = fromIntegral x

Bob


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

Message: 8
Date: Sat, 7 Mar 2009 12:38:46 -0500
From: "Brandon S. Allbery KF8NH" <allb...@ece.cmu.edu>
Subject: Re: [Haskell-beginners] Using The Cabal that comes with GHC
        6.10 on Windows
To: Glenn <streb...@hotmail.com>
Cc: beginners beginners <beginners@haskell.org>
Message-ID: <c3776c52-9566-4809-b6b8-a87a0975b...@ece.cmu.edu>
Content-Type: text/plain; charset="us-ascii"

On 2009 Mar 7, at 5:42, Glenn wrote:
> I've installed GHC 6.10.1, which comes with Cabal.
> However, it doesn't seem to come in executable form ?

Cabal is a compiler-specific library, so it comes with the compiler.   
cabal-install is a compiler-agnostic package on Hackage which installs  
an executable that uses compiler-specific libraries to adapt to the  
installed compiler(s).  So you want to download and install cabal- 
install.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
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/20090307/17ce15be/PGP-0001.bin

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

Message: 9
Date: Sat, 07 Mar 2009 17:06:05 -0700
From: B <bburde...@comcast.net>
Subject: [Haskell-beginners] installing cabal with 6.10 - ubuntu
To: beginners@haskell.org
Message-ID: <gov25d$4g...@ger.gmane.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

So I was wanting to try out some code that relies on 6.10, I'm using 
ubuntu 8.04.  Also, I'd like to have cabal installed so I can get and 
install packages easily.

I found some directions online that said that compiling from source 
might be a good way to go.  I downloaded and compiled ghc 6.10.1, 
installing it locally.  The directions I used:

----------- directions ------------
I use 6.8.3 and 6.10.1 on ubuntu without problems. I always build ghc 
from source. It takes a bit of cpu time, but not much effort on my part.
Assuming I've got an older version of GHC in my path, here's all I do:

        tar -xjf ~/Downloads/ghc-6.10.1-src.tar.bz2
        tar -xjf ~/Downloads/ghc-6.10.1-src-extralibs.tar.bz2
        cd ghc-6.10.1/
        echo "HADDOCK_DOCS = YES" >mk/build.mk
        ./configure --prefix /usr/local/ghc-6.10.1
        make -j
        sudo make install
------- end of  directions --------

Ok so I did this.  It works!  Then, wanting to keep things simple, I 
removed ghc 6.8.3 so I'd only have one compiler and libraries around - 
lessening the chance of wierd conflicts.  Done.

Now to install cabal-install.  Directions I got:

       - unpack cabal-install-0.6.2.tar.gz somewhere
       - cd into the resulting directory and run "sh bootstrap.sh"
       - add "~/.cabal/bin" to you path.

Unfortunately, this doesn't work for me.  bootstrap.sh requires parsec 
and network.  parsec, in turn, requires mtl.

- installed mtl
- installed parsec

Ok.  Now when I go to build network I get this:
Could not find module `Data.Generics':
       it is a member of package base-3.0.3.0, which is hidden

According to google, the above message actually indicates that 'syb' is 
needed, the bug is here:
http://hackage.haskell.org/trac/ghc/ticket/2980

- installed syb-0.1.0.0.
- still get the same message.

At this point I'm stuck!

I should say that I'm using this to install all these things:

runhaskell Setup configure --user
runhaskell Setup build
runhaskell Setup install

So everything is installed 'locally' and not globally.

Thanks for any help with this - I feel like this is harder than it is 
supposed to be, what am I missing??



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

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


End of Beginners Digest, Vol 9, Issue 8
***************************************

Reply via email to