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: testing and the culture of Haskell (Brandon S. Allbery KF8NH)
2. Brainfuck interpreter stack overflow (Edgar Klerks)
3. Cannot rebuild GHC 6.12.1 due to Cabal type conflict
(James Britt)
4. Re: Brainfuck interpreter stack overflow (Stephen Tetley)
5. Re: Re: testing and the culture of Haskell (Maciej Piechotka)
6. Re: Re: testing and the culture of Haskell
(Stephen Blackheath [to Haskell-Beginners])
7. Brainfuck interpreter stack overflow (Edgar Klerks)
----------------------------------------------------------------------
Message: 1
Date: Wed, 20 Jan 2010 19:50:24 -0500
From: "Brandon S. Allbery KF8NH" <[email protected]>
Subject: Re: [Haskell-beginners] testing and the culture of Haskell
To: Amy de Buitl?ir <[email protected]>
Cc: [email protected], Michael Easter <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
On Jan 20, 2010, at 05:31 , Amy de Buitléir wrote:
> properties and writing tests. If I were going to develop a large
> application in Haskell, I'd try to honour the spirit of TDD by
> defining properties before implementing functions.
This is a lot like "programming by contract", btw. (Just something to
think about.) It's also where you can best take advantage of static
typing, by implementing the properties as types so the type system
helps you guarantee correctness.
--
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/20100120/33957d18/PGP-0001.bin
------------------------------
Message: 2
Date: Wed, 20 Jan 2010 16:45:41 +0100
From: Edgar Klerks <[email protected]>
Subject: [Haskell-beginners] Brainfuck interpreter stack overflow
To: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Skipped content of type multipart/alternative-------------- next part
--------------
A non-text attachment was scrubbed...
Name: bf.hs
Type: application/octet-stream
Size: 4769 bytes
Desc: not available
Url :
http://www.haskell.org/pipermail/beginners/attachments/20100120/db94f22a/bf-0001.obj
------------------------------
Message: 3
Date: Thu, 21 Jan 2010 00:27:33 -0700
From: James Britt <[email protected]>
Subject: [Haskell-beginners] Cannot rebuild GHC 6.12.1 due to Cabal
type conflict
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hey all.
I wanted to rebuild GHC 6.12.1 from source (a downloaded tarball).
After the initial install I went and updated Cabal (from a tarball
grabbed from Hackage).
When I now try to do a rebuild of GHC, I get this error
compiler/main/Packages.lhs:233:63:
Couldn't match expected type `InstalledPackageInfo_ String'
against inferred type
`Cabal-1.8.0.2:Distribution.InstalledPackageInfo.InstalledPackageInfo_
m'
Expected type: [InstalledPackageInfo_ String]
Inferred type:
[Cabal-1.8.0.2:Distribution.InstalledPackageInfo.InstalledPackageInfo_
m]
In the second argument of `map', namely `conf'
In the first argument of `return', namely
`(map installedPackageInfoToPackageConfig conf)'
make[1]: *** [compiler/stage1/build/Packages.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
(also here: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=16380#a16380)
I'm running the build like this:
make distclean
sh boot
./configure --enable-shared
make -j 2
but (I'm guessing) it's looking at the already-installed Cabal libs and
not liking what it's getting.
Any ideas on how to get past this?
Thanks,
James Britt
--
www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
www.neurogami.com - Smart application development
------------------------------
Message: 4
Date: Thu, 21 Jan 2010 08:28:01 +0000
From: Stephen Tetley <[email protected]>
Subject: Re: [Haskell-beginners] Brainfuck interpreter stack overflow
Cc: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
Hello Edgar
Does the interpreter fail actually fail on particular input rather
than by it running to long?
Tail recursion isn't very important for Haskell as it is a lazy
language, however for any Parsec parser avoiding _left recursion_ is
crucially important as it is a LL recursive descent parser.
Also how are you running the program - GHCi, Hugs? The import
declarations for Parsec suggest that you are using a old version.
Best wishes
Stephen
------------------------------
Message: 5
Date: Thu, 21 Jan 2010 08:39:11 +0000
From: Maciej Piechotka <[email protected]>
Subject: [Haskell-beginners] Re: Re: testing and the culture of
Haskell
To: [email protected]
Message-ID: <1264063151.16901.15.ca...@picard>
Content-Type: text/plain; charset="UTF-8"
On Wed, 2010-01-20 at 18:13 -0500, Isaac Dupree wrote:
> Heinrich Apfelmus wrote:
> > However, in a sense, one can interpret the pure in purely functional as
> > a property of the type constructor (->) , i.e. a function of type (a ->
> > b) is guaranteed to not have side effects. In this light, ML and Scheme
> > are lacking a very important type: they only have functions with side
> > effects.
>
> > Or more precisely, their type system does not distinguish
> > between functions with and without side effects.
>
> that's not actually more precise! Haskell doesn't entirely do that
> either. consider:
> f :: Int -> IO Int
> f x = return (x + 1)
> No side effects! But other ->IO typed values do yield side-effects.
>
> It is exactly as if ML and Scheme contain only the type of (->) composed
> with IO. (Well, actually Scheme is dynamically typed so it's a bit
> silly to say so..) (and Scheme allows functions with zero arguments,
> which are different from its non-side-effecting values.. not sure about ML)
>
> -Isaac
Hmm. Is it possible to distinguish them?
Consider:
f :: Integer -> IO Integer
f x = if cond
then putStrLn "Hello World!" >> return x
else return (x + 1)
where cond = ...
As far as I remember it is impossible to determine in general if cond
will ever be true[1]. Hence it is unknown in general if f is pure or
have side-effects.
Generally IO marks that function have side effects so there should be no
point in testing if it has none (although it may be worth to check if
only the specific side effects occurred). So it rather (forgetting about
unsafe* functions): whenever v is not a IO it has no effects[2].
Regards
[1] However as Int is bounded it is possible for it
[2] I am not sure how correct it is but I think about a -> IO b as
function from a to some sub-program returning b with haskell program
being combination of programs rather then a unpure function from a to b.
------------------------------
Message: 6
Date: Thu, 21 Jan 2010 23:20:34 +1300
From: "Stephen Blackheath [to Haskell-Beginners]"
<[email protected]>
Subject: Re: [Haskell-beginners] Re: testing and the culture of
Haskell
To: Isaac Dupree <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
Isaac,
Isaac Dupree wrote:
> Heinrich Apfelmus wrote:
>> Or more precisely, their type system does not distinguish
>> between functions with and without side effects.
>
> that's not actually more precise! Haskell doesn't entirely do that
> either. consider:
> f :: Int -> IO Int
> f x = return (x + 1)
> No side effects! But other ->IO typed values do yield side-effects.
All Haskell functions are pure without exception. For example:
greet :: String -> IO ()
greet name = putStrLn $ "Hello, "++name
This is a pure function from String to IO (). This function (like all
Haskell functions) has no side effects. Its return value of type IO ()
merely _represents_ an IO action. The runtime system knows how to act
on this representation.
This also means that there is no such thing in Haskell as marking a
function as side-effecting.
This distinction may be subtle, but it's important.
Steve
------------------------------
Message: 7
Date: Thu, 21 Jan 2010 12:06:34 +0100
From: Edgar Klerks <[email protected]>
Subject: [Haskell-beginners] Brainfuck interpreter stack overflow
To: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Hi Stephen,
It parses the source fine, but with complicated programs with lots of
loops -like calculating fibonacci- it fails after a while with a stack
overflow. However it does produce correct output until that point.
I am running it under ghci now, maybe I should try to compile it.
I didn't know, I used an old version of parsec.
I am using this one:
http://hackage.haskell.org/packages/archive/parsec/3.0.0/doc/html/Text-Parsec.html
Is that version ok?
Thanks for your help,
Edgar
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20100121/2bec063e/attachment.html
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 19, Issue 17
*****************************************