[Haskell-cafe] Re:Haskell-Cafe Digest, Vol 71, Issue 30

silent_stream silent_stream at 126.com
Tue Jul 21 03:39:59 EDT 2009


When I compile curl-1.3.5 on Windows xp. I run the prompt "runghc Setup.hs configure " I got the following error
 
Setup.hs: Missing dependency on a foreign library:
* Missing C library: curl
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
 
I don't know how to fix this problem. Who knows? Please come to help me .




在2009-07-21 09:43:45,haskell-cafe-request at haskell.org 写道:
>Send Haskell-Cafe mailing list submissions to
>	haskell-cafe at haskell.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
>	http://www.haskell.org/mailman/listinfo/haskell-cafe
>or, via email, send a message with subject or body 'help' to
>	haskell-cafe-request at haskell.org
>
>You can reach the person managing the list at
>	haskell-cafe-owner at haskell.org
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of Haskell-Cafe digest..."
>
>
>Today's Topics:
>
>   1. Hackage and version control (Vasili I. Galchin)
>   2. FFI problem - possibility of CStringLen overflow? (Robin Green)
>   3. Re: FFI problem - possibility of CStringLen overflow?
>      (Bulat Ziganshin)
>   4. Re: Hackage and version control (Magnus Therning)
>   5. Re: was: Debugging methods for haskell structured	data types
>      the right way in haskell (Jon Fairbairn)
>   6. Re: Hackage and version control (Bulat Ziganshin)
>   7. Re: Hackage and version control (Robin Green)
>   8. Re: Hackage and version control (Miguel Mitrofanov)
>   9. Re: Hackage and version control (Joe Fredette)
>  10. Re: Hackage and version control (Wolfgang Jeltsch)
>  11. Re[2]: [Haskell-cafe] Hackage and version control
>      (Bulat Ziganshin)
>  12. Re: ANN: cautious-file 0.1.1: Ways to write a file
>      cautiously, to avoid data loss (Robin Green)
>  13. Re: Implicit concatenation in list comprehensions (Roel van Dijk)
>  14. Re: ANN: cautious-file 0.1.1: Ways to write a file
>      cautiously, to avoid data loss (Felipe Lessa)
>  15. Typeclass default implementation in subclasses (Andy Gimblett)
>  16. ICFP contest write-up (Rafael Gustavo da Cunha Pereira Pinto)
>  17. SpecConstr difficulties (Reiner Pope)
>  18. Re: Typeclass default implementation in subclasses (Roel van Dijk)
>  19. ANNOUNCE: graphviz-2999.1.0.1 (Ivan Lazar Miljenovic)
>  20. Re: Implicit concatenation in list comprehensions (Roel van Dijk)
>  21. RE: Implicit concatenation in list comprehensions
>      (Sittampalam, Ganesh)
>  22. Re: Implicit concatenation in list comprehensions (Roel van Dijk)
>  23. Re: FFI problem - possibility of CStringLen overflow?
>      (Jason Dagit)
>  24. Anglohaskell - wifi signups (Philippa Cowderoy)
>  25. Pruning the Front Page (Thomas DuBuisson)
>  26. Re: Pruning the Front Page (Don Stewart)
>  27. Re: Implicit concatenation in list comprehensions
>      (Max Bolingbroke)
>  28. Re: Ambiguous type variable - help! (phil at beadling.co.uk)
>  29. Re: Implicit concatenation in list comprehensions
>      (Nicolas Pouillard)
>  30. Re: Implicit concatenation in list comprehensions (porges at porg.es)
>  31. Re: Pruning the Front Page (Gwern Branwen)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Mon, 20 Jul 2009 03:26:52 -0500
>From: "Vasili I. Galchin" <vigalchin at gmail.com>
>Subject: [Haskell-cafe] Hackage and version control
>To: haskell-cafe at haskell.org
>Cc: Galchin Vasili <vigalchin at gmail.com>
>Message-ID:
>	<5ae4f2ba0907200126j56a497earb06ae885dbb7bb81 at mail.gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Hello,
>
>     It seems to me that Hackage doesn't provide version control, e.g. check
>out and check in. Am I incorrect?
>
>Kind regards, Vasili
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090720/9a2c1cb3/attachment-0001.html
>
>------------------------------
>
>Message: 2
>Date: Mon, 20 Jul 2009 03:24:49 +0100
>From: Robin Green <greenrd at greenrd.org>
>Subject: [Haskell-cafe] FFI problem - possibility of CStringLen
>	overflow?
>To: haskell-cafe at haskell.org
>Message-ID: <20090720032449.690fdf47 at fedora>
>Content-Type: text/plain; charset=US-ASCII
>
>While rewriting cautious-file to use ByteStrings and FFI just now, I
>came across this potential problem:
>
>Why does the FFI specification define CStringLen as (Ptr CChar, Int)?
>As the FFI specification itself notes, Haskell 98 implementors are
>allowed to have a quite small range for Int (only up to 2^29-1) - so you
>could in principle have a very large String which cannot be represented
>as a CStringLen, or a very large CString which cannot be represented as
>a CStringLen. They would take up wads of memory, so this has probably
>never happened yet, but it's in principle possible, no?
>
>If so, what are the implications of this for code correctness?
>-- 
>Robin
>
>
>------------------------------
>
>Message: 3
>Date: Mon, 20 Jul 2009 12:49:38 +0400
>From: Bulat Ziganshin <bulat.ziganshin at gmail.com>
>Subject: Re: [Haskell-cafe] FFI problem - possibility of CStringLen
>	overflow?
>To: Robin Green <greenrd at greenrd.org>
>Cc: haskell-cafe at haskell.org
>Message-ID: <1096519401.20090720124938 at gmail.com>
>Content-Type: text/plain; charset=us-ascii
>
>Hello Robin,
>
>Monday, July 20, 2009, 6:24:49 AM, you wrote:
>
>> Why does the FFI specification define CStringLen as (Ptr CChar, Int)?
>
>1. i think it was done to simplify using the api
>2. hugs usually don't used for data-massive apps, it's niche is learning and
>quick development
>
>-- 
>Best regards,
> Bulat                            mailto:Bulat.Ziganshin at gmail.com
>
>
>
>------------------------------
>
>Message: 4
>Date: Mon, 20 Jul 2009 10:03:56 +0100
>From: Magnus Therning <magnus at therning.org>
>Subject: Re: [Haskell-cafe] Hackage and version control
>To: "Vasili I. Galchin" <vigalchin at gmail.com>
>Cc: haskell-cafe at haskell.org
>Message-ID:
>	<e040b520907200203w2f6392acy62e6571899866253 at mail.gmail.com>
>Content-Type: text/plain; charset=UTF-8
>
>On Mon, Jul 20, 2009 at 9:26 AM, Vasili I. Galchin<vigalchin at gmail.com> wrote:
>> Hello,
>>
>> Â Â Â Â  It seems to me that Hackage doesn't provide version control, e.g. check
>> out and check in. Am I incorrect?
>
>Hackage is, AFAIU, a repository where _released_ versions of
>libraries/tools/etc related to Haskell can be kept.  It is not fully
>comparable to SourceForge, Github, or any other _source hosting_
>service.
>
>If you are looking for source hosting then take a look at SF, Github,
>Google Code, or something like that.  Then upload _released_ versions
>to Hackage.  IIRC there is also the possibility of having a Darcs repo
>on community.haskell.org.
>
>/M
>
>-- 
>Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
>magnusï¼ therning.org          Jabber: magnusï¼ therning.org
>http://therning.org/magnus         identi.ca|twitter: magthe
>
>
>------------------------------
>
>Message: 5
>Date: Mon, 20 Jul 2009 10:26:02 +0100
>From: Jon Fairbairn <jon.fairbairn at cl.cam.ac.uk>
>Subject: [Haskell-cafe] Re: was: Debugging methods for haskell
>	structured	data types the right way in haskell
>To: haskell-cafe at haskell.org
>Message-ID: <wfd47viu39.fsf at calligramme.charmers>
>Content-Type: text/plain; charset=utf-8
>
>Fernan Bolando <fernanbolando at mailc.net> writes:
>
>> On Sun, Jul 19, 2009 at 7:40 AM, wren ng thornton<wren at freegeek.org> wrote:
>>> Fernan Bolando wrote:
>>>>
>>>> The intention is z0 is a system parameter and database, it contains a
>>>> set of info needed to define a particular simulation
>>>
>>> A single-constructor ADT, especially with the labeled-fields syntax, is
>>> pretty close to C structs; no need to reinvent them and give yourself
>>> headaches.
>>>
>>>
>>> Really, the only thing you should be using lists for is a variable-length
>>> sequence of elements drawn from the same type and distinguished only by
>>> their position in the sequence.
>>
>> This is the kind of code recommendations I was looking.
>
>I'd worked out a longer reply over the weekend, but wren got there first
>(It hadn't occured to me that anyone would write that much code without
>knowing about algebraic types, so thought something else was going on).
>
>I'd like to add that thinking about the C code for a programme like this
>is counterproductive. If you are doing various mathematical operations,
>it's better to go straight from the mathematics to Haskell, and work out
>the appropriate abstractions (in Haskell) for the operations you are
>using. You'll generally end up with much shorter code that is easier to
>maintain.
>
>It might be worth pointing out that you can do things with Haskell data
>structures that you can't do conveniently in C. For example, if you were
>doing something that involved calculating the determinants of matrices
>fairly often, but you didn't know in advance which matrices, you could
>define your own matrix type like this (roughly):
>
>data MyMatrix t = MM {theNumbers:: Matrix t, my_determinant:: t}
>
>make_matrix m
>    = MM {theNumbers = m, 
>          my_determinant = determinant m
>         }
>
>and then use make_matrix whenever you make a new matrix and
>my_determinant whenever you want a determinant.
>
>Now, although to a C programmer this looks like you calculate the
>determinant of every matrix, laziness means that you only calculate the
>ones you use, and calculate them at most once for each matrix.
>
>
>-- 
>Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk
>
>
>
>
>------------------------------
>
>Message: 6
>Date: Mon, 20 Jul 2009 13:27:06 +0400
>From: Bulat Ziganshin <bulat.ziganshin at gmail.com>
>Subject: Re: [Haskell-cafe] Hackage and version control
>To: "Vasili I. Galchin" <vigalchin at gmail.com>
>Cc: haskell-cafe at haskell.org
>Message-ID: <1393740130.20090720132706 at gmail.com>
>Content-Type: text/plain; charset=iso-8859-1
>
>Hello Vasili,
>
>Monday, July 20, 2009, 12:26:52 PM, you wrote:
>
>>      It seems to me that Hackage doesn't provide version control,
>> e.g. check out and check in. Am I incorrect?
>
>i recommend you to use either codeplex or code.google
>
>
>-- 
>Best regards,
> Bulat                            mailto:Bulat.Ziganshin at gmail.com
>
>
>
>------------------------------
>
>Message: 7
>Date: Mon, 20 Jul 2009 04:25:25 +0100
>From: Robin Green <greenrd at greenrd.org>
>Subject: Re: [Haskell-cafe] Hackage and version control
>To: haskell-cafe at haskell.org
>Message-ID: <20090720042525.3e02b4ae at fedora>
>Content-Type: text/plain; charset=UTF-8
>
>On Mon, 20 Jul 2009 10:03:56 +0100
>Magnus Therning <magnus at therning.org> wrote:
>
>> On Mon, Jul 20, 2009 at 9:26 AM, Vasili I.
>> Galchin<vigalchin at gmail.com> wrote:
>> > Hello,
>> >
>> > Â Â Â Â  It seems to me that Hackage doesn't provide version control,
>> > e.g. check out and check in. Am I incorrect?
>> 
>> Hackage is, AFAIU, a repository where _released_ versions of
>> libraries/tools/etc related to Haskell can be kept.  It is not fully
>> comparable to SourceForge, Github, or any other _source hosting_
>> service.
>> 
>> If you are looking for source hosting then take a look at SF, Github,
>> Google Code, or something like that.  Then upload _released_ versions
>> to Hackage.  IIRC there is also the possibility of having a Darcs repo
>> on community.haskell.org.
>
>Yes, and darcs repos can also be hosted on patch-tag.com.
>community.haskell.org requires you to wait for a volunteer to review
>every new project request. Although, you don't need to make a
>project request if you only want a 1-developer repository. And by the
>way, it only hosts Haskell-related projects, not arbitrary darcs
>repositories.
>
>patch-tag.com doesn't have those constraints.
>-- 
>Robin
>
>
>------------------------------
>
>Message: 8
>Date: Mon, 20 Jul 2009 13:41:40 +0400
>From: Miguel Mitrofanov <miguelimo38 at yandex.ru>
>Subject: Re: [Haskell-cafe] Hackage and version control
>To: Bulat Ziganshin <Bulat.Ziganshin at gmail.com>
>Cc: "Vasili I. Galchin" <vigalchin at gmail.com>,
>	haskell-cafe at haskell.org
>Message-ID: <A8F1BE77-CDC2-4800-9072-78B446CDF84E at yandex.ru>
>Content-Type: text/plain; charset=US-ASCII; format=flowed
>
>Or patch-tag.com
>
>On 20 Jul 2009, at 13:27, Bulat Ziganshin wrote:
>
>> Hello Vasili,
>>
>> Monday, July 20, 2009, 12:26:52 PM, you wrote:
>>
>>>      It seems to me that Hackage doesn't provide version control,
>>> e.g. check out and check in. Am I incorrect?
>>
>> i recommend you to use either codeplex or code.google
>>
>>
>> -- 
>> Best regards,
>> Bulat                            mailto:Bulat.Ziganshin at gmail.com
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
>
>------------------------------
>
>Message: 9
>Date: Mon, 20 Jul 2009 06:36:28 -0400
>From: Joe Fredette <jfredett at gmail.com>
>Subject: Re: [Haskell-cafe] Hackage and version control
>To: Bulat Ziganshin <Bulat.Ziganshin at gmail.com>
>Cc: "Vasili I. Galchin" <vigalchin at gmail.com>,
>	haskell-cafe at haskell.org
>Message-ID: <4A6448AC.6060202 at gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Don't forget about Patch-tag!
>
>Bulat Ziganshin wrote:
>> Hello Vasili,
>>
>> Monday, July 20, 2009, 12:26:52 PM, you wrote:
>>
>>   
>>>      It seems to me that Hackage doesn't provide version control,
>>> e.g. check out and check in. Am I incorrect?
>>>     
>>
>> i recommend you to use either codeplex or code.google
>>
>>
>>   
>-------------- next part --------------
>A non-text attachment was scrubbed...
>Name: jfredett.vcf
>Type: text/x-vcard
>Size: 296 bytes
>Desc: not available
>Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090720/42d7f039/jfredett-0001.vcf
>
>------------------------------
>
>Message: 10
>Date: Mon, 20 Jul 2009 12:40:14 +0200
>From: Wolfgang Jeltsch <g9ks157k at acme.softbase.org>
>Subject: Re: [Haskell-cafe] Hackage and version control
>To: haskell-cafe at haskell.org
>Message-ID: <200907201240.14760.g9ks157k at acme.softbase.org>
>Content-Type: text/plain;  charset="utf-8"
>
>Am Montag, 20. Juli 2009 05:25 schrieb Robin Green:
>> community.haskell.org requires you to wait for a volunteer to review
>> every new project request.
>
>However, response times are usually low.
>
>Best wishes,
>Wolfgang
>
>
>------------------------------
>
>Message: 11
>Date: Mon, 20 Jul 2009 14:41:25 +0400
>From: Bulat Ziganshin <bulat.ziganshin at gmail.com>
>Subject: Re[2]: [Haskell-cafe] Hackage and version control
>To: Joe Fredette <jfredett at gmail.com>
>Cc: "Vasili I. Galchin" <vigalchin at gmail.com>,	Bulat Ziganshin
>	<Bulat.Ziganshin at gmail.com>, haskell-cafe at haskell.org
>Message-ID: <121430820.20090720144125 at gmail.com>
>Content-Type: text/plain; charset=us-ascii
>
>Hello Joe,
>
>Monday, July 20, 2009, 2:36:28 PM, you wrote:
>
>afaik it provides minimal features, only VCS, while sitea i mentioned
>provides full service for OSS developer
>
>> Don't forget about Patch-tag!
>
>> Bulat Ziganshin wrote:
>>> Hello Vasili,
>>>
>>> Monday, July 20, 2009, 12:26:52 PM, you wrote:
>>>
>>>   
>>>>      It seems to me that Hackage doesn't provide version control,
>>>> e.g. check out and check in. Am I incorrect?
>>>>     
>>>
>>> i recommend you to use either codeplex or code.google
>>>
>>>
>>>   
>
>
>
>-- 
>Best regards,
> Bulat                            mailto:Bulat.Ziganshin at gmail.com
>
>
>
>------------------------------
>
>Message: 12
>Date: Mon, 20 Jul 2009 06:09:50 +0100
>From: Robin Green <greenrd at greenrd.org>
>Subject: Re: [Haskell-cafe] ANN: cautious-file 0.1.1: Ways to write a
>	file	cautiously, to avoid data loss
>To: haskell-cafe at haskell.org
>Message-ID: <20090720060950.076176fa at fedora>
>Content-Type: text/plain; charset=US-ASCII
>
>I've since uploaded two new versions with the following changes:
>
>0.1.2: Fixed an issue where it would clobber symbolic links to files,
>which is usually not what you want. Test case added for this.
>
>0.1.3: ByteString support! FFI is also now used under the hood to do
>things in a slightly less hacky way.
>
>-- 
>Robin
>
>On Sun, 19 Jul 2009 23:35:34 +0100
>Robin Green <greenrd at greenrd.org> wrote:
>
>> I'm pleased to announce the first public release of cautious-file:
>> 
>> http://hackage.haskell.org/package/cautious-file
><snip>
>
>
>------------------------------
>
>Message: 13
>Date: Mon, 20 Jul 2009 13:27:57 +0200
>From: Roel van Dijk <vandijk.roel at gmail.com>
>Subject: Re: [Haskell-cafe] Implicit concatenation in list
>	comprehensions
>To: haskell-cafe <haskell-cafe at haskell.org>
>Message-ID:
>	<ab9dc6fa0907200427g27ef73a1vd5b852187e6b9745 at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>I think the tuple sections are a great idea! It also makes tuple types
>and constructors more alike:
>
>x :: (,) String Double
>x = (,) "Pi" 3.14159
>
>I can also see some uses in writing pointfree code. I would definitely
>want this in a future GHC (or any other Haskell compiler/interpreter)
>release.
>
>I'm not so sure about the list comprehension concatenation. Like
>Thomas Schilling wrote, it is only a bit shorter then writing it with
>the current syntax. So I'm not sure if it is worth the cost.
>
>
>------------------------------
>
>Message: 14
>Date: Mon, 20 Jul 2009 09:02:54 -0300
>From: Felipe Lessa <felipe.lessa at gmail.com>
>Subject: Re: [Haskell-cafe] ANN: cautious-file 0.1.1: Ways to write a
>	file	cautiously, to avoid data loss
>To: haskell-cafe at haskell.org
>Message-ID: <20090720120254.GA6396 at kira.casa>
>Content-Type: text/plain; charset=us-ascii
>
>Nice library!
>
>On Sun, Jul 19, 2009 at 11:35:34PM +0100, Robin Green wrote:
>> A variant, writeFileWithBackup, also allows you to supply a custom
>> backup computation to backup old copy(ies) of the destination file
>
>It would be nice to have the backup action receive the file name
>as a parameter, so it would be possible to have a library of
>possible backup strategies. :)
>
>--
>Felipe.
>
>
>------------------------------
>
>Message: 15
>Date: Mon, 20 Jul 2009 13:16:03 +0100
>From: Andy Gimblett <haskell at gimbo.org.uk>
>Subject: [Haskell-cafe] Typeclass default implementation in subclasses
>To: haskell-cafe at haskell.org
>Message-ID: <5A40667D-984C-4F0A-A7E3-F21980B60CE9 at gimbo.org.uk>
>Content-Type: text/plain; charset=US-ASCII; format=flowed
>
>Hi all,
>
>This email is literate Haskell.  I have a question about default
>implementations of typeclasses.
>
> > {-# LANGUAGE TypeSynonymInstances #-}
>
> > module Thing where
>
> > import Text.PrettyPrint.HughesPJ
>
>Let say I want to pretty-print some values, enclosed in double quotes.
>The natural thing to do (within the HughesPJ pretty-printing
>framework, anyway - and that's where I am in this problem's wider
>context) is:
>
> > ppQuote :: Show a => a -> Doc
> > ppQuote = doubleQuotes . text . show
>
>Now, this works nicely for (say) Int:
>
> > x :: Int
> > x = 1
>
>*Thing> ppQuote x
>"1"
>
>But less nicely for String and Char, because their Show instances
>already insert double/single quotes respectively:
>
> > y :: String
> > y = "hello"
> > z :: Char
> > z = 'a'
>
>*Thing> ppQuote y
>""hello""
>*Thing> ppQuote z
>"'a'"
>
>I don't want this.  I'd like them to be "hello" and "a" respectively.
>
>So I thought I'd create a typeclass, whose default implementation is
>as above...
>
> > class (Show a) => Quotable a where
> >   quote :: a -> Doc
> >   quote = ppQuote
>
>... but with specialised instances for String and Char (the former
>seems to need the TypeSynonymInstances extension?):
>
> > instance Quotable String where
> >   quote = text . show -- don't need the doubleQuotes call for String
> > instance Quotable Char where
> >   quote c = quote [c] -- just lift it to String
>
>Unfortunately, while this works great for String and Char...
>
>*Thing> quote y
>"hello"
>*Thing> quote z
>"a"
>
>... the "default implementation" mechanism doesn't work as I'd
>expect/hope:
>
>*Thing> quote x
>
><interactive>:1:0:
>     No instance for (Quotable Int)
>       arising from a use of `quote' at <interactive>:1:0-6
>     Possible fix: add an instance declaration for (Quotable Int)
>     In the expression: quote x
>     In the definition of `it': it = quote x
>
>What I would _like_ would be for the compiler to say "OK, the Quotable
>class depends on the Show class, and Int is an instance of Show so Int
>is also an instance of Quotable, having the default implementation
>(since there isn't a specialised one for it)" - but clearly it
>doesn't.
>
>Please can someone tell me why this doesn't happen, and if there is a
>way of making it happen?  Also, if there's a more sensible way of
>attacking this whole problem, I'd be curious to hear it.
>
>I should perhaps add that this isn't a huge problem for me, because my
>instances will in practice tend to be String and Char anyway, and one
>can of course add Quotable instances for anything else easily enough -
>but I'm curious now I've come this far.  :-)
>
>Many thanks!
>
>-Andy
>
>
>
>------------------------------
>
>Message: 16
>Date: Mon, 20 Jul 2009 09:30:24 -0300
>From: Rafael Gustavo da Cunha Pereira Pinto
>	<RafaelGCPP.Linux at gmail.com>
>Subject: [Haskell-cafe] ICFP contest write-up
>To: Haskell Caf? <haskell-cafe at haskell.org>
>Message-ID:
>	<351ff25e0907200530s2c998777g482bd7674ad5d85a at mail.gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>For all Portuguese reading haskellers, I am describing my ICFP 2009 contest
>write-up on my blog. Feel free to comment.
>
>http://rafaelgcpp.blogspot.com/search/label/ICFP2009
>
>
>For the non-Portuguese readers, Google translation tools do a lousy job, but
>it is still readable.
>
>Regards
>
>Rafael Gustavo da Cunha Pereira Pinto
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090720/30061e23/attachment-0001.html
>
>------------------------------
>
>Message: 17
>Date: Mon, 20 Jul 2009 22:09:09 +0930
>From: Reiner Pope <reiner.pope at gmail.com>
>Subject: [Haskell-cafe] SpecConstr difficulties
>To: Haskell Cafe mailing list <haskell-cafe at haskell.org>
>Message-ID:
>	<4cf038ee0907200539w1676a6e7ub29350cf5025b91a at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>Hi everyone,
>
>I've been having some trouble getting SpecConstr to work as I want it
>to. The following example (see end of email) came up in some code I
>was playing around with. The loops g1 and g2 both compute the same
>thing: the maximum element of the "list" (which has been fused away)
>of numbers from 1 to 10.
>
>Since 'maximum' is a foldl1 not a foldl, I use a strict Maybe type as
>an accumulator. The Maybe gets filled after the first element is seen,
>so the Maybe is a Just for almost the entire running of the loop.
>
>It would be good to have this recognised by SpecConstr, to create an
>optimised loop for the Just case. This does indeed happen for g1, but
>not for g2.
>
>My difficulty is that I am only able to produce code similar to g2,
>i.e. where the pattern matching is in a separate function, 'expose',
>because the 'expose' function is implemented in a type-class, like in
>stream-fusion. Is there some way to keep the SpecConstr while leaving
>the 'expose' as a separate function?
>
>Here is the code:
>
>> {-# LANGUAGE BangPatterns #-}
>>
>> module Test(ans1,ans2) where
>>
>> import Prelude hiding(Maybe(..))
>>
>> data Maybe a = Just !a | Nothing
>>
>> Nothing `mapp` Just b = Just b
>> Just a `mapp` Just b = Just (max a b)
>>
>> ans1 = g1 Nothing (0::Int)
>>
>> g1 m !n = case m of
>>            Nothing -> if n > 10 then m else g1 (m `mapp` Just n) (n+1)
>>            Just x -> if n > 10 then m else g1 (m `mapp` Just n) (n+1)
>>
>> ans2 = g2 Nothing (0::Int)
>>
>> g2 m !n = expose m (if n > 10 then m else g2 (m `mapp` Just n) (n+1))
>> expose Nothing  b = b
>> expose (Just a) b = a `seq` b
>
>On a similar note, when I was having difficulties with this problem, I
>started to wonder if it would be possible to come up with a more
>direct way to tell GHC, "do SpecConstr on this variable". From reading
>the source code of the stream-fusion package, it seems that the
>current way of doing this is with 'expose' functions like I wrote
>below. Could we instead have a {-# SPECCONSTR #-} pragma, to be used
>on function arguments, like:
>
>foo {-# SPECCONSTR #-} x y {-# SPECCONSTR #-} z = ...
>
>This pragma should say to the GHC something like "ignore conditions
>H2, H5 and H6 of the SpecConstr paper, for this function and this
>argument".
>
>Cheers,
>Reiner
>
>
>------------------------------
>
>Message: 18
>Date: Mon, 20 Jul 2009 14:40:26 +0200
>From: Roel van Dijk <vandijk.roel at gmail.com>
>Subject: Re: [Haskell-cafe] Typeclass default implementation in
>	subclasses
>To: Andy Gimblett <haskell at gimbo.org.uk>
>Cc: haskell-cafe at haskell.org
>Message-ID:
>	<ab9dc6fa0907200540s211a67bby6107c556bb42f171 at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>This post is also literate haskell. By enabling these potentially
>dangerous extensions you'll get the behaviour you want.
>
>> {-# LANGUAGE TypeSynonymInstances #-}
>> {-# LANGUAGE UndecidableInstances #-}
>> {-# LANGUAGE FlexibleInstances #-}
>> {-# LANGUAGE OverlappingInstances #-}
>
>> module Thing where
>
>> import Text.PrettyPrint.HughesPJ
>
>> ppQuote :: Show a => a -> Doc
>> ppQuote = doubleQuotes . text . show
>
>> x :: Int
>> x = 1
>
>> y :: String
>> y = "hello"
>> z :: Char
>> z = 'a'
>
>> class (Show a) => Quotable a where
>>   quote :: a -> Doc
>>   quote = ppQuote
>
>> instance (Show a) => Quotable a
>
>> instance Quotable String where
>>   quote = text . show -- don't need the doubleQuotes call for String
>
>> instance Quotable Char where
>>   quote c = quote [c] -- just lift it to String
>
>Example:
>
>*Thing> quote "pi"
>"pi"
>*Thing> quote 3.14159
>"3.14159"
>
>
>------------------------------
>
>Message: 19
>Date: Mon, 20 Jul 2009 23:08:49 +1000
>From: Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com>
>Subject: [Haskell-cafe] ANNOUNCE: graphviz-2999.1.0.1
>To: haskell at haskell.org
>Cc: haskell-cafe at haskell.org
>Message-ID: <87vdlnwlge.fsf at gmail.com>
>Content-Type: text/plain; charset=us-ascii
>
>This is a bug-fix release to fix the various Attribute-related problems
>in the previous release (2999.0.0.0) spotted mainly by Zsolt
>Dollenstein.  Please disregard version 2999.1.0.0; it had a small bug.
>Similarly, people should avoid using 2999.0.0.0 unless they don't use
>any Either-based Attributes.
>
>The problem (which took me a while to realise) was that whilst I was
>using Either to denote that an attribute could take one of two different
>types of values (e.g. Bool and String) and the parsing for that worked.
>However, since I was using Show (I know it's bad, it was on my TODO,
>remember?)  to generate the Dot code, then whenever one of these values
>was converted then either Left or Right would appear, and GraphViz
>doesn't seem to like that for some reason...
>
>I also took the opportunity to define custom types for more Attributes
>(as they only accept certain String values).  Furthermore, GraphViz
>states that attributes that can accept a boolean value are set to True
>when the attribute is listed on its own; the library now does this even
>for those Attributes that use a custom type that combines Bool with
>something else.  One other small change is that the Color Attribute now
>takes in a list of Colors; if you only want one, use a singleton list
>(it was either that or a custom datatype that takes either a single
>Color or a list of Colors...).
>
>Note that 2999.1.0.0 accidentally only had singleton Color values for
>the Color Attribute rather than a list, hence the quick version bump.
>
>Nothing else has changed in the library apart from the Attributes.
>
>Regarding my request in the previous email about the possible new layout
>of the DotGraph datatype:
>
>How many people actually build DotGraphs by hand or pull them apart by
>hand?  If there were getNodes :: DotGraph -> [Node] and getEdges ::
>DotGraph -> [Edge] functions available, would you accept an all-in-one
>data type that just contains a generic list of statements and thus
>follows upstream more closely?  Even leaving aside parsing, this would
>allow for greater flexibility for creating wild and wacky graphs or for
>a monadic interface or something for building DotGraphs (which someone
>has asked me for, but which at the moment I have no idea how to do...).
>
>-- 
>Ivan Lazar Miljenovic
>Ivan.Miljenovic at gmail.com
>IvanMiljenovic.wordpress.com
>
>
>------------------------------
>
>Message: 20
>Date: Mon, 20 Jul 2009 15:22:24 +0200
>From: Roel van Dijk <vandijk.roel at gmail.com>
>Subject: Re: [Haskell-cafe] Implicit concatenation in list
>	comprehensions
>To: haskell-cafe <haskell-cafe at haskell.org>
>Message-ID:
>	<ab9dc6fa0907200622h1b76481ctd7f13d65d1282261 at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>On Mon, Jul 20, 2009 at 1:27 PM, Roel van Dijk<vandijk.roel at gmail.com> wrote:
>> I think the tuple sections are a great idea! It also makes tuple types
>> and constructors more alike:
>>
>> x :: (,) String Double
>> x = (,) "Pi" 3.14159
>
>I just realised this is already in GHC :-) But does you patch also add
>the equivalent for tuple type annotations?
>
>x :: (String, ) Double
>x = ("Pi", ) 3.14159
>
>I am also wondering what the following would/should mean:
>
>  (1, , ( , 2), ) 'a' 'b' 'c'
>
>Should this mean
>  (1, 'a', ('b', 2), 'c')
>or
>  (1, 'a', ('c', 2), 'b')
>
>Intuitively I would expect the first option. Just reading from left to
>right. But it doesn't look entirely trivial.
>
>
>------------------------------
>
>Message: 21
>Date: Mon, 20 Jul 2009 14:25:56 +0100
>From: "Sittampalam, Ganesh" <ganesh.sittampalam at credit-suisse.com>
>Subject: RE: [Haskell-cafe] Implicit concatenation in list
>	comprehensions
>To: "haskell-cafe" <haskell-cafe at haskell.org>
>Message-ID:
>	<16442B752A06A74AB4D9F9A5FF076E4B03B9F7DC at ELON17P32001A.csfb.cs-group.com>
>	
>Content-Type: text/plain; charset=us-ascii
>
>Roel van Dijk wrote:
>> On Mon, Jul 20, 2009 at 1:27 PM, Roel van
>> Dijk<vandijk.roel at gmail.com> wrote: 
>>> I think the tuple sections are a great idea! It also makes tuple
>>> types and constructors more alike: 
>>> 
>>> x :: (,) String Double
>>> x = (,) "Pi" 3.14159
>> 
>> I just realised this is already in GHC :-) But does you patch also
>> add the equivalent for tuple type annotations? 
>> 
>> x :: (String, ) Double
>> x = ("Pi", ) 3.14159
>> 
>> I am also wondering what the following would/should mean:
>> 
>>   (1, , ( , 2), ) 'a' 'b' 'c'
>
>I would expect it to be a type error, since I think the following is the
>only sane type the tuple can have (assuming numeric literals :: Int):
>
>(1, , ( , 2), ) :: a -> b -> (Int, a, c -> (c, Int), b)
>
>Ganesh
>
>=============================================================================== 
> Please access the attached hyperlink for an important electronic communications disclaimer: 
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
> =============================================================================== 
> 
>
>
>------------------------------
>
>Message: 22
>Date: Mon, 20 Jul 2009 15:42:08 +0200
>From: Roel van Dijk <vandijk.roel at gmail.com>
>Subject: Re: [Haskell-cafe] Implicit concatenation in list
>	comprehensions
>To: "Sittampalam, Ganesh" <ganesh.sittampalam at credit-suisse.com>
>Cc: haskell-cafe <haskell-cafe at haskell.org>
>Message-ID:
>	<ab9dc6fa0907200642u678cfe2ep22ffeef3308927eb at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>>> I am also wondering what the following would/should mean:
>>>
>>>   (1, , ( , 2), ) 'a' 'b' 'c'
>>
>> I would expect it to be a type error, since I think the following is the
>> only sane type the tuple can have (assuming numeric literals :: Int):
>>
>> (1, , ( , 2), ) :: a -> b -> (Int, a, c -> (c, Int), b)
>>
>> Ganesh
>
>Ah you're completely right! I would be applying a tuple to a Char
>which is nonsense.
>
>
>------------------------------
>
>Message: 23
>Date: Mon, 20 Jul 2009 07:02:22 -0700
>From: Jason Dagit <dagit at codersbase.com>
>Subject: Re: [Haskell-cafe] FFI problem - possibility of CStringLen
>	overflow?
>To: Robin Green <greenrd at greenrd.org>
>Cc: haskell-cafe at haskell.org
>Message-ID:
>	<b97f58860907200702s769b48cao85d5d5c2f15f183e at mail.gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>On Sun, Jul 19, 2009 at 7:24 PM, Robin Green <greenrd at greenrd.org> wrote:
>
>> While rewriting cautious-file to use ByteStrings and FFI just now, I
>> came across this potential problem:
>>
>> Why does the FFI specification define CStringLen as (Ptr CChar, Int)?
>
>
>Do you think it was a typo and the author(s) meant (Ptr CChar, CInt) ?
>
>Jason
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090720/abed0080/attachment-0001.html
>
>------------------------------
>
>Message: 24
>Date: Mon, 20 Jul 2009 15:07:23 +0100
>From: Philippa Cowderoy <flippa at flippac.org>
>Subject: [Haskell-cafe] Anglohaskell - wifi signups
>To: haskell at haskell.org, Haskell cafe <haskell-cafe at haskell.org>
>Message-ID: <4A647A1B.7010408 at flippac.org>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Wifi signups are Anglohaskell are now on the wiki - please add your 
>details by the 31st of July if you want a wifi account at MS Research 
>for the Friday. Alternatively, reply to this email with your full name, 
>institution, country of residence and email address.
>
>The Anglohaskell wiki page can be found at 
>http://www.haskell.org/haskellwiki/AngloHaskell/2009
>
>There's still room for more talks if anyone's got something they fancy 
>giving a go - everything from cutting edge research to "what I did with 
>Haskell on my holiday" is welcome, as is everyone from GHC implentors to 
>newbies frantically writing Hello World on their laptop in the back row.
>
>-- 
>flippa at flippac.org
>
>
>------------------------------
>
>Message: 25
>Date: Mon, 20 Jul 2009 11:09:40 -0700
>From: Thomas DuBuisson <thomas.dubuisson at gmail.com>
>Subject: [Haskell-cafe] Pruning the Front Page
>To: haskell mailing list <haskell-cafe at haskell.org>
>Message-ID:
>	<4c44d90b0907201109v75f5427ra5aadefdf1722663 at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>All,
>I think we should remove unmaintained or refocused implementations
>from the haskell.org front page.  This would mean removing:
>    YHC - unmaintained, hasn't built for me in a while
>    LHC - Not a standalone compiler these days - perhaps should be
>linked as a GHC subproject?
>
>Other than those I'd propose NHC but I'm guessing that would get some
>pushback (even though it currently doesn't build for me).  Before
>anyone brings up HUGS I'll just say that 1) it is used 2) it builds 3)
>at least it's been updated more recently than the Haskell langauge.
>
>Thomas
>
>
>------------------------------
>
>Message: 26
>Date: Mon, 20 Jul 2009 11:12:16 -0700
>From: Don Stewart <dons at galois.com>
>Subject: Re: [Haskell-cafe] Pruning the Front Page
>To: Thomas DuBuisson <thomas.dubuisson at gmail.com>
>Cc: haskell mailing list <haskell-cafe at haskell.org>
>Message-ID: <20090720181216.GL15846 at whirlpool.galois.com>
>Content-Type: text/plain; charset=us-ascii
>
>thomas.dubuisson:
>> All,
>> I think we should remove unmaintained or refocused implementations
>> from the haskell.org front page.  This would mean removing:
>>     YHC - unmaintained, hasn't built for me in a while
>>     LHC - Not a standalone compiler these days - perhaps should be
>> linked as a GHC subproject?
>> 
>> Other than those I'd propose NHC but I'm guessing that would get some
>> pushback (even though it currently doesn't build for me).  Before
>> anyone brings up HUGS I'll just say that 1) it is used 2) it builds 3)
>> at least it's been updated more recently than the Haskell langauge.
>> 
>
>I guess we just acknowledge that all implementations are not equal, and
>for newbies we strongly recommend GHC + Haskell Platform. For
>reference, we point to a page listing all implementations.
>
>This follows convention (i.e. Python, Ruby only point to the canonical
>impls, not the various forks).
>
>-- Don
>
>
>------------------------------
>
>Message: 27
>Date: Mon, 20 Jul 2009 20:14:30 +0100
>From: Max Bolingbroke <batterseapower at hotmail.com>
>Subject: Re: [Haskell-cafe] Implicit concatenation in list
>	comprehensions
>To: Roel van Dijk <vandijk.roel at gmail.com>
>Cc: haskell-cafe <haskell-cafe at haskell.org>
>Message-ID:
>	<9d4d38820907201214n79cc48a8jc5e5f19af511129d at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>2009/7/20 Roel van Dijk <vandijk.roel at gmail.com>:
>> I just realised this is already in GHC :-) But does you patch also add
>> the equivalent for tuple type annotations?
>>
>> x :: (String, ) Double
>> x = ("Pi", ) 3.14159
>
>It doesn't, and indeed it would only work in the special case where
>your only missing type arguments are on the right (since we lack
>type-level lambda, we can only accept eta-reduced forms). So it
>probably wouldn't be worth it - it wouldn't allow you to write
>anything significantly shorter than the existing form "(,) String".
>
>Cheers,
>Max
>
>
>------------------------------
>
>Message: 28
>Date: Mon, 20 Jul 2009 21:26:05 +0100
>From: phil at beadling.co.uk
>Subject: Re: [Haskell-cafe] Ambiguous type variable - help!
>To: gale at sefer.org
>Cc: haskell-cafe at haskell.org
>Message-ID: <47ED22E9-0828-4B19-A182-6F69DE919CC4 at beadling.co.uk>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
>On 19 Jul 2009, at 21:18, Yitzchak Gale wrote:
>
>> Hi Phil,
>
>>
>>
>>> I've concocted a very simple example to illustrate this (below) - but
>>> it doesn't compile because ghc complains that my type is ambiguous  
>>> arising
>>> from my use of 'fromSeq'.
>>
>> Notice that you have given two completely separate sets
>> of instructions of what to do depending on whether Int
>> or Double is selected. You have not given any indication
>> of how to choose between them, even at runtime. Of course,
>> the compiler doesn't care that your string constants "Int" and
>> "Double" happen also to be the names of types if unquoted.
>
>I see now.  I'm passing fromSeq a SeqType, but it has no way
>of knowing if I want to process it as an Int or a Double.
>The only thing which is polymorphic is nextSeq as it must handle
>the underlying state of Int and Double.
>
>Your result function handles the general case and the typeclass
>instances deal with the specialization depending on the state's type.
>
>The printResult function takes in a SeqType and then "parses" (for  
>want of
>a better word) out the
>underlying type of Int or Double.  It then calls results against the  
>Int or Double which
>in turn will invoke the correct version of nextSeq.
>
>
>Thank you very much for explaining this!
>
>
>Phil.
>
>>
>> import Control.Monad.State -- Why Strict? Haskell is lazy by default.
>>
>
>Ahh, no reason for the Strict - in the large program I'm righting it  
>is required
>because otherwise I end up with almighty thunks.  But here it serves  
>no purpose.
>
>
>
>------------------------------
>
>Message: 29
>Date: Mon, 20 Jul 2009 22:25:30 +0200
>From: Nicolas Pouillard <nicolas.pouillard at gmail.com>
>Subject: Re: [Haskell-cafe] Implicit concatenation in list
>	comprehensions
>To: Max Bolingbroke <batterseapower at hotmail.com>
>Cc: haskell-cafe <haskell-cafe at haskell.org>
>Message-ID: <1248121473-sup-8534 at ausone.local>
>Content-Type: text/plain; charset=UTF-8
>
>Excerpts from Max Bolingbroke's message of Sun Jul 19 16:58:08 +0200 2009:
>> Dear Cafe,
>> 
>> For fun, I spent a few hours yesterday implement support for this
>> syntax in GHC, originally propsed by Koen Claessen:
>> 
>
>[...]
>
>> P.S. I also implemented tuple sections
>> (http://hackage.haskell.org/trac/ghc/ticket/3377#comment:3) which are
>> a lot more useful:
>
>I vote for both extensions.
>
>-- 
>Nicolas Pouillard
>http://nicolaspouillard.fr
>
>
>------------------------------
>
>Message: 30
>Date: Tue, 21 Jul 2009 13:36:04 +1200 (NZST)
>From: porges at porg.es
>Subject: Re: [Haskell-cafe] Implicit concatenation in list
>	comprehensions
>To: Roel van Dijk <vandijk.roel at gmail.com>
>Cc: haskell-cafe <haskell-cafe at haskell.org>, "Sittampalam,	Ganesh"
>	<ganesh.sittampalam at credit-suisse.com>
>Message-ID: <fxdyfegnp48plbb647UYAxe124vaj_firegpg at mail.gmail.com>
>Content-Type: text/plain; charset="utf-8"
>
>2009/7/21 Roel van Dijk <vandijk.roel at gmail.com>:
>>>> I am also wondering what the following would/should mean:
>>>>
>>>> Â  (1, , ( , 2), ) 'a' 'b' 'c'
>>>
>>> I would expect it to be a type error, since I think the following is the
>>> only sane type the tuple can have (assuming numeric literals :: Int):
>>>
>>> (1, , ( , 2), ) :: a -> b -> (Int, a, c -> (c, Int), b)
>>>
>>> Ganesh
>>
>> Ah you're completely right! I would be applying a tuple to a Char
>> which is nonsense.
>
>You can kind of do it if you indicate which 'field' is to be applied:
>
>  import Control.Applicative
>
>  newtype Fst b a = Fst (a,b) deriving (Show)
>  newtype Snd a b = Snd (a,b) deriving (Show)
>
>  instance Functor (Fst b) where
>  	fmap f (Fst (a,b)) = Fst (f a,b)
>
>  instance Functor (Snd a) where
>  	fmap f (Snd (a,b)) = Snd (a,f b)
>
>  f <$$> x = ($x) <$> f
>
>...
>
>> Fst ((,)1,3) <$$> 2 -- no section, don't have the patch ;)
>Fst ((1,2),3)
>-------------- next part --------------
>A non-text attachment was scrubbed...
>Name: signature.asc
>Type: application/pgp-signature
>Size: 908 bytes
>Desc: OpenPGP digital signature
>Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090720/914e9c57/signature-0001.bin
>
>------------------------------
>
>Message: 31
>Date: Mon, 20 Jul 2009 22:02:00 -0400
>From: Gwern Branwen <gwern0 at gmail.com>
>Subject: Re: [Haskell-cafe] Pruning the Front Page
>To: Thomas DuBuisson <thomas.dubuisson at gmail.com>
>Cc: haskell mailing list <haskell-cafe at haskell.org>
>Message-ID:
>	<cbf55b100907201902h4fda9be9jc0cc333cf4ddaa42 at mail.gmail.com>
>Content-Type: text/plain; charset=UTF-8
>
>On Mon, Jul 20, 2009 at 2:09 PM, Thomas
>DuBuisson<thomas.dubuisson at gmail.com> wrote:
>> All,
>> I think we should remove unmaintained or refocused implementations
>> from the haskell.org front page. Â This would mean removing:
>> Â  Â YHC - unmaintained, hasn't built for me in a while
>> Â  Â LHC - Not a standalone compiler these days - perhaps should be
>> linked as a GHC subproject?
>>
>> Other than those I'd propose NHC but I'm guessing that would get some
>> pushback (even though it currently doesn't build for me). Â Before
>> anyone brings up HUGS I'll just say that 1) it is used 2) it builds 3)
>> at least it's been updated more recently than the Haskell langauge.
>>
>> Thomas
>
>What about UHC and JHC? They're both maintained (in their varying
>degrees), but I don't think they can do anything but pure Haskell
>'98*, and I dunno whether they could even compile the Cabal packages
>which are/depend only on Haskell '98.
>
>What should our criterion be? Just maintained? Maintained and at least
>able to compile Haskell '98 source? Maintained, able to compile
>Haskell '98, and also the pure Haskell '98 subset of Hackage?
>
>I prefer the last triplet since it's the best for newbies and the
>minimum necessary for practicality beyond rolling everything oneself,
>but perhaps that's too strict for everyone else.
>
>* by which I mean Haskell '98, the FFI, and hierarchical modules
>
>-- 
>gwern
>
>
>------------------------------
>
>_______________________________________________
>Haskell-Cafe mailing list
>Haskell-Cafe at haskell.org
>http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
>End of Haskell-Cafe Digest, Vol 71, Issue 30
>********************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090721/2d9cb79b/attachment-0001.html


More information about the Haskell-Cafe mailing list