Re: [Haskell-cafe] Experiences with cabal-install and Hackage

2010-07-23 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 7/22/10 05:02 , Malcolm Wallace wrote:
 My only problem with
 Hackage is I feel like the maintainer is a fence I have to climb every
 time I want to upload a bugfix or a non-broken version of the package.
 I just want to fix it, upload it, and continue with my work.
 
 Unfortunately, experience shows that a gatekeeper is usually necessary. 
 Otherwise random people create and apply patches that break stuff they don't

As I read it, he wants multiple official maintainers, not the ability for
random people to upload garbage.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxJMJkACgkQIn7hlCsL25XxiQCdEypnj+rKWoWYfFlJvGyoCSHA
RNMAoLZipyWHdM17DfmL2VZ4NOLzTbg3
=G/AF
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal, Setup.lhs example

2010-07-23 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 7/22/10 09:44 , Magnus Therning wrote:
 All right, so why would cabal want to avoid compiling the Setup.hs?
 
 Of course this behaviour of cabal's means that I in the future will use 
 *Custom*
 all the time, since I otherwise have to remember this surprising feature of a
 tool I never use.  Is there any reason *not* to do this?

I would think using Simple would simplify tools that automatically create
rpms/debs/etc. from hackages.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxJMgoACgkQIn7hlCsL25XVSACfWBPmzJXA0fJtjOdFp0+pFU/W
QKMAn08yzo73+Cl8C24qAYxTfsSGfo2p
=6mxH
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Page rank and GHC docs directory organization

2010-07-23 Thread Ketil Malde
Robin KAY komad...@gekkou.co.uk writes:

 the redirects and ignore the original URLs [2]. Using a 302 Found
 redirect instead might produce better results, at least for Google

But the page you point to suggests 302 is discouraged, and says they
don't help for the other search engines.  Perhaps 'latest' could just be
a symlink to the latest version instead of a redirect?

In addition, all versions could have a blurb saying this is for version
x.y.z, the latest version can be found (- url with /latest).  I believe
this should boost the page rank of the 'latest' URL.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal, Setup.lhs example

2010-07-23 Thread Magnus Therning
On Fri, Jul 23, 2010 at 03:33, wren ng thornton w...@freegeek.org wrote:
 Magnus Therning wrote:

 On Thu, Jul 22, 2010 at 11:52, Ross Paterson r...@soi.city.ac.uk wrote:

 On Thu, Jul 22, 2010 at 11:31:21AM +0100, Magnus Therning wrote:

 On Thu, Jul 22, 2010 at 10:59, Ross Paterson r...@soi.city.ac.uk
 wrote:

 Magnus is building by directly running the Setup.hs himself, which
 ignores
 the Build-Type.  To get cabal-install to use his Setup.hs, the
 Build-Type
 must be set to Custom.

 Oh, why*2?

 Why is the header there if it's not used by Cabal, and why does cabal
 care?

 The field allows cabal to avoid compiling the Setup.hs in this case.
 It might also be used by other tools, e.g. one might only trust Simple
 packages.  Not all fields are used by all tools, and several of them
 do not affect the operation of the library (e.g. Home-page).

 All right, so why would cabal want to avoid compiling the Setup.hs?

 Of course this behaviour of cabal's means that I in the future will use
 *Custom*
 all the time, since I otherwise have to remember this surprising feature
 of a
 tool I never use.  Is there any reason *not* to do this?

 The main reason I could think of to avoid compiling it is for performance
 reasons. I'm not sure how compelling that is, but...

 As for why not to always use Custom, as mentioned there are cabal-aware
 tools out there besides cabal-install. For these other tools, there is a big
 difference between Simple and Custom. With Simple we (ideally) already know
 all the semantics of what Setup.hs does, and so we can wire that into our
 tools. With Custom we're forced into the position of doing Haskell source
 analysis since we now have to discover the semantics of an arbitrary Turing
 machine. That's a very high wall to climb if you're just wanting to write a
 simple tool for doing some kind of package analysis.

 (I don't think the behavior is surprising since I interpret Simple to mean
 that the Setup.hs file is unused/optional. Though clearly YMMV)

I always thought Build-Type: Simple was in some way connected to the
module Distribution.Simple.

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal, Setup.lhs example

2010-07-23 Thread Magnus Therning
On Fri, Jul 23, 2010 at 04:58, Mark Wotton mwot...@gmail.com wrote:
 On Fri, Jul 23, 2010 at 12:33 PM, wren ng thornton w...@freegeek.org wrote:
 Magnus Therning wrote:

 On Thu, Jul 22, 2010 at 11:52, Ross Paterson r...@soi.city.ac.uk wrote:

 On Thu, Jul 22, 2010 at 11:31:21AM +0100, Magnus Therning wrote:

 On Thu, Jul 22, 2010 at 10:59, Ross Paterson r...@soi.city.ac.uk
 wrote:

 Magnus is building by directly running the Setup.hs himself, which
 ignores
 the Build-Type.  To get cabal-install to use his Setup.hs, the
 Build-Type
 must be set to Custom.

 Oh, why*2?

 Why is the header there if it's not used by Cabal, and why does cabal
 care?

 The field allows cabal to avoid compiling the Setup.hs in this case.
 It might also be used by other tools, e.g. one might only trust Simple
 packages.  Not all fields are used by all tools, and several of them
 do not affect the operation of the library (e.g. Home-page).

 All right, so why would cabal want to avoid compiling the Setup.hs?

 Of course this behaviour of cabal's means that I in the future will use
 *Custom*
 all the time, since I otherwise have to remember this surprising feature
 of a
 tool I never use.  Is there any reason *not* to do this?

 The main reason I could think of to avoid compiling it is for performance
 reasons. I'm not sure how compelling that is, but...

 As for why not to always use Custom, as mentioned there are cabal-aware
 tools out there besides cabal-install. For these other tools, there is a big
 difference between Simple and Custom. With Simple we (ideally) already know
 all the semantics of what Setup.hs does, and so we can wire that into our
 tools. With Custom we're forced into the position of doing Haskell source
 analysis since we now have to discover the semantics of an arbitrary Turing
 machine. That's a very high wall to climb if you're just wanting to write a
 simple tool for doing some kind of package analysis.

 (I don't think the behavior is surprising since I interpret Simple to mean
 that the Setup.hs file is unused/optional. Though clearly YMMV)


 Ah, this clears up one of my bugs.

 Perhaps cabal should print a warning if you have a Setup.hs file,
 _and_ try to use Simple? It'd at least give the hint that they're
 unhappy together.

I don't like that idea.  I don't use cabal, so I always need a Setup.hs
whether the Build-Type is Simple or Custom.

This suggestion would also force some tools that don't care about Build-Type
(they just use the Setup.hs irrespective of Build-Type) to start caring.

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Page rank and GHC docs directory organization

2010-07-23 Thread Sittampalam, Ganesh
Ketil Malde wrote:
 Robin KAY komad...@gekkou.co.uk writes:
 
 the redirects and ignore the original URLs [2]. Using a 302 Found
 redirect instead might produce better results, at least for Google
 
 But the page you point to suggests 302 is discouraged, and says they
 don't help for the other search engines.  Perhaps 'latest' could just
 be a symlink to the latest version instead of a redirect?  
 
 In addition, all versions could have a blurb saying this is for
 version x.y.z, the latest version can be found (- url with /latest).
 I believe this should boost the page rank of the 'latest' URL.  

If you both implement 'latest' as a symlink and have this blurb, then
the latest page will always have a rather silly looking link to
itself.

If the latest numbered version and latest could be generated separately,
then I think this would work very well.

The quick-n-dirty thing to do would be to switch to the 302 redirects,
which given the dominance of google, may well be good enough.

Ganesh

=== 
Please access the attached hyperlink for an important electronic communications 
disclaimer: 
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
=== 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: src/Text/XML/HaXml/Lex.hs:(156, 0)-(160, 22): Non-exhaustive patterns in function white

2010-07-23 Thread Gracjan Polak
Alexander Kotelnikov sacha at myxomop.com writes:

 
  On Wed, 21 Jul 2010 06:46:26 + (UTC)
  GP == Gracjan Polak gracjanpolak at gmail.com wrote:
 GP 
 GP Antoine Latter aslatter at gmail.com writes:
  Sending off to the maintainer of haxr, although it looks like it might
  be in HaXml (from an outside guess).
 GP 
 GP Without some real example to look at it will be quite tough to proceed.
 GP 
 GP Alexander, can you send that stream of packets to me?
 
 I attach a stream dump.
 
 
 Attachment (poster.dump): application/octet-stream, 2916 bytes
 
 

My guess at this point:

Your XML contains PNG as binary data. Since this part is interpreted as a string
with UTF-8 encoding we have big trouble here. Some of byte combinations in PNG
do not constitute correct coding points, are probably converted/normalized and
are interpreted as invalid XML.

Solution: use text-based encoding for binary data. Base64 seems to be obvius
candidate here.

-- 
Gracjan




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: src/Text/XML/HaXml/Lex.hs:(156, 0)-(160, 22): Non-exhaustive patterns in function white

2010-07-23 Thread Malcolm Wallace

Calls which successfully returned some binary data before do not do so
anymore. The error is:
Prelude.chr: bad argument: 1177427


I can't help with this one.  As Gracjan noted, it is probably because  
your binary data is not valid as UTF-8 text.



Calls which complained about 'white' function now fail with:
precondition not satisfied: Posn.white c | isSpace c


But this one, although likely another symptom of the same binary  
problem, I have fixed in the darcs repo for HaXml.  (Basically, the  
'white' function was only permitting ASCII whitespace - I have now  
extended it to allow for Unicode whitespace characters also.)



Regards,
Malcolm

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] cabal, Setup.lhs example

2010-07-23 Thread Sittampalam, Ganesh
Mark Wotton wrote:

 Perhaps cabal should print a warning if you have a Setup.hs file,
 _and_ try to use Simple? It'd at least give the hint that they're
 unhappy together.  

I think it should instead verify that Setup.hs is consistent with a
Simple build. I don't know how much variation exists, but I believe
import Distribution.Simple\nmain = defaultMain\n is all such a
Setup.hs file actually needs.

Ganesh

=== 
Please access the attached hyperlink for an important electronic communications 
disclaimer: 
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
=== 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] HaTeX build failure

2010-07-23 Thread Daniel Díaz
Hi,

I uploaded a package, named HaTeX, to Hackage, but it gets a build failure:

cabal: Couldn't read cabal file ./HaTeX/1.0.0/HaTeX.cabal

It makes reference to 1.0.0 version, even when building version 1.0.1.

I get the same error when I use cabal install. However, using
configurebuildregister I don't have any problem.

I would like this package works well, but I don't know how to solve this
problem. In fact, I don't know what's the problem.

Here a link to the HaTeX package: http://hackage.haskell.org/package/HaTeX

Any idea?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal, Setup.lhs example

2010-07-23 Thread Edward Kmett
That actually runs contrary to one of cabal's other practices, which is to
add a 'simple' Setup.hs to your package as it makes the sdist is one is not
present. With your proposed change, it would then complain about _every_
package that used simple. ;)

Setup.hs exists so that you can execute runhaskell Setup.hs foo instead of
cabal foo. You just need to tell cabal if you want to delegate to Setup.hs,
by using something other than Simple as a build-type. The vast majority of
the users of cabal never bother changing the behavior of Setup.hs.

-Edward Kmett

On Thu, Jul 22, 2010 at 11:58 PM, Mark Wotton mwot...@gmail.com wrote:

 On Fri, Jul 23, 2010 at 12:33 PM, wren ng thornton w...@freegeek.org
 wrote:
  Magnus Therning wrote:
 
  On Thu, Jul 22, 2010 at 11:52, Ross Paterson r...@soi.city.ac.uk
 wrote:
 
  On Thu, Jul 22, 2010 at 11:31:21AM +0100, Magnus Therning wrote:
 
  On Thu, Jul 22, 2010 at 10:59, Ross Paterson r...@soi.city.ac.uk
  wrote:
 
  Magnus is building by directly running the Setup.hs himself, which
  ignores
  the Build-Type.  To get cabal-install to use his Setup.hs, the
  Build-Type
  must be set to Custom.
 
  Oh, why*2?
 
  Why is the header there if it's not used by Cabal, and why does cabal
  care?
 
  The field allows cabal to avoid compiling the Setup.hs in this case.
  It might also be used by other tools, e.g. one might only trust Simple
  packages.  Not all fields are used by all tools, and several of them
  do not affect the operation of the library (e.g. Home-page).
 
  All right, so why would cabal want to avoid compiling the Setup.hs?
 
  Of course this behaviour of cabal's means that I in the future will use
  *Custom*
  all the time, since I otherwise have to remember this surprising feature
  of a
  tool I never use.  Is there any reason *not* to do this?
 
  The main reason I could think of to avoid compiling it is for performance
  reasons. I'm not sure how compelling that is, but...
 
  As for why not to always use Custom, as mentioned there are cabal-aware
  tools out there besides cabal-install. For these other tools, there is a
 big
  difference between Simple and Custom. With Simple we (ideally) already
 know
  all the semantics of what Setup.hs does, and so we can wire that into our
  tools. With Custom we're forced into the position of doing Haskell source
  analysis since we now have to discover the semantics of an arbitrary
 Turing
  machine. That's a very high wall to climb if you're just wanting to write
 a
  simple tool for doing some kind of package analysis.
 
  (I don't think the behavior is surprising since I interpret Simple to
 mean
  that the Setup.hs file is unused/optional. Though clearly YMMV)


 Ah, this clears up one of my bugs.

 Perhaps cabal should print a warning if you have a Setup.hs file,
 _and_ try to use Simple? It'd at least give the hint that they're
 unhappy together.

 mark

 --
 A UNIX signature isn't a return address, it's the ASCII equivalent of a
 black velvet clown painting. It's a rectangle of carets surrounding a
 quote from a literary giant of weeniedom like Heinlein or Dr. Who.
 -- Chris Maeda
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal, Setup.lhs example

2010-07-23 Thread Edward Kmett
On Fri, Jul 23, 2010 at 8:07 AM, Edward Kmett ekm...@gmail.com wrote:

 That actually runs contrary to one of cabal's other practices, which is to
 add a 'simple' Setup.hs to your package as it makes the sdist is one is not
 present.


er.. I meant if one is not present.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaTeX build failure

2010-07-23 Thread Alexey Khudyakov
On Fri, Jul 23, 2010 at 4:04 PM, Daniel Díaz lazy.dd...@gmail.com wrote:
 Hi,

 I uploaded a package, named HaTeX, to Hackage, but it gets a build failure:

 Any idea?

Cabal file has BOM in the beginning. Maybe it make parser choke...
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaTeX build failure

2010-07-23 Thread Jürgen Doser
El vie, 23-07-2010 a las 16:53 +0400, Alexey Khudyakov escribió:
 On Fri, Jul 23, 2010 at 4:04 PM, Daniel Díaz lazy.dd...@gmail.com wrote:
  Hi,
 
  I uploaded a package, named HaTeX, to Hackage, but it gets a build failure:
 
  Any idea?
 
 Cabal file has BOM in the beginning. Maybe it make parser choke...

http://hackage.haskell.org/trac/hackage/ticket/533 claims that this bug
is fixed, however, removing the BOM does indeed help here.

Someone will have to fix this on the hackage server, I guess.

Jürgen

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: Haskell Platform 2010.2.0.0

2010-07-23 Thread Leon Grynszpan
Some nits, if I may pick (http://hackage.haskell.org/platform/contents.html):

Under GHC: s/optimzing/optimizing
Under Alex: Sentence should end with a period.
Under hsc2hs: There shouldn't be a comma.
Under haskell code coverage: Testsuite should probably be two words:
test suite.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-23 Thread José Romildo Malaquias
On Tue, Jul 20, 2010 at 09:17:15AM +0200, José Pedro Magalhães wrote:
 
 2010/7/19 José Romildo Malaquias j.romi...@gmail.com
 
 
  I am writing here to ask suggestions on how to annotate an ast with
  types (or any other information that would be relevant in a compiler
  phase) in Haskell.
 
 Indeed I would suggest the method described in our paper:
 
 Martijn van Steenbergen, José Pedro Magalhães, and Johan Jeuring. Generic
 selections of subexpressions.
 Paper link: http://dreixel.net/research/pdf/gss_draft.pdf
 Related hackage package: http://hackage.haskell.org/package/Annotations

Annotations-0.1 requires base ==4.1.* and parsec ==3.0.*, but I have
base-4.2.0.2 and parsec-3.1.0 on my Gentoo Linux system. Would it work
with these new versions of base and parsec?

Romildo
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Anyone here from New Zealand?

2010-07-23 Thread Tim Matthews
Any of the haskellers here from NZ?

Are you using haskell in production, internally within your company or just
outside of work in your own time?

In Aus they've got
hackathonshttp://www.haskell.org/haskellwiki/AusHac2010and user
groups http://www.haskell.org/haskellwiki/User_groups#Australia. Anything
even remotely similar here in New Zealand?

Thanks

Tim Matthews
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-23 Thread José Pedro Magalhães
Hi Romildo,

2010/7/23 José Romildo Malaquias j.romi...@gmail.com

 On Tue, Jul 20, 2010 at 09:17:15AM +0200, José Pedro Magalhães wrote:
 
  2010/7/19 José Romildo Malaquias j.romi...@gmail.com
 
  
   I am writing here to ask suggestions on how to annotate an ast with
   types (or any other information that would be relevant in a compiler
   phase) in Haskell.
 
  Indeed I would suggest the method described in our paper:
 
  Martijn van Steenbergen, José Pedro Magalhães, and Johan Jeuring. Generic
  selections of subexpressions.
  Paper link: http://dreixel.net/research/pdf/gss_draft.pdf
  Related hackage package: http://hackage.haskell.org/package/Annotations

 Annotations-0.1 requires base ==4.1.* and parsec ==3.0.*, but I have
 base-4.2.0.2 and parsec-3.1.0 on my Gentoo Linux system. Would it work
 with these new versions of base and parsec?


Yes, that version has a problem with the constraints. I think they are too
restrictive; probably base = 4  base  4.3 would do. As for parsec, I am
not sure, but at least you can easily get parsec-3.0.*, whereas base is more
complicated. We will upload a new version soon to fix this.


Cheers,
Pedro



 Romildo

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: Haskell Platform 2010.2.0.0

2010-07-23 Thread Andrew Coppin

Don Stewart wrote:

Download the Haskell Platform 2010.2.0.0:

http://hackage.haskell.org.nyud.net/platform/

(Caching server).
  


Anybody have any theroes why Trend Micro Antivirus is reporting this as 
a confirmed fraud/attack site?


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: Haskell Platform 2010.2.0.0

2010-07-23 Thread Steve Schafer
On Fri, 23 Jul 2010 18:08:39 +0100, you wrote:

Anybody have any theroes why Trend Micro Antivirus is reporting this as 
a confirmed fraud/attack site?

Because someone somewhere has used the nyud.net distribution service to
distribute malware. Since it's a free service, it's pretty much
guaranteed that it will have been abused at some point. You can get the
same warnings about tinyurl.com, for example, because people have used
tinyurl.com to direct traffic to malicious web sites.

-Steve
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: Haskell Platform 2010.2.0.0

2010-07-23 Thread Don Stewart
andrewcoppin:
 Don Stewart wrote:
 Download the Haskell Platform 2010.2.0.0:

 http://hackage.haskell.org.nyud.net/platform/

 (Caching server).
   

 Anybody have any theroes why Trend Micro Antivirus is reporting this as  
 a confirmed fraud/attack site?


We're using the Coral Cache caching server, which I guess confuses silly
software.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: Haskell Platform 2010.2.0.0

2010-07-23 Thread Vo Minh Thu
2010/7/23 Andrew Coppin andrewcop...@btinternet.com:
 Don Stewart wrote:

 Download the Haskell Platform 2010.2.0.0:

    http://hackage.haskell.org.nyud.net/platform/

 (Caching server).


 Anybody have any theroes why Trend Micro Antivirus is reporting this as a
 confirmed fraud/attack site?

See here:
http://en.wikipedia.org/wiki/Coral_Content_Distribution_Network#Problems

Cheers,
Thu
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Heavy lift-ing

2010-07-23 Thread michael rice
Hi,

I don't understand what's taking place here.

From Hoogle:

=

liftM2 :: Monad  m = (a1 - a2 - r) - m a1 - m a2 - m r

Promote a function to a monad, scanning the monadic arguments from left to 
right. For example,

    liftM2 (+) [0,1] [0,2] = [0,2,1,3]
    liftM2 (+) (Just 1) Nothing = Nothing

=

What does it mean to promote a function to a monad?

It would seem that the monad values must understand the function that's being 
promoted, like Ints understand (+).

Prelude Control.Monad liftM2 (+) (Just 1) (Just 1)
Just 2

But how does one add [0,1] and [0,2] to get [0,2,1,3]?

Michael 



  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Heavy lift-ing

2010-07-23 Thread Albert Y. C. Lai

On 10-07-23 02:43 PM, michael rice wrote:

liftM2 :: Monad m = (a1 - a2 - r) - m a1 - m a2 - m r

[...]

What does it mean to promote a function to a monad?


liftM2 f m1 m2 is canned code for

do
  a1 - m1
  a2 - m2
  return (f a1 a2)

for example liftM2 f [s,t] [x,y] is [f s x, f s y, f t x, f t y]

liftM2 (++) getLine getLine reads two lines and concatenates them.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Heavy lift-ing

2010-07-23 Thread Nick Bowler
On 11:43 Fri 23 Jul , michael rice wrote:
 Hi,
 
 I don't understand what's taking place here.
 
 From Hoogle:
 
 =
 
 liftM2 :: Monad  m = (a1 - a2 - r) - m a1 - m a2 - m r
 
 Promote a function to a monad, scanning the monadic arguments from left to 
 right. For example,
 
     liftM2 (+) [0,1] [0,2] = [0,2,1,3]
     liftM2 (+) (Just 1) Nothing = Nothing
 
 =
 
 What does it mean to promote a function to a monad?

Consider fmap, which 'promotes a function to a functor':

  fmap :: Functor f = (a - b) - f a - f b

This might be easier to understand if you fully parenthesise this:

  fmap :: Functor f = (a - b) - (f a - f b)

In other words, fmap takes a function on ordinary values as input, and
outputs a function on a particular Functor.

Now consider liftM, which 'promotes a function to a monad':

  liftM :: Monad m = (a - b) - m a - m b

Hey, this looks almost the same as fmap (it is)!  Now, monads have
additional structure which allows us to promote more complicated
functions, for example:

  liftM2 :: Monad m = (a - b - c) - m a - m b - m c

which, when fully parenthesised, looks like

  liftM2 :: Monad m = (a - b - c) - (m a - m b - m c)

What we have now is that we can promote a 'two argument' function to
Monads (this is not possible on mere Functors, hence there's no fmap2).

 It would seem that the monad values must understand the function
 that's being promoted, like Ints understand (+).

Yes, liftM2 (+) gives you a new function with type
 
  (Num a, Monad m) = m a - m a - m a

 But how does one add [0,1] and [0,2] to get [0,2,1,3]?

liftM2 (+) [0,1] [0,2] gives the list

  [0+0, 0+2, 1+0, 1+2]

(recall that (=) in the list monad is concatMap).

-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: Haskell Platform 2010.2.0.0

2010-07-23 Thread Andrew Coppin

Vo Minh Thu wrote:

2010/7/23 Andrew Coppin andrewcop...@btinternet.com:
  


Anybody have any theroes why Trend Micro Antivirus is reporting this as a
confirmed fraud/attack site?



See here:
http://en.wikipedia.org/wiki/Coral_Content_Distribution_Network#Problems
  


Ah, right. So confirmed attack site actually means it could plausibly 
be an attack site and we can't be bothered to actually check properly?


Good to know my employers dollers are being well-spent. :-)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Heavy lift-ing

2010-07-23 Thread Alex Stangl
On Fri, Jul 23, 2010 at 11:43:08AM -0700, michael rice wrote:
 What does it mean to promote a function to a monad?
 
 It would seem that the monad values must understand the function that's being 
 promoted, like Ints understand (+).
 
 Prelude Control.Monad liftM2 (+) (Just 1) (Just 1)
 Just 2
 
 But how does one add [0,1] and [0,2] to get [0,2,1,3]?

It depends upon the semantics of the particular monad. List monads
represent nondeterminism. So, for example, [0,1] represents a 0 or
1, and [0,2] represents a 0 or 2.

When you add 0 or 1 to 0 or 2, your possible answers are [0,2,1,3].

Alex
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Heavy lift-ing

2010-07-23 Thread Jürgen Doser
El vie, 23-07-2010 a las 15:05 -0400, Nick Bowler escribió:
 On 11:43 Fri 23 Jul , michael rice wrote:
 [...]
  But how does one add [0,1] and [0,2] to get [0,2,1,3]?
 
 liftM2 (+) [0,1] [0,2] gives the list
 
   [0+0, 0+2, 1+0, 1+2]

which one could have found out by asking ghci:

Prelude Control.Monad let f a b = show a ++  +  ++ show b
Prelude Control.Monad liftM2 f [0,1] [0,2]
[0 + 0,0 + 2,1 + 0,1 + 2]

or simpler:

Prelude Control.Monad liftM2 (,) [0,1] [2,3]
[(0,2),(0,3),(1,2),(1,3)]

i.e., the in the list monad, you pair each element of one list with each
element of the other(s).

 (recall that (=) in the list monad is concatMap).

(=) = flip concatMap, to be precise. Or, concatMap = (=)

Now let's have some fun with equational reasoning to see what liftM2
does exactly: (Only read this if you really want to!)

liftM2 f a b 

= { definition of liftM2 }

do {x - a; y - b; return (f x y)}

= { simplified translation of do-notation }

a = \x - (b = \y - return (f x y))

= { change (=) to (=) and flip arguments }

(\x - ((\y - return (f x y)) = b)) = a 

= { specialized to the list monad }

(\x - ((\y - [f x y])) `concatMap` b)) `concatMap` a 

= { change concatMap to prefix application }

concatMap (\x - concatMap (\y - [x+y]) b) a

and indeed:

Prelude concatMap (\x - concatMap (\y - [x+y]) [0,2]) [0,1]
[0,2,1,3]

with some effort, I think one can understand what happens here. It
should also be clear how this is generalized to liftM3, liftM4, etc. 

Oh, btw, what about liftM1? Obviously, this should be the following:

liftM1 f a

= { definition }

do { x - a ; return f a }
  
= { same changes as above }

concatMap (\x - [f x]) a

= { definition of concatMap }

concat (map (\x - [f x]) a

= { concating singletons can be simplified } 

map (\x - f x) a

= { eta-reduction }

map f a

i.e., liftM1 = map, which is indeed just fmap for lists, as already
pointed out.

You can use this to simplify the last line of the concatMap derivation
above:

concatMap (\x - concatMap (\y - [x+y]) b) a

= { see above }

concatMap (\x - map (\y - x+y) b) a

= { use operator section }

concatMap (\x - map (x+) b) a

which is about as clear as possible a definition for liftM2 (+)


Jürgen



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Heavy lift-ing

2010-07-23 Thread michael rice
Thanks all,

Wild, at least up to the optional part, which I haven't dug into yet.

So the (+) for the Maybe monad and the (+) for the List monad are one in the 
same, the magic springs from the monads.

Why is it called lift-ing?

Michael


--- On Fri, 7/23/10, Jürgen Doser jurgen.do...@gmail.com wrote:

From: Jürgen Doser jurgen.do...@gmail.com
Subject: Re: [Haskell-cafe] Heavy lift-ing
To: michael rice nowg...@yahoo.com
Cc: haskell-cafe@haskell.org
Date: Friday, July 23, 2010, 4:50 PM

El vie, 23-07-2010 a las 15:05 -0400, Nick Bowler escribió:
 On 11:43 Fri 23 Jul     , michael rice wrote:
 [...]
  But how does one add [0,1] and [0,2] to get [0,2,1,3]?
 

 liftM2 (+) [0,1] [0,2] gives the list
 
   [0+0, 0+2, 1+0, 1+2]

which one could have found out by asking ghci:

Prelude Control.Monad let f a b = show a ++  +  ++ show b
Prelude Control.Monad liftM2 f [0,1] [0,2]
[0 + 0,0 + 2,1 + 0,1 + 2]

or simpler:

Prelude Control.Monad liftM2 (,) [0,1] [2,3]
[(0,2),(0,3),(1,2),(1,3)]

i.e., the in the list monad, you pair each element of one list with each
element of the other(s).

 (recall that (=) in the list monad is concatMap).

(=) = flip concatMap, to be precise. Or, concatMap = (=)

Now let's have some fun with equational reasoning to see what liftM2
does exactly: (Only read this if you really want to!)

liftM2 f a b 

    = { definition of liftM2 }

do {x - a; y - b; return (f x y)}

    = { simplified translation
 of do-notation }

a = \x - (b = \y - return (f x y))

    = { change (=) to (=) and flip arguments }

(\x - ((\y - return (f x y)) = b)) = a 

    = { specialized to the list monad }

(\x - ((\y - [f x y])) `concatMap` b)) `concatMap` a 

    = { change concatMap to prefix application }

concatMap (\x - concatMap (\y - [x+y]) b) a

and indeed:

Prelude concatMap (\x - concatMap (\y - [x+y]) [0,2]) [0,1]
[0,2,1,3]

with some effort, I think one can understand what happens here. It
should also be clear how this is generalized to liftM3, liftM4, etc. 

Oh, btw, what about liftM1? Obviously, this should be the following:

liftM1 f a

    = { definition }

do { x - a ; return f a }
  
    = { same changes as above
 }

concatMap (\x - [f x]) a

    = { definition of concatMap }

concat (map (\x - [f x]) a

    = { concating singletons can be simplified } 

map (\x - f x) a

    = { eta-reduction }

map f a

i.e., liftM1 = map, which is indeed just fmap for lists, as already
pointed out.

You can use this to simplify the last line of the concatMap derivation
above:

concatMap (\x - concatMap (\y - [x+y]) b) a

    = { see above }

concatMap (\x - map (\y - x+y) b) a

    = { use operator section }

concatMap (\x - map (x+) b) a

which is about as clear as possible a definition for liftM2 (+)


    Jürgen






  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Heavy lift-ing

2010-07-23 Thread Alexander Solla


On Jul 23, 2010, at 4:35 PM, michael rice wrote:


Why is it called lift-ing?


Basically, because mathematicians like enlightening metaphors.  It is  
a mathematical term.


A monadic value has an underlying value.  To turn a function that  
works on the underlying value into one that works on a monadic value,  
you have to lift it.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Heavy lift-ing

2010-07-23 Thread Jürgen Doser
El vie, 23-07-2010 a las 16:35 -0700, michael rice escribió:
 Thanks all,
 
 Wild, at least up to the optional part, which I haven't dug into
 yet.
 
 So the (+) for the Maybe monad and the (+) for the List monad are one
 in the same, the magic springs from the monads.
 
 Why is it called lift-ing?


g :: m a - m b - m c
   /\
  /||\
   ||
   ||
f ::   a -   b -   c


liftM2 lifts the function f and transforms it into the function g =
liftM2 f. 

Does that picture help?

Jürgen

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Heavy lift-ing

2010-07-23 Thread aditya siram
Lists are non-deterministic, but the function taken by liftM2 does not
necessarily generate all possible outcomes. In the case of (+) it
does, not in the case of (-):
liftM2 (-) [0,1] [2,3] = [0-1,0-2,1-2,1-3] = [-2,-3,-1,-2]
if all possible cases were generated between the two lists we have to
include also:
[2-0,2-1,3-0,3-1]

-deech

On Fri, Jul 23, 2010 at 3:44 PM, Alex Stangl a...@stangl.us wrote:
 On Fri, Jul 23, 2010 at 11:43:08AM -0700, michael rice wrote:
 What does it mean to promote a function to a monad?

 It would seem that the monad values must understand the function that's 
 being promoted, like Ints understand (+).

 Prelude Control.Monad liftM2 (+) (Just 1) (Just 1)
 Just 2

 But how does one add [0,1] and [0,2] to get [0,2,1,3]?

 It depends upon the semantics of the particular monad. List monads
 represent nondeterminism. So, for example, [0,1] represents a 0 or
 1, and [0,2] represents a 0 or 2.

 When you add 0 or 1 to 0 or 2, your possible answers are [0,2,1,3].

 Alex
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Heavy lift-ing

2010-07-23 Thread Alex Stangl
On Fri, Jul 23, 2010 at 09:12:44PM -0500, aditya siram wrote:
 Lists are non-deterministic, but the function taken by liftM2 does not
 necessarily generate all possible outcomes. In the case of (+) it
 does, not in the case of (-):
 liftM2 (-) [0,1] [2,3] = [0-1,0-2,1-2,1-3] = [-2,-3,-1,-2]
 if all possible cases were generated between the two lists we have to
 include also:
 [2-0,2-1,3-0,3-1]

If I have a - b where a and b are both non-deterministic, I wouldn't
expect to also include in my solution set all the results of b - a.
What if you have a / b? Would you try to include b / a, too, even
though some values of a may be zero?

Alex
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Weird behavior with arrow commands

2010-07-23 Thread Ronald Guida
I am trying to figure out how to use GHC's arrow commands, and I found
some extremely weird behavior.

In GHC's manual, there is a description of arrow commands, which I
don't really understand.
http://www.haskell.org/ghc/docs/latest/html/users_guide/arrow-notation.html#id667303
(Primitive Constructs)

I have two questions:
1. What are arrow commands supposed to do?
2. What is this code supposed to do?

-- start of code --

{-# LANGUAGE Arrows #-}
module Main where

import Control.Arrow

foo :: (b - String) - b, Int), Float), Double) - String) - (b - String)
foo f g b = f b ++   ++ g (((b, 8), 1.0), 6.0)

bar :: (t - String) - ((Double, Int) - String) - t - String
bar f g  = proc x - do
  (f - x) `foo` \n m - g - (n)

main = do
  putStrLn $ foo show show 17
  putStrLn $ bar show show 17
  putStrLn $ foo show show 42
  putStrLn $ bar show show 42

-- end of code --

Output from GHCi:

17 (((17,8),1.0),6.0)
17 (6.730326920298707e-306,0)
42 (((42,8),1.0),6.0)
42 (6.730326920298707e-306,0)

Output after compiling with GHC:

17 (((17,8),1.0),6.0)
17 (5.858736684536801e-270,0)
42 (((42,8),1.0),6.0)
42 (5.858736684536801e-270,0)

GHC Version:
The Glorious Glasgow Haskell Compilation System, version 6.12.3

Thank you
-- Ron
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Anyone here from New Zealand?

2010-07-23 Thread Ivan Lazar Miljenovic
Tim Matthews tim.matthe...@gmail.com writes:

 Any of the haskellers here from NZ?

 Are you using haskell in production, internally within your company or just
 outside of work in your own time?

 In Aus they've got
 hackathonshttp://www.haskell.org/haskellwiki/AusHac2010and user
 groups http://www.haskell.org/haskellwiki/User_groups#Australia. Anything
 even remotely similar here in New Zealand?

We actually had two Kiwis (Stephen Blackheath and Hamish Mackenzie) come
along to AusHac; the two of them were talking about having their own
two-man NZ Hackathon when they got back... ;-)

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe