Re: [Haskell-cafe] Idea for a tool

2010-10-20 Thread Bas van Dijk
On Wed, Oct 20, 2010 at 7:36 AM, Michael Snoyman mich...@snoyman.com wrote:
 Hi all,

 I saw a quote from Eric Kow via Neil Mitchell[1] that we don't spend
 enough time writing tools. Well, I've decided that the most annoying
 part of package maintainership right now is staying on top of new
 versions of dependencies. We essentially have two options right now:

 * Follow the PVP and put an upper bound on all dependencies, and
 people will be upset when your package only works with the old version
 of the dependency.
 * Skip the upper bound, and risk having your code break when there's a
 new version.

 I have an idea for a tool: you give it a list of packages you
 maintain, or even better yet, you give it your email address and it
 gets that list automatically. Then is looks through all your
 dependencies and sees if you have any upper bounds preventing newer
 versions from being used. Bonus points for making it a web service
 that just gives you an RSS feed.

 If anyone's interested in writing a tool like that, let me know.
 Otherwise, next time I'm twiddling my thumbs I'll try to throw it
 together. I've never dealt directly with the Cabal library, but
 there's a first time for everything. If someone else wants to write
 that tool and wants help sticking a web service on it, let me know.

 Michael

 [1] http://neilmitchell.blogspot.com/2010/10/enhanced-cabal-sdist.html
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


This would be a nice feature for the new hackage server:
http://sparky.haskell.org:8080

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


Re: [Haskell-cafe] Re: How to make cabal pass flags to happy?

2010-10-20 Thread Niklas Broberg
Thanks for the answers, all. :-)

Since this doesn't seem to be the common knowledge I expected it to
be, I'll try to work out how it's done properly and blog about it. And
hopefully generate some much needed documentation for cabal along the
way.

  What I want specifically is to have happy produce a GLR parser from my
  .ly file, and I want this to happen during 'cabal install'. Which in
  turn means I want cabal to pass the --glr flag to happy during
  setup. My best guess is that I might want to use 'ppHappy' [1], or
  something in the vicinity, but there's no documentation for the
  combinator and it's far from obvious how to pass arguments to it.

 I think the right solution is for the happy source file to specify
 what kind of grammar it is / should be produced. Yes, that would mean
 modifying happy.

Hmm, I agree with you in this particular case, regarding the grammar,
since it really only makes sense for any given happy grammar to
generate either kind of parser. But such a solution still wouldn't
answer the general question about passing flags to preprocessors.
Certainly not all such use cases are best fixed by pushing the flags
into the pre-processed files.

Cheers,

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


[Haskell-cafe] Re: libefence useful for debugging ghc+ffi programs?

2010-10-20 Thread Johannes Waldmann

 That looks a lot like a double free [...]

there's definitely something about initializing libcurl:
http://curl.haxx.se/libcurl/c/curl_easy_init.html
uses nice phrases like may be letal in multi-threading

the documentation of Haskell curl 
http://hackage.haskell.org/packages/archive/curl/1.3.5/doc/html/Network-
Curl.html
just says withCurlDo should be called once
while in fact it should be much stronger: must be called exactly once?

anyway I temporarily dropped curl (replaced by   system wget )
and the erratic behaviour persists. Now it looks like this:

  Electric Fence 2.1 Copyright (C) 1987-1998 Bruce Perens.
[New Thread 0x7fc37b70f6e0 (LWP 7281)]
[New Thread 0x4122a950 (LWP 7284)]
[New Thread 0x4214a950 (LWP 7285)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fc37b70f6e0 (LWP 7281)]
0x7fc37b715aae in memalign () from /usr/lib/libefence.so.0
(gdb) where
#0  0x7fc37b715aae in memalign () from /usr/lib/libefence.so.0
#1  0x7fc37b715c97 in malloc () from /usr/lib/libefence.so.0
#2  0x7fc37a492a55 in gethostbyname () from /lib/libc.so.6
#3  0x0089cc88 in networkzm2zi2zi1zi7_NetworkziBSD_zdwlvl_info 
()
#4  0x in ?? ()

and indeed, gethostbyname is famous for being non re-entrant.

(packages I use are HTTP, hxt, happstack-server;
and I can't drop all of them ...)



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


Re: [Haskell-cafe] Idea for a tool

2010-10-20 Thread Neil Mitchell
Hi Michael,

I want this tool. I fake it slightly by using my RSS reader and
http://page2rss.com/ to get notified when any packages I depend on
change, which basically works - but if you could provide a better
service (ideally integrated in to hackage), I'd use it.

Thanks, Neil

On Wed, Oct 20, 2010 at 8:27 AM, Bas van Dijk v.dijk@gmail.com wrote:
 On Wed, Oct 20, 2010 at 7:36 AM, Michael Snoyman mich...@snoyman.com wrote:
 Hi all,

 I saw a quote from Eric Kow via Neil Mitchell[1] that we don't spend
 enough time writing tools. Well, I've decided that the most annoying
 part of package maintainership right now is staying on top of new
 versions of dependencies. We essentially have two options right now:

 * Follow the PVP and put an upper bound on all dependencies, and
 people will be upset when your package only works with the old version
 of the dependency.
 * Skip the upper bound, and risk having your code break when there's a
 new version.

 I have an idea for a tool: you give it a list of packages you
 maintain, or even better yet, you give it your email address and it
 gets that list automatically. Then is looks through all your
 dependencies and sees if you have any upper bounds preventing newer
 versions from being used. Bonus points for making it a web service
 that just gives you an RSS feed.

 If anyone's interested in writing a tool like that, let me know.
 Otherwise, next time I'm twiddling my thumbs I'll try to throw it
 together. I've never dealt directly with the Cabal library, but
 there's a first time for everything. If someone else wants to write
 that tool and wants help sticking a web service on it, let me know.

 Michael

 [1] http://neilmitchell.blogspot.com/2010/10/enhanced-cabal-sdist.html
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 This would be a nice feature for the new hackage server:
 http://sparky.haskell.org:8080

 Bas
 ___
 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] Idea for a tool

2010-10-20 Thread Michael Snoyman
Well, here's an initial, ugly version of this tool. Feed it two
command line arguments: a cabal file, and the 00-index.tar file in the
.cabal/packages/hackage.haskell.org folder. More work to follow.

Michael

On Wed, Oct 20, 2010 at 12:25 PM, Neil Mitchell ndmitch...@gmail.com wrote:
 Hi Michael,

 I want this tool. I fake it slightly by using my RSS reader and
 http://page2rss.com/ to get notified when any packages I depend on
 change, which basically works - but if you could provide a better
 service (ideally integrated in to hackage), I'd use it.

 Thanks, Neil

 On Wed, Oct 20, 2010 at 8:27 AM, Bas van Dijk v.dijk@gmail.com wrote:
 On Wed, Oct 20, 2010 at 7:36 AM, Michael Snoyman mich...@snoyman.com wrote:
 Hi all,

 I saw a quote from Eric Kow via Neil Mitchell[1] that we don't spend
 enough time writing tools. Well, I've decided that the most annoying
 part of package maintainership right now is staying on top of new
 versions of dependencies. We essentially have two options right now:

 * Follow the PVP and put an upper bound on all dependencies, and
 people will be upset when your package only works with the old version
 of the dependency.
 * Skip the upper bound, and risk having your code break when there's a
 new version.

 I have an idea for a tool: you give it a list of packages you
 maintain, or even better yet, you give it your email address and it
 gets that list automatically. Then is looks through all your
 dependencies and sees if you have any upper bounds preventing newer
 versions from being used. Bonus points for making it a web service
 that just gives you an RSS feed.

 If anyone's interested in writing a tool like that, let me know.
 Otherwise, next time I'm twiddling my thumbs I'll try to throw it
 together. I've never dealt directly with the Cabal library, but
 there's a first time for everything. If someone else wants to write
 that tool and wants help sticking a web service on it, let me know.

 Michael

 [1] http://neilmitchell.blogspot.com/2010/10/enhanced-cabal-sdist.html
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 This would be a nice feature for the new hackage server:
 http://sparky.haskell.org:8080

 Bas
 ___
 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] Haskellers.com skills list moderation?

2010-10-20 Thread John Lato
My $.02 follows:


 From: Michael Snoyman mich...@snoyman.com

 There's only two skills which I think absolutely must go:

 Other languages I know: C# .NET, XSLT, Microsoft SQL Server, XML, SQL,
 CSS, C, C++, Java, HTML, Visual Basic Script, Pascal, Rexx, Basic and
 assembler
 tool building


Agreed that both should go.


 There are 11 skills I'm leaning towards dropping, all because they
 fall in the too vague/too general category. Your input is requested on
 these. They are:

 Attribute Grammar


Keep as Attribute Grammars


 Cabal, packaging, build and distribution tools


This should be two categories: Cabal internals and Software
packaging/distribution tools.  Keep Cabal internals, possibly keep the
other


 Categorical Programming

Denotational design
 Digital Forensics


keep


 Fault Tolerant Server Software

Mathematics


drop (possibly keep FTSS, maybe change the name)


 Programming using Arrows


Possibly keep with a different name


 Proving observational equivalence between Haskell programs


drop


 Transactional business applications development


I'm not entirely sure what this means, specifically if it's business
transactions or db/software transactions.


 UNIX Scripting and Tool Authoring


keep as UNIX Scripting



 Of the remaining 32 skills, some of them fall in the too specific
 range just a bit (software transactional memory, property based
 testing), but I'm inclined to let it slide. These 32 are:

 Advanced type-level programming (GADTs, TypeFamilies, proofs, etc.)
 Algorithmic Problem Solving
 Bioinformatics
 Concurrent Haskell
 DSL Design
 Darcs internals
 Foreign Function Interface (FFI)
 Formal Verification
 Functional graphics programming (2D, 3D, GPU)
 GHC internals
 Generic Programming
 Graphical User Interfaces
 Happstack Web Framework
 Hardware Acceleration DSLs
 Haskell on embedded devices
 High Assurance Software Development
 High-performance Haskell
 Metaprogamming via Template Haskell
 Natural Language Processing (tagging, parsing, translation,...)
 Physics  Simulation
 Programming language translation
 Property based testing (QuickCheck)
 Purely functional data structures — design and implementation
 Reverse Engineering
 Robotics and Automation
 Signal Processing
 Software Transactional Memory
 Teaching Haskell
 Web development (HTML, CSS and Javascript)
 Yesod Web Framework


 I would argue for keeping most of these.  I do think that skills based on
specific packages (Happstack, Yesod, STM?) perhaps should be dropped, except
for packages that are integral to the Haskell universe (compilers, Cabal,
Darcs?, QuickCheck?).  For these packages, I think the -internals
categories are the most useful.

What about rolling Happstack, Yesod, etc. into Haskell Web Frameworks, and
possibly also keeping the Web Development (HTML, CSS and Javascript)
category?

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


[Haskell-cafe] HDBC/ODBC/MySQL - working configuration?

2010-10-20 Thread Neil Davies
Hi

I'm having some difficulty getting the above combination to work, I've 
successfully used ODBC against MS but the MySQL stuff is creating some really 
interesting error conditions in the HDBC-ODBC module.

My first thought is that it must be me, so does anyone out there have this 
combination working (with or without HaskellDB)? If so, can you tell me which 
versions of things you are using and which ODBC drivers (and configurations) 
you are using?

Cheers

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


Re: [Haskell-cafe] Haskellers.com skills list moderation?

2010-10-20 Thread Ivan Lazar Miljenovic
On 20 October 2010 21:38, John Lato jwl...@gmail.com wrote:
 Cabal, packaging, build and distribution tools

 This should be two categories: Cabal internals and Software
 packaging/distribution tools.  Keep Cabal internals, possibly keep the
 other

What does Cabal internals refer to?  Actually using Cabal as a
library?  Developing Cabal itself?

 Fault Tolerant Server Software

 Mathematics

 drop (possibly keep FTSS, maybe change the name)

Why drop mathematics?  (I'd prefer it to be split up, but
mathematically-oriented programming is a large/important subset of
Haskell skills IMHO, though I admit I'm biased).
 UNIX Scripting and Tool Authoring

 keep as UNIX Scripting

What's wrong with Tool Authoring?  To some, scripting implies
quick+dirty temporary applications/scripts as opposed to a
well-engineered tool.

-- 
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


Re: [Haskell-cafe] Haskellers.com skills list moderation?

2010-10-20 Thread Ivan Lazar Miljenovic
On 20 October 2010 21:52, Henning Thielemann
lemm...@henning-thielemann.de wrote:

 On Wed, 20 Oct 2010, John Lato wrote:

      Mathematics

 I'd be interested in how many Haskellers refer to Category Theory here, and
 how many to other mathematical subjects. :-)

I for one refer to other stuff; my understanding of CT is almost non-existant.

-- 
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


RE: [Haskell-cafe] Are newtypes optimised and how much?

2010-10-20 Thread Simon Peyton-Jones
|  At the end of the day what motivated me to ask these questions it that
|  I like very much defining newtypes for most of the types I use, I have
|  completely forgotten about `type' aliasing. I'm completely happy to
|  write Foo and unFoo all over the place to aid my type correctness, but
|  I want a nice generic way to convert to/from newtypes but keeping it a
|  compile-time concept. Sometimes I have unThisThat, unTheOther,
|  unThoseWhoShantBeNamed, etc. and it I could just use fromIntegral and
|  fromString then that would be super.

Yes, you can freely use Foo/unFoo.  There's no runtime penalty.  (In the jargon 
of GHC's intermediate language, Foo and unFoo translate to *type-safe casts*, 
which generate no executable code.

That includes the 'newtype deriving' stuff too, and hence your uses of 
fromInteger etc.

However, sadly:

|  Also, is 'map unFoo' optimised away at compile-time, too? I think that
|  it would be compiled to map id. So it would still wrap a thunk around
|  each cons. How far does it go?   

No, this isn't optimised.  The trouble is that you write (map Foo xs), but GHC 
doesn't know about 'map'.  We could add a special case for map, but then you'd 
soon want (mapTree Foo my_tree).

What you really want is to say is something like this.  Suppose my_tree :: Tree 
String.  Then you'd like to say
my_tree ::: Tree Foo
meaning please find a way to convert m_tree to type (Tree Foo), using newtype 
coercions.  

The exact syntax is a problem (as usual).  We have the technology now.  The 
question is how important it is.

Simon

|  -Original Message-
|  From: haskell-cafe-boun...@haskell.org 
[mailto:haskell-cafe-boun...@haskell.org]
|  On Behalf Of Christopher Done
|  Sent: 19 October 2010 19:12
|  To: Haskell Cafe
|  Subject: [Haskell-cafe] Are newtypes optimised and how much?
|  
|  So I have the following nice things:
|  
|  {-# LANGUAGE GeneralizedNewtypeDeriving, OverloadedStrings #-}
|  
|  import Data.String
|  
|  newtype Foo = Foo { unFoo :: String } deriving (IsString)
|  
|  x :: Foo
|  x = Hello, World!
|  
|  newtype Bar = Bar { unBar :: Integer } deriving
|  (Eq,Show,Num,Integral,Real,Enum,Ord)
|  
|  y :: Bar
|  y = 2
|  
|  I can write literals and they will be converted to the type I wanted
|  with no extra verbiage needed.
|  
|  Questions (I'm talking about GHC when I refer to compilation):
|  
|  (1) Are fromString and fromIntegral ran at compile time? I don't think
|  that this is the case. I think they are just translated to fromString
|  Hello, World! and fromIntegral 2 verbatim.
|  (2) Regardless of this, the implementation of fromString and
|  fromIntegral is essentially a no-op, it's just fromString = Foo,
|  fromIntegral = Bar, which is in turn essentially fromString = id,
|  fromIntegral = id, as far as I understand it. It's purely compile
|  time. But supposing I write:
|  
|  fromIntegral (fromIntegral (2::Integer) :: Bar) :: Integer
|  
|  Is this at the end of the day equal to just (2::Integer)? Thinking
|  simple-mindedly, I would say, yes. The compiler knows that
|  fromIntegral :: Integer - Bar == id, and that fromIntegral :: Bar -
|  Integer == id (right?). But is that the case? Perhaps the type class
|  methods have some dictionary and thus cannot be inlined, or maybe that
|  doesn't matter?
|  
|  At the end of the day what motivated me to ask these questions it that
|  I like very much defining newtypes for most of the types I use, I have
|  completely forgotten about `type' aliasing. I'm completely happy to
|  write Foo and unFoo all over the place to aid my type correctness, but
|  I want a nice generic way to convert to/from newtypes but keeping it a
|  compile-time concept. Sometimes I have unThisThat, unTheOther,
|  unThoseWhoShantBeNamed, etc. and it I could just use fromIntegral and
|  fromString then that would be super.
|  
|  Also, is 'map unFoo' optimised away at compile-time, too? I think that
|  it would be compiled to map id. So it would still wrap a thunk around
|  each cons. How far does it go?   
|  
|  So, if I go around using fromIntegral/fromString (etc. for other
|  newtype types), is it still kept compile time? After having newtypes
|  catch dozens of type mismatches that otherwise wouldn't unified
|  happily but were completely wrong (e.g. wrong argument order), I've
|  found newtype to be an indispensable part of Haskell and of writing a
|  large piece of software.
|  
|  Cheers
|  ___
|  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] Haskellers.com skills list moderation?

2010-10-20 Thread John Lato
On Wed, Oct 20, 2010 at 11:48 AM, Ivan Lazar Miljenovic 
ivan.miljeno...@gmail.com wrote:

 On 20 October 2010 21:38, John Lato jwl...@gmail.com wrote:
  Cabal, packaging, build and distribution tools
 
  This should be two categories: Cabal internals and Software
  packaging/distribution tools.  Keep Cabal internals, possibly keep the
  other

 What does Cabal internals refer to?  Actually using Cabal as a
 library?  Developing Cabal itself?


Developing Cabal itself.



  Fault Tolerant Server Software
 
  Mathematics
 
  drop (possibly keep FTSS, maybe change the name)

 Why drop mathematics?  (I'd prefer it to be split up, but
 mathematically-oriented programming is a large/important subset of
 Haskell skills IMHO, though I admit I'm biased).


Mathematics is far too broad to be useful.  I agree that subsets of math
would be informative (e.g. statistical modelling, linear algebra, graph
theory, dif. eq., etc.), but how do you break up Mathematics and assign
users who listed it as a skill to its constituent parts?


  UNIX Scripting and Tool Authoring
 
  keep as UNIX Scripting

 What's wrong with Tool Authoring?  To some, scripting implies
 quick+dirty temporary applications/scripts as opposed to a
 well-engineered tool.


Again, Tool Authoring is too broad to be useful.  What else do software
developers do but author tools?  Contrast to UNIX Scripting, which means
familiarity with at least a shell and likely one or more of awk, perl,
python, regexes, ...  I don't make quality judgements just from the term
scripting, and I'd certainly rather use a well-engineered script over a
quick+dirty tool.

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


Re: [Haskell-cafe] Haskellers.com skills list moderation?

2010-10-20 Thread Stephen Tetley
On 20 October 2010 12:30, John Lato jwl...@gmail.com wrote:
[SNIP]
 Again, Tool Authoring is too broad to be useful.

Who are the skills lists for?

Recruiters, other Haskellers to form strike forces, something else?

For the recruiters I think they are somewhat obscure unless Well-Typed
or Galois were searching.

Trivia - I did once apply for a job that listed 'attribute grammars'
as a requirement - as far as I could tell it was compiler development
/ maintenance for a special purpose chip, but I never heard back so I
guess I missed the mark on the other skills.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskellers.com skills list moderation?

2010-10-20 Thread Ben Millwood
On Tue, Oct 19, 2010 at 2:32 PM, Michael Snoyman mich...@snoyman.com wrote:
 Algorithmic Problem Solving

I think this needs to go, because I'm really having a hard time
imagining any programmer who doesn't do this.

 High Assurance Software Development

This sounds vague to me and/or the same as other skills (cf. Formal
Verification). Again, I'm not sure how many people would describe
their software as low assurance.

 Robotics and Automation

Would be tempted to drop Automation from here.

 Web development (HTML, CSS and Javascript)

I wonder if these parentheses are necessary, or if they hint at the
fact that this isn't really one skill. I have a suspicion that being
competent at website and stylesheet *design* (i.e. knowledge of good
design principles and application to HTML/CSS) is an entirely
different sort of thing from *implementation* in terms of JavaScript
technologies like AJAX and JSON and who-knows-what.

Overall, I think it would be nice to have a consistent idea about how
concrete or abstract we allow skills to be, and as someone else
mentioned what the target audience is for them. We have skills that
relate to specific libraries and then skills that are nebulous and
abstract. Maybe we could ask a narrower question, or have two fields:
what can you use, and what interests you.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Idea for a tool

2010-10-20 Thread Michael Snoyman
Alright, the tool is up and incredibly basic right now. Go to:
http://packdeps.haskellers.com/, type a search string, and hit enter.
The site will filter through all of the cabal files for the most
recent releases of each package and select the ones where your search
string appears in the package name, maintainer and/or author fields.

From those packages, it will check to see if there are any
upper-bounds restrictions excluding a package. The results are
returned as an Atom feed, so you can easily add this to a reader or
maybe even sign up for email alerts[1].

Let me know if there are any bugs, eventually I'll put up some proper
information on the page describing what's going on there. Oh, and the
package database gets refreshed every 6 hours.

Michael

[1] http://www.feedmyinbox.com/

On Wed, Oct 20, 2010 at 12:30 PM, Michael Snoyman mich...@snoyman.com wrote:
 Well, here's an initial, ugly version of this tool. Feed it two
 command line arguments: a cabal file, and the 00-index.tar file in the
 .cabal/packages/hackage.haskell.org folder. More work to follow.

 Michael

 On Wed, Oct 20, 2010 at 12:25 PM, Neil Mitchell ndmitch...@gmail.com wrote:
 Hi Michael,

 I want this tool. I fake it slightly by using my RSS reader and
 http://page2rss.com/ to get notified when any packages I depend on
 change, which basically works - but if you could provide a better
 service (ideally integrated in to hackage), I'd use it.

 Thanks, Neil

 On Wed, Oct 20, 2010 at 8:27 AM, Bas van Dijk v.dijk@gmail.com wrote:
 On Wed, Oct 20, 2010 at 7:36 AM, Michael Snoyman mich...@snoyman.com 
 wrote:
 Hi all,

 I saw a quote from Eric Kow via Neil Mitchell[1] that we don't spend
 enough time writing tools. Well, I've decided that the most annoying
 part of package maintainership right now is staying on top of new
 versions of dependencies. We essentially have two options right now:

 * Follow the PVP and put an upper bound on all dependencies, and
 people will be upset when your package only works with the old version
 of the dependency.
 * Skip the upper bound, and risk having your code break when there's a
 new version.

 I have an idea for a tool: you give it a list of packages you
 maintain, or even better yet, you give it your email address and it
 gets that list automatically. Then is looks through all your
 dependencies and sees if you have any upper bounds preventing newer
 versions from being used. Bonus points for making it a web service
 that just gives you an RSS feed.

 If anyone's interested in writing a tool like that, let me know.
 Otherwise, next time I'm twiddling my thumbs I'll try to throw it
 together. I've never dealt directly with the Cabal library, but
 there's a first time for everything. If someone else wants to write
 that tool and wants help sticking a web service on it, let me know.

 Michael

 [1] http://neilmitchell.blogspot.com/2010/10/enhanced-cabal-sdist.html
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 This would be a nice feature for the new hackage server:
 http://sparky.haskell.org:8080

 Bas
 ___
 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] Haskellers.com skills list moderation?

2010-10-20 Thread Anthony Cowley
On Wed, Oct 20, 2010 at 9:02 AM, Ben Millwood hask...@benmachine.co.uk wrote:
 Robotics and Automation

 Would be tempted to drop Automation from here.

That name was deliberately chosen, and is appropriate for people in the area,
http://www.ieee-ras.org/

I have my own opinions on a lot of these tags, but haskell-cafe
doesn't seem like the right forum for this polling. A difficulty is
that while we may all be qualified to debate the merits of
Mathematics as a discriminative label for programmers, some of these
tags (such as the one above) are domain specific. We don't want people
outside of an area of interest governing name choices that lessen the
value of the tags.

As a strawman for people to beat up on, what if each tag linked to a
wiki description? Such a description could include a couple sentences
of exposition, and perhaps links to relevant resources.

Another alternate is that if a tag becomes *too* popular (i.e. more
than x% of haskellers check it off), then perhaps there should be a
poll to have it removed and its spirit embedded in the general site
text. Tags like Algorithmic Problem Solving might fall into this
category.

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


Re: [Haskell-cafe] Haskellers.com skills list moderation?

2010-10-20 Thread Tim Matthews
I just want to throw out 2 extreme case solutions to think about while this
problem doesn't really seem to be heading anywhere:

1) Drop the skills options in favor of the simple text box already in use.
This would of course would have a big impact on attempting to search for
haskellers.

2) A formal Haskell certification system that would be of great use outside
of haskellers.com too and recognized and trusted by employers all over the
world. Java developers can certifiably in individual areas through
thishttp://en.wikipedia.org/wiki/Sun_Certified_Professionalfor
example.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Should Yesod.Mail be a separate package?

2010-10-20 Thread Yitzchak Gale
Michael Snoyman wrote:
 [1] http://hackage.haskell.org/package/mime-mail

Great news! This is an important package.

It's obviously very preliminary, though. This is not
trivial to get right - look at the long and colorful
history of the Python email library, detailed on the
first page of the library documentation.

Here are some initial suggestions for improvement:

1. The module name Network.Mail.Mime
is too generic. There will also be a parser someday.
We should have Types, Parse, and Render in
separate modules. I expect each of those to grow
gradually as more features are added.

On the other hand, I think I like the decision to
re-implement just the features of RFC 2822
message format needed for everyday MIME
use rather than building this on top of a more
generic message type, as is done in Python.
It simplifies things.

But are multi-line headers supported properly?
That's trickier than it looks, there have historically
been many wrong implementations out there.
That itself could be a reason to build this on top
of a proper RFC 2822 implementation.

2. mailHeaders should have an Ord instance that
compares case-insensitively, though the underlying
Strings should remain Strings.

3. It should be possible to control whether text
parts get quoted-printable encoded. Perhaps add
QuotedPrintable to Encoding?

4. I don't like having those sendmail things here in
the same module and package. It's convenient,
but messy in several ways - creates a spurious
dependency on process, only works on certain
platforms and even then with possible weird platform
dependencies, etc. I think this should be in
a separate package. Once there is a nice
easy-to-use SMTP companion package, I
don't think the sendmail things will be used
that much anyway. Put them in a separate package,
but mention it in prominent places so people
will find it.

5. Is the blaze-builder dependency necessary now that
Bryan has built those techniques into Data.Text?

6. Are I18N text-encoded headers supported? That's
very important, even for simple everyday usage.
It's a bit complicated, though. That might be another
reason to build on top of a full RFC 2822 implementation.

7. This very simple interface is great for everyday
use. Think about how to add the less common
options for more general use, without cluttering up
the everyday interface - custom parameters for
Content-Type and Content-Disposition, specifying
the boundary rather than allowing it to be generated
automatically, etc. It's important to think about
those kinds of things now, before the interface
gets set in cement.

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


Re: [Haskell-cafe] ANN: fountain-0.0.0

2010-10-20 Thread David Leimbach
2 things.

1. Wow that's cool.

2. Is this technology not patented by Digital Fountain?  (now Qualcomm?)

I remember when I first heard of fountain codecs, I thought it was science
fiction based on the description :-).

Dave



On Tue, Oct 19, 2010 at 8:00 PM, Tom Hawkins tomahawk...@gmail.com wrote:

 This library [1] implements a fountain code [2].  Fountain codes are
 forward error correction codes for erasure channels [3].  A fountain
 code encodes a message into an infinite stream of packets --
 transmitters generate message packets at random, on-the-fly.  To
 reconstruct the message, receivers simply need to capture enough
 packets for the decoding process.  As a rateless code, fountain codes
 automatically adapt to varying channel conditions.

 Some of the more interesting applications of fountain codes include
 unsynchronized data broadcast and distributed download.  For example,
 a multiple number of devices can transmitting content to multiple
 receivers without any coordination.  Because packets are generated at
 random, receivers increase their bandwidth simply by listening to more
 transmitters.  Note that receivers can also start generating packets
 and forwarding the message on even before they have decoded the
 complete message.

 This library provides a packet generator and a decoder for one of the
 first known fountain codes: LT codes [4].  It also includes a test
 function to experiment with message lengths, and encoding degrees --
 it runs a simulation to determine the number of packets needed to
 decode a message.

 -Tom


 [1] http://hackage.haskell.org/package/fountain
 [2] http://en.wikipedia.org/wiki/Fountain_code
 [3] http://en.wikipedia.org/wiki/Binary_erasure_channel
 [4] http://en.wikipedia.org/wiki/LT_codes
 ___
 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] Haskellers.com skills list moderation?

2010-10-20 Thread wren ng thornton

On 10/20/10 9:12 AM, Anthony Cowley wrote:

We don't want people
outside of an area of interest governing name choices that lessen the
value of the tags.


To be honest, when the thread first came up, I was afraid NLP (or AG) 
would end up on the cutting block because of that...




As a strawman for people to beat up on, what if each tag linked to a
wiki description? Such a description could include a couple sentences
of exposition, and perhaps links to relevant resources.


+1.

As an additional strawman, perhaps the I can use X (package, program, 
markup language,...) stuff should be broken out separately from the 
skills, just like package authorship is. There seems to be a tension 
here between resume-esque listing of every competence with some 
acronym-of-the-day, vs listing larger areas of overall knowledge (NLP, 
RA, mathematics,...)




Another alternate is that if a tag becomes *too* popular (i.e. more
than x% of haskellers check it off), then perhaps there should be a
poll to have it removed and its spirit embedded in the general site
text. Tags like Algorithmic Problem Solving might fall into this
category.


+1.

Another option which may be interesting to pursue is to make the skills 
list hierarchical, so that when Algorithmic Problem Solving gets 
broken up into Foo, Bar, and Zot, we get the new skills listed as 
checkable subskills of uncheckable Algorithmic Problem Solving. 
...Though that might just be delaying the garbage collection until later 
(witness Data.*).


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: fountain-0.0.0

2010-10-20 Thread Tom Hawkins
 1. Wow that's cool.

Indeed.

 2. Is this technology not patented by Digital Fountain?  (now Qualcomm?)

I'm sure it is.  This library is a naive implementation of LT codes,
which have nowhere near the performance of Digital Fountain's Raptor
codes.

 I remember when I first heard of fountain codecs, I thought it was science
 fiction based on the description :-).

What I find amazing is RaptorQ fountain codes can complete the
decoding after receiving only 1% more symbols than the original
message.

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


Re: [Haskell-cafe] Are newtypes optimised and how much?

2010-10-20 Thread Christopher Done
On 20 October 2010 13:09, Simon Peyton-Jones simo...@microsoft.com wrote:
 Yes, you can freely use Foo/unFoo.  There's no runtime penalty.  (In the 
 jargon of GHC's intermediate language, Foo and unFoo translate to *type-safe 
 casts*, which generate no executable code.

 That includes the 'newtype deriving' stuff too, and hence your uses of 
 fromInteger etc.

Oh wow, excellent!

 No, this isn't optimised.  The trouble is that you write (map Foo xs), but 
 GHC doesn't know about 'map'.  We could add a special case for map, but then 
 you'd soon want (mapTree Foo my_tree).

 What you really want is to say is something like this.  Suppose my_tree :: 
 Tree String.  Then you'd like to say
        my_tree ::: Tree Foo
 meaning please find a way to convert m_tree to type (Tree Foo), using 
 newtype coercions.

 The exact syntax is a problem (as usual).  We have the technology now.  The 
 question is how important it is.

I don't know whether it's so important for me at least. I was just
interested in how much optimisation it did.

On 20 October 2010 17:58, Gregory Crosswhite gcr...@phys.washington.edu wrote:
 On 10/20/10 4:09 AM, Simon Peyton-Jones wrote:

 No, this isn't optimised.  The trouble is that you write (map Foo xs), but
 GHC doesn't know about 'map'.  We could add a special case for map, but then
 you'd soon want (mapTree Foo my_tree).

 How about a special case for fmap?  That seems like it should handle a lot
 of cases.

Personally I haven't had much use for mapping newtype
constructors/unconstructors.

My personal use case of newtypes unwrapping/wrapping is in passing
them to functions and in record fields, not so much unwarpping them
inside data types and trees across the board.

-- | Assign a review for a submission to a user.
assignReview :: TrackId - UserId - SubmissionId - Model ()
assignReview tid uid sid = do
  insert T.review $
 F.uid- unUserId uid
   # F.submission - unSubmissionId sid
   # F.trackId- unTrackId tid

This is the simplest function I could find. However, consider if in my
busy hacking I accidentally get the argument order incorrect in the
definition, or the call, with newtypes I can't mismatch them. This has
stopped me doing bad things a few times in my haste.

Another nice thing I've found is combining them with view patterns:

-- | Submit a review.
submitReview :: UserId - SubmissionId - [ReviewField] - Model ()
submitReview (unUserId - uid) (unSubmissionId - sid) rs = do
  forM_ rs $ \ReviewField{..} -
 ...

The next ten lines or so use uid and sid. This makes the submitReview
function kind of guarded from being given the wrong values. Inside
it can do what it wants. You might point out that now that I've
unwrapped them I can pass them to some other function willy nilly, but
of course if a function needs a submission id, then it needs a
SubmissionId. So I find this really nice. And of course I use the
deriving extensively:

newtype SubmissionId = SubmissionId { unSubmissionId :: Int }
  deriving (Show,Num,Eq,Ord,Enum,Integral,Real,ShowConstant,JSON)

I have a types file with 46 newtypes, zero type aliases, and ah, 47
data types. GHCi gets kind of slow when dealing with it. My solution
is to have an Emacs shortcut to build the project with cabal every so
often so that GHCi can load the .o files in an instant.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: libefence useful for debugging ghc+ffi programs?

2010-10-20 Thread Edward Z. Yang
Excerpts from Johannes Waldmann's message of Wed Oct 20 05:13:36 -0400 2010:
 and indeed, gethostbyname is famous for being non re-entrant.

If you have the time, this would be a great time to improve the multithreaded
support of these libraries.  In particular, glibc offers a re-entrant version
gethostbyname_r, so at least for some POSIX systems network could be switched
to using that.  If all else fails, perhaps manually synchronize over an MVar
and hope no one else imports the FFI.

If you don't have the time, if you can identify where gethostbyname is
getting called from, hopefully you can manually synchronize those sections
of the program.

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


[Haskell-cafe] Is it possible to easily connect Haskell to JavaScript/JavaFX in the browser and use a browser as a Windows GUI? :)

2010-10-20 Thread caseyh
Is it possible to easily connect Haskell to JavaScript/JavaFX in the  
browser and use a browser as a Windows GUI? :)


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


[Haskell-cafe] Re: Return value of a (windows) process

2010-10-20 Thread Tim
I have never used the above function you refer to so I am not sure
about it's semantics. However, I have successfully used functions in
System.Process module [1] (fairly standard) to spawn processes and get
their exit codes on Windows.

For example, (javac exits code 2 when provided no arguments)

C:\Documents and Settings\Timjavac
Usage: javac options source files
where possible options include:
 -g Generate all debugging info
 ... snip

C:\Documents and Settings\Timecho %ERRORLEVEL%
2

C:\Documents and Settings\Timghci
GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude :m System.Process
Prelude System.Process readProcessWithExitCode c:\\jdk6\\bin\
\javac.exe [] 
(ExitFailure 2,,Usage: javac options so...

Hope this helps.
- Tim

[1] System.Process 
http://haskell.org/ghc/docs/6.12.2/html/libraries/process-1.0.1.2/System-Process.html

On Oct 19, 10:12 pm, Arnaud Bailly arnaud.oq...@gmail.com wrote:
 Hello,
 I have the following code (fragment) I use to wrap execution of
 various processes in Haskell, in the spirit of Don Stewart's slides
 about Scripting in Haskell.

 instance MonadExec IO where
   exec proc args = do (exit, out, err) -  liftIO $
 readProcessWithExitCode proc args 
                       case exit of
                         ExitFailure e - throwError $ userError (Fail
 execution of  ++ program proc args ++ :  ++ (show e) ++,  ++err)
                         ExitSuccess   - return out

 Here is the abridged declaration of MonadExec:
 class (Monad m) = MonadExec m  where
   exec      :: String - [String] - m String

 The issue I am facing is that readProcessWithExitCode does not seem to
 return the expected failures.
 When I run some failing process within windows command shell, I have:

 D:\projets\psug-dojo\lagsd:/Program
 Files/scala-2.8.0/bin/scalac.bat -d target\test-classes -classpath
 target\classes;D:\projets\
 psug-dojo\lags\test-lib\specs_2.8.0-1.6.5.jar;D:\projets\psug-dojo\lags\test-lib\scalacheck_2.8.0-1.7.jar;D:\projets\psug-dojo\lags\
 test-lib\junit-4.7.jar -d target\test-classes
 src\test\scala\oqube\lags\LagsTest.scala
 src\test\scala\oqube\lags\LagsTest.scala:86: error: not found: value beS_==
       bid.sublists(List(Request(1,2,3))) must
 beS_==(List(Nil,List(Request(1,2,3
                                               ^
 one error found

 D:\projets\psug-dojo\lagsecho %ERRORLEVEL%
 1

 D:\projets\psug-dojo\lags

 but wrapping this same process in my shell, I always got an ExitSuccess.

 What am I doing wrong ?

 Thanks
 Arnaud
 ___
 Haskell-Cafe mailing list
 haskell-c...@haskell.orghttp://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] Is it possible to easily connect Haskell to JavaScript/JavaFX in the browser and use a browser as a Windows GUI? :)

2010-10-20 Thread Stephen Tetley
Claus Reinke posted this a while ago - see the attachment at the
bottom of the message:

http://www.haskell.org/pipermail/haskell-cafe/2007-July/029275.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are newtypes optimised and how much?

2010-10-20 Thread James Andrew Cook
On Oct 20, 2010, at 11:58 AM, Gregory Crosswhite gcr...@phys.washington.edu 
wrote:

 On 10/20/10 4:09 AM, Simon Peyton-Jones wrote:
 No, this isn't optimised.  The trouble is that you write (map Foo xs), but 
 GHC doesn't know about 'map'.  We could add a special case for map, but then 
 you'd soon want (mapTree Foo my_tree).
 
 How about a special case for fmap?  That seems like it should handle a lot of 
 cases.
 

Or even better, a special handling of 'id' in rules pragmas that would cause 
any rule matching id to also match any newtype constructor or projection. Or 
have the compiler automatically add rules that map all newtype wrappers and 
unwrappers to unsafeCoerce and make sure that unsafeCoerce has rules for map, 
fmap, (.), etc.

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


[Haskell-cafe] Re: libefence useful for debugging ghc+ffi programs?

2010-10-20 Thread Johannes Waldmann

  and indeed, gethostbyname is famous for being non re-entrant.

it already has a lock in Network.BSD, so I assume it's fine:


{-# NOINLINE lock #-}
lock :: MVar ()
lock = unsafePerformIO $ newMVar ()

withLock :: IO a - IO a
withLock act = withMVar lock (\_ - act)

getHostByName :: HostName - IO HostEntry
getHostByName name = withLock $ do
  withCString name $ \ name_cstr - do
   ent - throwNoSuchThingIfNull getHostByName no such host entry
$ trySysCall $ c_gethostbyname name_cstr
   peek ent


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


Re: [Haskell-cafe] Re: Return value of a (windows) process

2010-10-20 Thread Arnaud Bailly
Well, I must be doing something wrong but don't know where, the code
is rather straightforward.
Or the scalac.bat script is buggy:

Prelude Environment System.Process readProcessWithExitCode
d:/Program Files/scala-2.8.0/bin/scalac.bat [-d,target] 
(ExitSuccess,,Exception in thread \main\
scala.tools.nsc.FatalError: target does not exist or is not a
directory\n\tat
scala.tools.nsc.settings.MutableSettings$OutputDirs.checkDir(MutableSettings.scala:227)\n\tat
scala.tools.nsc.settings.MutableSettings$OutputDirs.setSingleOutput(MutableSettings.scala:236)\n\tat
scala.tools.nsc.settings.MutableSettings$OutputSetting.value_$eq(MutableSettings.scala:452)\n\tat
scala.tools.nsc.settings.MutableSettings$OutputSetting.value_$eq(MutableSettings.scala:445)\n\tat
scala.tools.nsc.settings.MutableSettings$StringSetting.tryToSet(MutableSettings.scala:418)\n\tat
scala.tools.nsc.settings.MutableSettings$$anonfun$parseNormalArg$1$1$$anonfun$apply$3.apply(MutableSettings.scala:121)\n\tat
scala.tools.nsc.settings.MutableSettings$$anonfun$parseNormalArg$1$1$$anonfun$apply$3.apply(MutableSettings.scala:121)\n\tat
scala.tools.nsc.settings.MutableSettings.tryToSetIfExists$1(MutableSettings.scala:98)\n\tat
scala.tools.nsc.settings.MutableSettings.parseNormalArg$1(MutableSettings.scala:121)\n\tat
scala.tools.nsc.settings.MutableSettings.doArgs$1(MutableSettings.scala:154)\n\tat
scala.tools.nsc.settings.MutableSettings.parseParams(MutableSettings.scala:160)\n\tat
scala.tools.nsc.settings.MutableSettings.processArguments(MutableSettings.scala:44)\n\tat
scala.tools.nsc.CompilerCommand.processArguments(CompilerCommand.scala:87)\n\tat
scala.tools.nsc.CompilerCommand.init(CompilerCommand.scala:91)\n\tat
scala.tools.nsc.Main$.process(Main.scala:52)\n\tat
scala.tools.nsc.Main$.main(Main.scala:122)\n\tat
scala.tools.nsc.Main.main(Main.scala)\n)

Arnaud


On Wed, Oct 20, 2010 at 8:46 PM, Tim trba...@gmail.com wrote:
 I have never used the above function you refer to so I am not sure
 about it's semantics. However, I have successfully used functions in
 System.Process module [1] (fairly standard) to spawn processes and get
 their exit codes on Windows.

 For example, (javac exits code 2 when provided no arguments)

 C:\Documents and Settings\Timjavac
 Usage: javac options source files
 where possible options include:
  -g                         Generate all debugging info
  ... snip

 C:\Documents and Settings\Timecho %ERRORLEVEL%
 2

 C:\Documents and Settings\Timghci
 GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 Prelude :m System.Process
 Prelude System.Process readProcessWithExitCode c:\\jdk6\\bin\
 \javac.exe [] 
 (ExitFailure 2,,Usage: javac options so...

 Hope this helps.
 - Tim

 [1] System.Process 
 http://haskell.org/ghc/docs/6.12.2/html/libraries/process-1.0.1.2/System-Process.html

 On Oct 19, 10:12 pm, Arnaud Bailly arnaud.oq...@gmail.com wrote:
 Hello,
 I have the following code (fragment) I use to wrap execution of
 various processes in Haskell, in the spirit of Don Stewart's slides
 about Scripting in Haskell.

 instance MonadExec IO where
   exec proc args = do (exit, out, err) -  liftIO $
 readProcessWithExitCode proc args 
                       case exit of
                         ExitFailure e - throwError $ userError (Fail
 execution of  ++ program proc args ++ :  ++ (show e) ++,  ++err)
                         ExitSuccess   - return out

 Here is the abridged declaration of MonadExec:
 class (Monad m) = MonadExec m  where
   exec      :: String - [String] - m String

 The issue I am facing is that readProcessWithExitCode does not seem to
 return the expected failures.
 When I run some failing process within windows command shell, I have:

 D:\projets\psug-dojo\lagsd:/Program
 Files/scala-2.8.0/bin/scalac.bat -d target\test-classes -classpath
 target\classes;D:\projets\
 psug-dojo\lags\test-lib\specs_2.8.0-1.6.5.jar;D:\projets\psug-dojo\lags\test-lib\scalacheck_2.8.0-1.7.jar;D:\projets\psug-dojo\lags\
 test-lib\junit-4.7.jar -d target\test-classes
 src\test\scala\oqube\lags\LagsTest.scala
 src\test\scala\oqube\lags\LagsTest.scala:86: error: not found: value beS_==
       bid.sublists(List(Request(1,2,3))) must
 beS_==(List(Nil,List(Request(1,2,3
                                               ^
 one error found

 D:\projets\psug-dojo\lagsecho %ERRORLEVEL%
 1

 D:\projets\psug-dojo\lags

 but wrapping this same process in my shell, I always got an ExitSuccess.

 What am I doing wrong ?

 Thanks
 Arnaud
 ___
 Haskell-Cafe mailing list
 haskell-c...@haskell.orghttp://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] Is it possible to easily connect Haskell to JavaScript/JavaFX in the browser and use a browser as a Windows GUI? :)

2010-10-20 Thread Stephen Sinclair
On Wed, Oct 20, 2010 at 3:11 PM, Stephen Tetley
stephen.tet...@gmail.com wrote:
 Claus Reinke posted this a while ago - see the attachment at the
 bottom of the message:

 http://www.haskell.org/pipermail/haskell-cafe/2007-July/029275.html

Thanks for that.  Here's the relevant website that he posted later in
that thread:
http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/browsing/

Of course, it would be nice to be able to write the javascript parts
in Haskell, and even use a Haskell framework for generating the HTML.
I'm sure this is possible with things like Yesod, etc.

Just wanted to mention, currently I am working on a project (not in
Haskell) that takes a similar approach of starting up an HTTP server
and using the browser for the GUI.  We are thinking about including a
copy of Chromium in the binary release, and launching it on
double-click with the --app flag which opens a chromeless browser
window (i.e just a window border containing an HTML renderer) looking
just like a local application.

Another option is XULRunner, which you can use to create an
application with native menus and widgets around the border, and add a
browser element to the GUI which points at your Haskell web
server.  You could probably even generate the XUL layout code in the
Haskell server if you wanted, which would provide a totally
native-looking app.  (At least for those who don't consider Firefox
very awful-looking, I know there are some Cocoa pedants around who
would complain.. ;)

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


Re: [Haskell-cafe] Is it possible to easily connect Haskell to JavaScript/JavaFX in the browser and use a browser as a Windows GUI? :)

2010-10-20 Thread Stephen Sinclair
On Wed, Oct 20, 2010 at 4:27 PM, Stephen Sinclair radars...@gmail.com wrote:
 On Wed, Oct 20, 2010 at 3:11 PM, Stephen Tetley
 stephen.tet...@gmail.com wrote:
 Claus Reinke posted this a while ago - see the attachment at the
 bottom of the message:

 http://www.haskell.org/pipermail/haskell-cafe/2007-July/029275.html

 Thanks for that.  Here's the relevant website that he posted later in
 that thread:
 http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/browsing/

 Of course, it would be nice to be able to write the javascript parts
 in Haskell, and even use a Haskell framework for generating the HTML.
 I'm sure this is possible with things like Yesod, etc.

 Just wanted to mention, currently I am working on a project (not in
 Haskell) that takes a similar approach of starting up an HTTP server
 and using the browser for the GUI.  We are thinking about including a
 copy of Chromium in the binary release, and launching it on
 double-click with the --app flag which opens a chromeless browser
 window (i.e just a window border containing an HTML renderer) looking
 just like a local application.

 Another option is XULRunner, which you can use to create an
 application with native menus and widgets around the border, and add a
 browser element to the GUI which points at your Haskell web
 server.  You could probably even generate the XUL layout code in the
 Haskell server if you wanted, which would provide a totally
 native-looking app.  (At least for those who don't consider Firefox
 very awful-looking, I know there are some Cocoa pedants around who
 would complain.. ;)

P.s., it would be wrong not to also mention the latest development in
UHC, which might exactly let you write the JavaScript part of the app
in Haskell:

http://utrechthaskellcompiler.wordpress.com/2010/10/18/haskell-to-javascript-backend/

I haven't tried it, so can't comment on the readiness of this interpreter..

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


Re: [Haskell-cafe] Re: libefence useful for debugging ghc+ffi programs?

2010-10-20 Thread Edward Z. Yang
Hmm, in that case, one possibility is someone else did an FFI import of
gethostbyname and isn't using the same lock.  Can you check for that?

Edward

Excerpts from Johannes Waldmann's message of Wed Oct 20 16:17:06 -0400 2010:
 
   and indeed, gethostbyname is famous for being non re-entrant.
 
 it already has a lock in Network.BSD, so I assume it's fine:
 
 
 {-# NOINLINE lock #-}
 lock :: MVar ()
 lock = unsafePerformIO $ newMVar ()
 
 withLock :: IO a - IO a
 withLock act = withMVar lock (\_ - act)
 
 getHostByName :: HostName - IO HostEntry
 getHostByName name = withLock $ do
   withCString name $ \ name_cstr - do
ent - throwNoSuchThingIfNull getHostByName no such host entry
 $ trySysCall $ c_gethostbyname name_cstr
peek ent
 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is it possible to easily connect Haskell to JavaScript/JavaFX in the browser and use a browser as a Windows GUI? :)

2010-10-20 Thread Anton van Straaten

cas...@istar.ca wrote:
Is it possible to easily connect Haskell to JavaScript/JavaFX in 
the browser and use a browser as a Windows GUI? :)

...
I meant call Haskell functions from a browser; so the browser handles 
the GUI widgets and Haskell handles the processing. :)


It's pretty easy to get the basics going.  There are a bunch of options. 
 Start here:


http://www.haskell.org/haskellwiki/Web

For what you're asking about, I'd suggest looking at the following 
options from that page.  All of these options involve linking a web 
server library into your Haskell app, so it's self-contained and all you 
need is a browser to talk to it:


#6: Snap + custom code: Snap is simple to get started with, and is good 
if you know exactly what HTML/Javascript you need to generate and don't 
mind doing it more or less manually.  If you're looking for richer 
library support for developing HTML UIs, consider the next option.


#2: Snap + Yesod: Yesod will give you many of the framework features you 
might want for developing web UIs.  (Not sure about JavaFX though.)


#1: Happstack: an ambitious web server / framework with some fancy 
features like its own data persistence system.


One other tool worth considering if you're doing a lot of Javascript 
with Haskell is JMacro: http://www.haskell.org/haskellwiki/Jmacro


It lets you embed Javascript code directly in Haskell, and easily embed 
Haskell data into that code.


Anton

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


Re: [Haskell-cafe] Are newtypes optimised and how much?

2010-10-20 Thread Thomas Schilling
Do we really want to treat every newtype wrappers as a form of 'id'?
For example:

newtype Nat = Nat Integer   -- must always be positive

A possible rule (doesn't actually typecheck, but you get the idea):

forall (x :: Nat). sqrt (x * x) = x

If we ignore newtyping we get an incorrect rewrite rule.  It depends
on the exact implementation of which 'id's would be recognised.


On 20 October 2010 21:08, James Andrew Cook mo...@deepbondi.net wrote:
 On Oct 20, 2010, at 11:58 AM, Gregory Crosswhite gcr...@phys.washington.edu 
 wrote:

 On 10/20/10 4:09 AM, Simon Peyton-Jones wrote:
 No, this isn't optimised.  The trouble is that you write (map Foo xs), but 
 GHC doesn't know about 'map'.  We could add a special case for map, but 
 then you'd soon want (mapTree Foo my_tree).

 How about a special case for fmap?  That seems like it should handle a lot 
 of cases.


 Or even better, a special handling of 'id' in rules pragmas that would cause 
 any rule matching id to also match any newtype constructor or projection. Or 
 have the compiler automatically add rules that map all newtype wrappers and 
 unwrappers to unsafeCoerce and make sure that unsafeCoerce has rules for map, 
 fmap, (.), etc.

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




-- 
Push the envelope. Watch it bend.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] JavaScript in a browser as a Windows GUI?

2010-10-20 Thread Andrew Coppin

 On 20/10/2010 09:48 PM, Anton van Straaten wrote:
It's pretty easy to get the basics going.  There are a bunch of 
options.  Start here:


http://www.haskell.org/haskellwiki/Web

For what you're asking about, I'd suggest looking at the following 
options from that page.  All of these options involve linking a web 
server library into your Haskell app, so it's self-contained and all 
you need is a browser to talk to it:


#6: Snap + custom code: Snap is simple to get started with, and is 
good if you know exactly what HTML/Javascript you need to generate and 
don't mind doing it more or less manually.  If you're looking for 
richer library support for developing HTML UIs, consider the next option.


#2: Snap + Yesod: Yesod will give you many of the framework features 
you might want for developing web UIs.  (Not sure about JavaFX though.)


#1: Happstack: an ambitious web server / framework with some fancy 
features like its own data persistence system.


One other tool worth considering if you're doing a lot of Javascript 
with Haskell is JMacro: http://www.haskell.org/haskellwiki/Jmacro


It lets you embed Javascript code directly in Haskell, and easily 
embed Haskell data into that code.


I'd like to have a go at writing CGI in Haskell. However, I don't really 
want to install and configure the likes of Apache just to quickly test a 
simple CGI script. I was hoping that I could find a trivial little HTTP 
server on Hackage somewhere that would be just a simple binary that I 
can execute and feed CGI binaries to. But alas, the closest thing I can 
find is


http://hackage.haskell.org/package/hws

Alas, this does not work on Windows since it depends on the unix 
package. (In fact, almost every network-related package on Hackage 
depends on unix, for reasons beyond my powers of comprehension...)


(I also looked at non-Haskell lightweight web servers, but they all 
unanimously don't support CGI at all, or only support CGI _scripts_, but 
arbitrary executables...)


Does anybody know of a solution that works on Windows?

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


[Haskell-cafe] hs-plugins and memory leaks

2010-10-20 Thread Evan Laforge
I was happy to see the recent announcement about hs-plugins being
updated to work with newer ghc.  I have a project and had always been
planning to use it.

However, there are some questions I've had about it for a long time.
The 'yi' paper mentions both 'yi' and 'lambdabot' as users of
hs-plugins.  However, both those projects have long since abandoned
it.  I can't find any documentation on why, or even any documentation
at all for Yi wrt its dynamic code execution system, but from looking
at the source it looks like it uses hint for dynamic code execution
and dyre for configuration.  Dyre in turn uses serialization to pass
the old state to the reconfigured app.  So we have retreated from the
idea of hotswapping the application state.

It seems to me that the advantages as put forth in the 'yi' paper
still hold.  Changing the configuration in yi is rather heavyweight.
Relinking the entire editor takes a long time, and yi is still a
relatively small program.  Editors can keep most of their state on
disk and can have very simple GUI state, so perhaps the serialization
and deserialization isn't such a problem, but this doesn't hold for
other programs.  It seems to me the loss is significant: there's a big
difference between being able to experiment with a command by editing
and rerunning it immediately, and having to wait 10s or more for the
app to recompile, relink, shut down the ui, serialize all state, and
restart.  And if you add hint, you are linking in large parts of ghc,
with an even slower link time.  So, yi is no longer a dynamically
reconfigurable application, and is now merely a configurable
application.

The apparent loss of such a useful feature (you might even say a
defining feature) would presumably only happen if keeping it was
untenable.  And of course that makes me reluctant to make any kind of
design that relies on it without first knowing why all existing users
jumped ship.

I can think of one possible reason, and that's a memory leak.  In
ghc/rts/Linker.c:unloadObj there's a commented out line '//
stgFree(oc-image);'.  In a test program I wrote that behaves like
'plugs', every executed line increases the size of the program by
12-16k.  I have to remove the resolveObjs call from plugs for it to
work, but once I do it displays the same leak.

So my questions are:

Why did lambdabot and yi abandon plugins?

Is unloadObj a guaranteed memory leak?  As far as I can tell, it's
never called within ghc itself.  If the choices are between a memory
leak no matter how you use it and dangerous but correct if you use it
right, shouldn't we at least have the latter available as an option?
E.g. a reallyUnloadObj function that also frees the image.

If I uncomment that line will it fix the problem?  Is it safe to do so
if I first force all thunks that might contain unloaded code?

Long shot, but are there any more principled ways to guarantee no
pointers to a chunk of code exist?  The only thing I can think of is
to have the state be totally strict and consist only of types from the
static core.  Would it be possible to hand responsibility for the
memory off to the garbage collector?

GHC now supports dynamic libraries.  Given that plugins may need to
link large portions of the static core library, can it be loaded as
a dynamic library so both the core and the plugins can share the same
code?  I haven't been able to find many references to ghc's support
for dynamic linking.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] hs-plugins and memory leaks

2010-10-20 Thread Don Stewart
qdunkan:
 However, there are some questions I've had about it for a long time.
 The 'yi' paper mentions both 'yi' and 'lambdabot' as users of
 hs-plugins.  However, both those projects have long since abandoned
 it.  I can't find any documentation on why, or even any documentation
 at all for Yi wrt its dynamic code execution system, but from looking
 at the source it looks like it uses hint for dynamic code execution
 and dyre for configuration.  Dyre in turn uses serialization to pass
 the old state to the reconfigured app.  So we have retreated from the
 idea of hotswapping the application state.

Once active development of hs-plugins stopped, along with the
portability issues, it behooved projects like e.g. xmonad or yi, to aim
for simpler reconfiguration strategies, other than native code hot
loading.

 I can think of one possible reason, and that's a memory leak.  In
 ghc/rts/Linker.c:unloadObj there's a commented out line '//
 stgFree(oc-image);'.  In a test program I wrote that behaves like
 'plugs', every executed line increases the size of the program by
 12-16k.  I have to remove the resolveObjs call from plugs for it to
 work, but once I do it displays the same leak.
  
 So my questions are:
 
 Why did lambdabot and yi abandon plugins?

Because it was unmaintained for around 5 years, and was fundamentally
less portable than simpler state serialization solutions that offered
some of the same benefits as full code hot swapping.

 Is unloadObj a guaranteed memory leak?  As far as I can tell, it's
 never called within ghc itself.  If the choices are between a memory
 leak no matter how you use it and dangerous but correct if you use it
 right, shouldn't we at least have the latter available as an option?
 E.g. a reallyUnloadObj function that also frees the image.

GHC never unloads object code, so yes, it will leak old code.

 Long shot, but are there any more principled ways to guarantee no
 pointers to a chunk of code exist?  The only thing I can think of is
 to have the state be totally strict and consist only of types from the
 static core.  Would it be possible to hand responsibility for the
 memory off to the garbage collector?

It's really hard.
  
-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] JavaScript in a browser as a Windows GUI?

2010-10-20 Thread Michael Snoyman
You can use Network.Wai.Handler.SimpleServer from wai-extra[1]. If you
want a full framework, Yesod[2] has full Windows support.

Michael

[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/wai-extra
[2] http://docs.yesodweb.com/

On Wed, Oct 20, 2010 at 11:10 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:
  On 20/10/2010 09:48 PM, Anton van Straaten wrote:

 It's pretty easy to get the basics going.  There are a bunch of options.
  Start here:

 http://www.haskell.org/haskellwiki/Web

 For what you're asking about, I'd suggest looking at the following options
 from that page.  All of these options involve linking a web server library
 into your Haskell app, so it's self-contained and all you need is a browser
 to talk to it:

 #6: Snap + custom code: Snap is simple to get started with, and is good if
 you know exactly what HTML/Javascript you need to generate and don't mind
 doing it more or less manually.  If you're looking for richer library
 support for developing HTML UIs, consider the next option.

 #2: Snap + Yesod: Yesod will give you many of the framework features you
 might want for developing web UIs.  (Not sure about JavaFX though.)

 #1: Happstack: an ambitious web server / framework with some fancy
 features like its own data persistence system.

 One other tool worth considering if you're doing a lot of Javascript with
 Haskell is JMacro: http://www.haskell.org/haskellwiki/Jmacro

 It lets you embed Javascript code directly in Haskell, and easily embed
 Haskell data into that code.

 I'd like to have a go at writing CGI in Haskell. However, I don't really
 want to install and configure the likes of Apache just to quickly test a
 simple CGI script. I was hoping that I could find a trivial little HTTP
 server on Hackage somewhere that would be just a simple binary that I can
 execute and feed CGI binaries to. But alas, the closest thing I can find is

 http://hackage.haskell.org/package/hws

 Alas, this does not work on Windows since it depends on the unix package.
 (In fact, almost every network-related package on Hackage depends on unix,
 for reasons beyond my powers of comprehension...)

 (I also looked at non-Haskell lightweight web servers, but they all
 unanimously don't support CGI at all, or only support CGI _scripts_, but
 arbitrary executables...)

 Does anybody know of a solution that works on Windows?

 ___
 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


[Haskell-cafe] Haskell Weekly News: Issue 155 - October 20, 2010

2010-10-20 Thread Daniel Santa Cruz
   Welcome to issue 155 of the HWN, a newsletter covering developments in
   the [1]Haskell community in the week of October 10 - 16.

   This time around we again have 87 posts to HackageDB. Instead of
   posting the individual packages, we get to see and celebrate the 43
   people behind these efforts.

   Want to keep a close eye on the haskellers that lurk twitter? Don
   Steward made [2]a twitter list of tweeting haskellers! Let him know if
   you'd like to be added to the list.

   There were a total of 24 new stories posted to the Haskell Reddit
   channel, 27 new questions taged with Haskell in StackOverflow, and 408
   messages posted to Haskell-Cafe.

   So, what was hot last week?

Announcements

   Gregory Crosswhite is pleased to [3]announce the release of a family of
   packages for type-level natural numbers. He also [4]announced
   tagged-list, a package which provides fixed-length lists that are
   tagged with a phantom type-level natural number corresponding to the
   length.

   Janis Voigtlander [5]announced that it is time to collect contributions
   for the 19th edition of the Haskell Communities  Activities Report.
   The submission deadline is November 1, 2010.

   Alexander Solla [6]announced his new Facts library. The Facts
   hierarchy is meant to contain commonly used, relatively static facts
   about the real world.

   Kevin Jardine [7]announced polyToMonoid: a library that supplies two
   very general polyvariadic functions that can map their arguments into
   any monoid you specify.

   Simon Hengel [8]announced a new version of DocTest. DocTest now uses
   Haddock for parsing of comments.

Interesting Threads on Haskell-Cafe

   Michael Snoyman [9]reported that Haskellers.com has become popular a
   lot falter that he anticipated. Read up on what changes are planned for
   Haskellers.com. Michael is very interested in some help with running
   the site.

   Jacek Generowicz [10]asked how to deal with dynamic dispatch on
   extensible sets of types.

   Uwe Schmidt [11]replied to a question about why HXT uses arrows as
   opposed to using monads. Good comments followed.

   Jason Dusek [12]asked if there is a way to write a Haskell data
   structure that is necessarily only one or two or seventeen items long;
   but that is nonetheless statically guaranteed to be of finite length?
   Twenty-three messages followed.

   Simon Thompson [13]annouced the availability of books for review for
   the Journal of Functonial Programming.

   Andrew Copping [14]summarized a report produced by Google Szwitzerland
   on taking a Python system and rewriting bits of it in Haskell, some of
   which is now in production use.

   Ben Franksen [15]ranted about the current Haskell Blurb on the first
   paragraph of haskell.org. Quite the read to end the week :)

Top Reddit Stories

  * Using Haskell’s ‘newtype’ in C
Domain: blog.nelhage.com
Score: 37, Comments: 5
On Reddit: 
http://www.reddit.com/r/haskell/comments/dptzh/using_haskells_newtype_in_c/
Original: http://blog.nelhage.com/2010/10/using-haskells-newtype-in-c/

  * The Haskell theme: consistent visual branding for Haskell
Domain: haskell.org
Score: 34, Comments: 11
On Reddit: 
http://www.reddit.com/r/haskell/comments/dqiej/the_haskell_theme_consistent_visual_branding_for/
Original: 
http://www.haskell.org/pipermail/haskell-cafe/2010-October/084781.html

  * Haskellers: Survey results and new site features
Domain: haskellers.com
Score: 22, Comments: 6
On Reddit: 
http://www.reddit.com/r/haskell/comments/dr37b/haskellers_survey_results_and_new_site_features/
Original: http://www.haskellers.com/news/1/

  * My Experience Learning Haskell
Domain: blog.virtucal.com
Score: 21, Comments: 6
On Reddit: 
http://www.reddit.com/r/haskell/comments/drgcz/my_experience_learning_haskell/
Original: 
http://blog.virtucal.com/cyclical/2010/10/14/my-experience-learning-haskell.html

  * Invertible monads for exception handling and memory allocations
Domain: docs.yesodweb.com
Score: 21, Comments: 0
On Reddit: 
http://www.reddit.com/r/haskell/comments/drkdj/invertible_monads_for_exception_handling_and/
Original: 
http://docs.yesodweb.com/blog/invertible-monads-exceptions-allocations/

  * Accelerating Haskell Array Codes with Multicore GPUs
Domain: justtesting.org
Score: 19, Comments: 0
On Reddit: 
http://www.reddit.com/r/haskell/comments/dq1yo/accelerating_haskell_array_codes_with_multicore/
Original: 
http://justtesting.org/accelerating-haskell-array-codes-with-multico

  * Unicode text performance improvements
Domain: serpentine.com
Score: 17, Comments: 1
On Reddit: 
http://www.reddit.com/r/haskell/comments/drinz/unicode_text_performance_improvements/
Original: 
http://www.serpentine.com/blog/2010/10/15/unicode-text-performance-improvements/

  * Like a coding challenge? Check out Code Quarterly!
Domain: serpentine.com
Score: 16, 

Re: [Haskell-cafe] hs-plugins and memory leaks

2010-10-20 Thread Evan Laforge
 So my questions are:

 Why did lambdabot and yi abandon plugins?

 Because it was unmaintained for around 5 years, and was fundamentally
 less portable than simpler state serialization solutions that offered
 some of the same benefits as full code hot swapping.

Fair enough.  The idea of being able to make changes and see them
quickly enough for it to have an interactive feel is very appealing,
but maybe there are other ways to get there, such as improving link
time with dynamic linking (my current link time is around 24 seconds).
 State serialization + restart is definitely simpler and more robust.
But if it's impossible to get it fast enough otherwise, and there
aren't any other show stopping problems (I think even a known memory
leak may be dwarfed by the amount of data the app keeps in memory
anyway), then it might be worth it to me to maintain hs-plugins.

 Is unloadObj a guaranteed memory leak?  As far as I can tell, it's
 never called within ghc itself.  If the choices are between a memory
 leak no matter how you use it and dangerous but correct if you use it
 right, shouldn't we at least have the latter available as an option?
 E.g. a reallyUnloadObj function that also frees the image.

 GHC never unloads object code, so yes, it will leak old code.

So would freeing oc-image fix the leak?  In my case, it's not too
hard to force all data structures that might reference it.

 Long shot, but are there any more principled ways to guarantee no
 pointers to a chunk of code exist?  The only thing I can think of is
 to have the state be totally strict and consist only of types from the
 static core.  Would it be possible to hand responsibility for the
 memory off to the garbage collector?

 It's really hard.

It happens in python for python bytecode, since it exists as a plain
data structure in the language.  E.g. 'code = compile('xyz')'.
Couldn't a haskell solution be along the same lines?  'code - load
X.o; makeFunction code', and then makeFunction holds a ForeignPtr to
the actual code and there's some kind of primitive to call a chunk of
code as a function.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: libefence useful for debugging ghc+ffi programs?

2010-10-20 Thread Johannes Waldmann
OK, never mind, I found the problem in my C code.

some uninitialized variables - mostly they were 0, 
but sometimes not: I guess when I got  mallocForeignPtrBytes
that were just freed by the garbage collector.

Although the program does a ton of allocations, 
most start with memcpy of something that the program computed earlier,
expect for a handfull of root nodes.
But these were allocated early, when there was little garbage,
so I got most of them in their zeroed-out initial state,
and that's why the error did not show. (At least that's my guess.)

This restores my faith in ghc, ffi, and library writers -

and shows how much I unlearned C programming
(which I guess is generally a good thing - except when you program C).

J.W.

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


[Haskell-cafe] [ANNAUNCE] ghcjs-0.1.0 Haskell to Javascript compiler

2010-10-20 Thread Victor Nazarov
I've been working on this for some month and I think now I'm ready to
share the results.

http://github.com/sviperll/ghcjs

Haskell to Javascript translator


Project aims to provide solution to

 * compile modern Haskell libraries to Javascript files and use
   them in Ajax applications or
 * develop entire Ajax application in Haskell language

Building


Code builds as standard haskell package

$ runghc Setup configure
$ runghc Setup build
$ runghc Setup install

Usage
-

To compile Haskell module to Javascript use `ghcjs` command.

$ ghcjs Test.hs

This command is merely equivalent to the following

$ ghc --make Test.hs

but it compiles to Javascript instead of native code.

See examples folder for an example of loading and running haskell code
from browser.

Status
--

The code is in alpha stage. Feel free to experiment with it as you wish.

Implementation
--

Compiler is implemented as [GHC](http://www.haskell.org/ghc/) backend
using GHC API. And been tested with GHC 6.12.1.

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


Re: [Haskell-cafe] Are newtypes optimised and how much?

2010-10-20 Thread wren ng thornton

On 10/20/10 7:09 AM, Simon Peyton-Jones wrote:

Yes, you can freely use Foo/unFoo.  There's no runtime penalty.  (In the jargon 
of GHC's intermediate language, Foo and unFoo translate to *type-safe casts*, 
which generate no executable code.


When does the conversion to type-safe casts occur relative to other 
optimizations (namely, rewrite rules)?


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] playing around with network.curl

2010-10-20 Thread Michael Litchard
I'm using this tutorial as a guide
http://flygdynamikern.blogspot.com/2009/03/extended-sessions-with-haskell-curl.html

github has changed since this was posted, but I have managed a
successful login. Now I am faced with dealing with a re-direct.
I found this constructor
CurlFollowLocation Bool 

on this page
http://hackage.haskell.org/packages/archive/curl/1.3.5/doc/html/Network-Curl-Opts.html

It seems to do what I want, But I am not clear on how to use it. Could
someone provide an example?

Thanks. End goal is to snarf the cookie that establishes the session.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Are newtypes optimised and how much?

2010-10-20 Thread Daniel Fischer
On Thursday 21 October 2010 01:11:25, wren ng thornton wrote:
 On 10/20/10 7:07 PM, wren ng thornton wrote:
  On 10/20/10 7:09 AM, Simon Peyton-Jones wrote:
  Yes, you can freely use Foo/unFoo. There's no runtime penalty. (In
  the jargon of GHC's intermediate language, Foo and unFoo translate to
  *type-safe casts*, which generate no executable code.
 
  When does the conversion to type-safe casts occur relative to other
  optimizations (namely, rewrite rules)?

 That is, I know that rewrite rules operate on the source language not on
 Core, but to what extent does that mean that type-safe casts inhibit the
 firing of rules?

Pretty much completely, I'm afraid.
There's a rewrite rule for realToFrac :: Double - Float.
Build yourself a benchmark for that transformation that runs some 
measurable time (say 0.1 seconds or so).
Now use a newtype wrapper around Float instead (and don't add a rewrite 
rule for it). Ouch.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] playing around with network.curl

2010-10-20 Thread Paulo Tanimoto
Hi Michael,

On Wed, Oct 20, 2010 at 6:19 PM, Michael Litchard mich...@schmong.org wrote:
 I'm using this tutorial as a guide
 http://flygdynamikern.blogspot.com/2009/03/extended-sessions-with-haskell-curl.html

 github has changed since this was posted, but I have managed a
 successful login. Now I am faced with dealing with a re-direct.
 I found this constructor
 CurlFollowLocation Bool

 on this page
 http://hackage.haskell.org/packages/archive/curl/1.3.5/doc/html/Network-Curl-Opts.html

 It seems to do what I want, But I am not clear on how to use it. Could
 someone provide an example?

 Thanks. End goal is to snarf the cookie that establishes the session.

I think it is what you're probably expecting.  Just add
CurlFollowLocation True to the list of options.  Those get applied
by setopts in main.

 opts = [ CurlCookieJar cookies, CurlFollowLocation True ]

I've used that before with no problems.  Do you need a complete example?

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


Re: [Haskell-cafe] JavaScript in a browser as a Windows GUI?

2010-10-20 Thread Anton van Straaten

Andrew Coppin wrote:

I'd like to have a go at writing CGI in Haskell.

...

Does anybody know of a solution that works on Windows?


I've previously run Happstack on Windows.  That was a couple of years 
ago, though, so I don't know whether its Windows support is currently 
working.

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


Re: [Haskell-cafe] Re: How to make cabal pass flags to happy?

2010-10-20 Thread Duncan Coutts
On Wed, 2010-10-20 at 10:37 +0200, Niklas Broberg wrote:

  I think the right solution is for the happy source file to specify
  what kind of grammar it is / should be produced. Yes, that would mean
  modifying happy.
 
 Hmm, I agree with you in this particular case, regarding the grammar,
 since it really only makes sense for any given happy grammar to
 generate either kind of parser. But such a solution still wouldn't
 answer the general question about passing flags to preprocessors.
 Certainly not all such use cases are best fixed by pushing the flags
 into the pre-processed files.

I like to see it as an issue of the design of the whole system, not just
adapting cabal to existing half-thought-out tools.

With preprocessor flags the first question is who picks the flags. If it
is the person doing the build then we handle that already. If it is the
package author then it needs more careful analysis. Yes we could go and
add a foo-options for every single pre-processor but that's not
obviously a good idea.

Yes you can have full control by writing code in the Setup.hs (and it
could be easier to do that) but again it's not a very nice solution in
general. I think we have a habit of just adding flags to such tools and
saying let the build system handle it without really thinking
carefully about where the right place to specify things should be.

My view is that for the most part, source modules ought to be
self-descriptive so that they can be built with zero configuration. For
basic Haskell modules we do this already, we have a standard convention
on file extension, file - module name mapping, language pragmas, etc
etc. This is what allows ghci / ghc --make to work in most cases (and in
principle should allow a future cabal to work even without a .cabal file
for many simple projects -- like hmake did for years).

For preprocessors we have some convention, we mostly use file name
extensions. For more detailed variations I think it does make sense to
stick it in the source module. The harder cases are things like
preprocessors which genuinely have multiple modes. I don't mean things
like happy's GLR since as I understand it you really design the grammar
specifically for the approach. There are other tools where from the same
source you can and do generate multiple outputs. There it is harder to
establish a convention that allows for zero-configuration.

Similarly, documentation is a mess because there are few established
conventions, so much more grungy configuration is needed.

Duncan

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


[Haskell-cafe] Re: hs-plugins and memory leaks

2010-10-20 Thread Andy Stewart
Hi Evan,
Evan Laforge qdun...@gmail.com writes:

 So my questions are:

 Why did lambdabot and yi abandon plugins?

 Because it was unmaintained for around 5 years, and was fundamentally
 less portable than simpler state serialization solutions that offered
 some of the same benefits as full code hot swapping.

 Fair enough.  The idea of being able to make changes and see them
 quickly enough for it to have an interactive feel is very appealing,
 but maybe there are other ways to get there, such as improving link
 time with dynamic linking (my current link time is around 24 seconds).
  State serialization + restart is definitely simpler and more robust.
 But if it's impossible to get it fast enough otherwise, and there
 aren't any other show stopping problems (I think even a known memory
 leak may be dwarfed by the amount of data the app keeps in memory
 anyway), then it might be worth it to me to maintain hs-plugins.

I have project design for use dynamic linking, i even build 'pdynload'
(http://hackage.haskell.org/package/pdynload-0.0.3) with Don's PhD
thesis.

Last, i remove pdynload code from my project temporary with below reasons:

1) Hold running state is difficult, like network state in browser or
running state in terminal emulator. 

2) Linking time is too long, I have haskell OS project
(http://www.flickr.com/photos/48809...@n02/) have many sub-module, every
sub-module is very big, and linking time is too long.

3) Memory leak like you said.

 Is unloadObj a guaranteed memory leak?  As far as I can tell, it's
 never called within ghc itself.  If the choices are between a memory
 leak no matter how you use it and dangerous but correct if you use it
 right, shouldn't we at least have the latter available as an option?
 E.g. a reallyUnloadObj function that also frees the image.

 GHC never unloads object code, so yes, it will leak old code.

 So would freeing oc-image fix the leak?  In my case, it's not too
 hard to force all data structures that might reference it.
It's not safe for GHC runtime system since you don't know when time
unload old code is safe.

Don's idea is hold old state in memory even you load new state for
hot-swapping safely.

 Long shot, but are there any more principled ways to guarantee no
 pointers to a chunk of code exist?  The only thing I can think of is
 to have the state be totally strict and consist only of types from the
 static core.  Would it be possible to hand responsibility for the
 memory off to the garbage collector?

 It's really hard.

 It happens in python for python bytecode, since it exists as a plain
 data structure in the language.  E.g. 'code = compile('xyz')'.
 Couldn't a haskell solution be along the same lines?  'code - load
 X.o; makeFunction code', and then makeFunction holds a ForeignPtr to
 the actual code and there's some kind of primitive to call a chunk of
 code as a function.
Anyway, i was re-thinking hot-swap haskell some time, my idea
is : 

 multi-processes framework 
   + hot-swapping core entry 
   + mix old/new sub-module in runtime

Core and sub-module all in separate processes.

With my project (http://www.flickr.com/photos/48809...@n02/), editor and
browser (many other sub-module ...) are sub-module.

Core don't do anything, just control how to load sub-module.

Core have 'entry code', like 'pageBufferNewFun' in
https://patch-tag.com/r/AndyStewart/manatee/snapshot/current/content/pretty/Manatee.hs
'sourceBufferNew', 'browserBufferNew' are 'entry function' to load sub-module 
in *new*
process.

Core process always running, so we just need hot-swapping 'entry code' after we 
update sub-module
library by cabal, then we can use new 'entry code' load sub-module in new 
process, at the same
time, old sub-module code still running in old process.

Welcome to discuss. :)

Cheers,

  -- Andy



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


Re: [Haskell-cafe] playing around with network.curl

2010-10-20 Thread Michael Litchard
I'm afraid I'll need a more complete example. When I try to modify the
code above (after correcting the conditional tests), I get the
following:
* About to connect() to github.com port 443 (#0)
*   Trying 207.97.227.239... * connected
* Connected to github.com (207.97.227.239) port 443 (#0)
* found 142 certificates in /etc/ssl/certs/ca-certificates.crt
*server certificate verification SKIPPED
*common name: *.github.com (matched)
*server certificate expiration date OK
*server certificate activation date OK
*certificate public key: RSA
*certificate version: #3
*subject: O=*.github.com,OU=Domain Control Validated,CN=*.github.com
*start date: Fri, 11 Dec 2009 05:02:36 GMT
*expire date: Thu, 11 Dec 2014 05:02:36 GMT
*issuer: C=US,ST=Arizona,L=Scottsdale,O=GoDaddy.com\,
Inc.,OU=http://certificates.godaddy.com/repository,CN=Go Daddy Secure
Certification Authority,serialNumber=07969287
*compression: NULL
*cipher: AES-128-CBC
*MAC: SHA1
 GET /session HTTP/1.1
Host: github.com
Accept: */*

 HTTP/1.1 302 Found
 Server: nginx/0.7.67
 Date: Thu, 21 Oct 2010 01:20:13 GMT
 Content-Type: text/html; charset=utf-8
 Connection: keep-alive
 Status: 302 Found
 Location: http://github.com/session
 X-Runtime: 0ms
 Content-Length: 91
* Added cookie 
_github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--884981fc5aa85daf318eeff084d98e2cff92578f
for domain github.com, path /, expire 1577865600
 Set-Cookie: 
_github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--884981fc5aa85daf318eeff084d98e2cff92578f;
path=/; expires=Wed, 01 Jan 2020 08:00:00 GMT; HttpOnly
 Cache-Control: no-cache

* Ignoring the response-body
* Connection #0 to host github.com left intact
* Issue another request to this URL: 'http://github.com/session'
* About to connect() to github.com port 80 (#1)
*   Trying 207.97.227.239... * connected
* Connected to github.com (207.97.227.239) port 80 (#1)
 GET /session HTTP/1.1
Host: github.com
Accept: */*
Cookie: 
_github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--884981fc5aa85daf318eeff084d98e2cff92578f

 HTTP/1.1 302 Found
 Server: nginx/0.7.67
 Date: Thu, 21 Oct 2010 01:20:13 GMT
 Content-Type: text/html; charset=utf-8
 Connection: keep-alive
 Status: 302 Found
 Location: http://github.com/login
 X-Runtime: 1ms
 Content-Length: 89
* Replaced cookie
_github_ses=BAh7BzoRbG9jYWxlX2d1ZXNzMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--e10506e0f6935897cafe4f56774e20aa35e579a5
for domain github.com, path /, expire 1577865600
 Set-Cookie: 
_github_ses=BAh7BzoRbG9jYWxlX2d1ZXNzMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--e10506e0f6935897cafe4f56774e20aa35e579a5;
path=/; expires=Wed, 01 Jan 2020 08:00:00 GMT; HttpOnly
 Cache-Control: no-cache

* Ignoring the response-body
* Connection #1 to host github.com left intact
* Issue another request to this URL: 'http://github.com/login'
* Re-using existing connection! (#1) with host github.com
* Connected to github.com (207.97.227.239) port 80 (#1)
 GET /login HTTP/1.1
Host: github.com
Accept: */*
Cookie: 
_github_ses=BAh7BzoRbG9jYWxlX2d1ZXNzMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--e10506e0f6935897cafe4f56774e20aa35e579a5

 HTTP/1.1 302 Found
 Server: nginx/0.7.67
 Date: Thu, 21 Oct 2010 01:20:13 GMT
 Content-Type: text/html; charset=utf-8
 Connection: keep-alive
 Status: 302 Found
 Location: https://github.com/login
 X-Runtime: 0ms
 Content-Length: 90
 Cache-Control: no-cache

* Ignoring the response-body
* Connection #1 to host github.com left intact
* Issue another request to this URL: 'https://github.com/login'
* Re-using existing connection! (#0) with host github.com
* Connected to github.com (207.97.227.239) port 443 (#0)
 GET /login HTTP/1.1
Host: github.com
Accept: */*
Cookie: 
_github_ses=BAh7BzoRbG9jYWxlX2d1ZXNzMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--e10506e0f6935897cafe4f56774e20aa35e579a5

 HTTP/1.1 200 OK
 Server: nginx/0.7.67
 Date: Thu, 21 Oct 2010 01:20:13 GMT
 Content-Type: text/html; charset=utf-8
 Connection: keep-alive
 Status: 200 OK
 ETag: 00d0a01a93453f641cecb212b6487496
 X-Runtime: 10ms
 Content-Length: 15622
* Added cookie csrf_id=f3ff252d5245dc4da10f0c75badbd10c for domain
github.com, path /, expire 0
 Set-Cookie: csrf_id=f3ff252d5245dc4da10f0c75badbd10c; path=/
 Cache-Control: private, max-age=0, must-revalidate

* Connection #0 to host github.com left intact
*** Exception: Failed to log in: CurlOK -- HTTP/1.1 302 Found
*Main * Closing connection #1
* Closing connection #0


Here's what the code looks like. Notice there's a condition test for a
Status of 302, but that test fails where it should have succeeded.
Removing the CurlFollowLOcation 

Re: [Haskell-cafe] Re: hs-plugins and memory leaks

2010-10-20 Thread Evan Laforge
 Last, i remove pdynload code from my project temporary with below reasons:

 1) Hold running state is difficult, like network state in browser or
 running state in terminal emulator.

This doesn't seem too hard to me.  Provided you are not swapping the
module that defines the state in the first place, simply reload the
module, and replace the old symbol in the state with the reloaded one.

 2) Linking time is too long, I have haskell OS project
 (http://www.flickr.com/photos/48809...@n02/) have many sub-module, every
 sub-module is very big, and linking time is too long.

This is discouraging, since one of the main reasons to use dynamically
loaded code instead of recompiling the whole app is to avoid long link
times.  Presumably you would compile the majority of the app (the API
that the plugins use, and the internal code also uses) as a dynamic
library:

main.o - tiny stub that just calls app.so
app.so - large library containing all app logic
plugin.so - links against app.so when loaded

So the plugin needs to read a lot of hi files when recompiling, but
the dynamic link time should be proportional to the number of
unresolved symbols in plugin.so that point into app.so, not
proportional to the overall size of the app, right?

 So would freeing oc-image fix the leak?  In my case, it's not too
 hard to force all data structures that might reference it.
 It's not safe for GHC runtime system since you don't know when time
 unload old code is safe.

But that's just my question, I *do* (think I) know when it's safe,
which is after the data that has passed through plugged-in code has
been fully forced.  Can't I just call unloadObj then?

E.g., loading and unloading plugins for audio processing is totally
standard.  Since the data is strict arrays of primitive types, there's
no risk of stray pointers to unloaded code.

 Anyway, i was re-thinking hot-swap haskell some time, my idea
 is :

     multi-processes framework
   + hot-swapping core entry
   + mix old/new sub-module in runtime

 Core and sub-module all in separate processes.

How would you pass state between processes?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [ANNAUNCE] ghcjs-0.1.0 Haskell to Javascript compiler

2010-10-20 Thread Richard O'Keefe

On 21/10/2010, at 12:01 PM, Victor Nazarov wrote:

 I've been working on this for some month and I think now I'm ready to
 share the results.

Given that this is alpha code, what's the performance like?


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


Re: [Haskell-cafe] Are newtypes optimised and how much?

2010-10-20 Thread James Andrew Cook

On Oct 20, 2010, at 5:06 PM, Thomas Schilling nomin...@googlemail.com wrote:

 Do we really want to treat every newtype wrappers as a form of 'id'?
 For example:
 
newtype Nat = Nat Integer   -- must always be positive
 
 A possible rule (doesn't actually typecheck, but you get the idea):
 
forall (x :: Nat). sqrt (x * x) = x
 
 If we ignore newtyping we get an incorrect rewrite rule.  It depends
 on the exact implementation of which 'id's would be recognised.
 

That wouldn't be generalized to id, the special treatment would only apply to 
rule that _mention_ Prelude.id explicitly.  Such rules would implicitly fire 
when, say, fmap Nat xs occurs because Nat would be considered a 
specialization of id in the (pattern side of) rule fmap id = id.  Rules 
mentioning Nat would not be magical in any way.

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


Re: [Haskell-cafe] Re: hs-plugins and memory leaks

2010-10-20 Thread Andy Stewart
Evan Laforge qdun...@gmail.com writes:

 Last, i remove pdynload code from my project temporary with below reasons:

 1) Hold running state is difficult, like network state in browser or
 running state in terminal emulator.

 This doesn't seem too hard to me.  Provided you are not swapping the
 module that defines the state in the first place, simply reload the
 module, and replace the old symbol in the state with the reloaded one.

 2) Linking time is too long, I have haskell OS project
 (http://www.flickr.com/photos/48809...@n02/) have many sub-module, every
 sub-module is very big, and linking time is too long.

 This is discouraging, since one of the main reasons to use dynamically
 loaded code instead of recompiling the whole app is to avoid long link
 times.  Presumably you would compile the majority of the app (the API
 that the plugins use, and the internal code also uses) as a dynamic
 library:

 main.o - tiny stub that just calls app.so
 app.so - large library containing all app logic
 plugin.so - links against app.so when loaded

 So the plugin needs to read a lot of hi files when recompiling, but
 the dynamic link time should be proportional to the number of
 unresolved symbols in plugin.so that point into app.so, not
 proportional to the overall size of the app, right?
Yes, not proportional the size of application, 
but link time depend on the dependent packages that haven't linked.

Example like the GHC API in  'pdynload' package, it will search symbol define 
in GHC
database to get which packageId that need re-link, then use below code
link:

   Linker.linkPackages flags [packageId]
   
Function 'linkPackages' will link specified package and it's dependent
packages, if dependents packages is bigger, link time is longer.

So the long link time is unavoidable for *big* package.


 So would freeing oc-image fix the leak?  In my case, it's not too
 hard to force all data structures that might reference it.
 It's not safe for GHC runtime system since you don't know when time
 unload old code is safe.

 But that's just my question, I *do* (think I) know when it's safe,
 which is after the data that has passed through plugged-in code has
 been fully forced.  Can't I just call unloadObj then?
Yes, unloadObj can work if you careful design, well it's also easy to crash
your program if something miss.


 E.g., loading and unloading plugins for audio processing is totally
 standard.  Since the data is strict arrays of primitive types, there's
 no risk of stray pointers to unloaded code.

 Anyway, i was re-thinking hot-swap haskell some time, my idea
 is :

     multi-processes framework
   + hot-swapping core entry
   + mix old/new sub-module in runtime

 Core and sub-module all in separate processes.

 How would you pass state between processes?
Infact, i won't pass any state between processes.

My framework like this: 
http://www.flickr.com/photos/48809...@n02/5031811365/lightbox/

Every sub-module running in render process, and render process for
daemon process just a *Tab*. 

When you need update current sub-module, just recompile new code in
Cabal/GHC database, then startup *new* process to load new code, and we
can use dyre technology to restore state in new process.

Though it's not powerful as hs-plugins do, but perfect safety and no
*memory leak*.

  -- Andy


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


Re: [Haskell-cafe] playing around with network.curl

2010-10-20 Thread Paulo Tanimoto
On Wed, Oct 20, 2010 at 8:31 PM, Michael Litchard mich...@schmong.org wrote:
 I'm afraid I'll need a more complete example. When I try to modify the
 code above (after correcting the conditional tests), I get the
 following:
 * About to connect() to github.com port 443 (#0)
 *   Trying 207.97.227.239... * connected
 * Connected to github.com (207.97.227.239) port 443 (#0)
 * found 142 certificates in /etc/ssl/certs/ca-certificates.crt
 *        server certificate verification SKIPPED
 *        common name: *.github.com (matched)
 *        server certificate expiration date OK
 *        server certificate activation date OK
 *        certificate public key: RSA
 *        certificate version: #3
 *        subject: O=*.github.com,OU=Domain Control Validated,CN=*.github.com
 *        start date: Fri, 11 Dec 2009 05:02:36 GMT
 *        expire date: Thu, 11 Dec 2014 05:02:36 GMT
 *        issuer: C=US,ST=Arizona,L=Scottsdale,O=GoDaddy.com\,
 Inc.,OU=http://certificates.godaddy.com/repository,CN=Go Daddy Secure
 Certification Authority,serialNumber=07969287
 *        compression: NULL
 *        cipher: AES-128-CBC
 *        MAC: SHA1
 GET /session HTTP/1.1
 Host: github.com
 Accept: */*

  HTTP/1.1 302 Found
  Server: nginx/0.7.67
  Date: Thu, 21 Oct 2010 01:20:13 GMT
  Content-Type: text/html; charset=utf-8
  Connection: keep-alive
  Status: 302 Found
  Location: http://github.com/session
  X-Runtime: 0ms
  Content-Length: 91
 * Added cookie 
 _github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--884981fc5aa85daf318eeff084d98e2cff92578f
 for domain github.com, path /, expire 1577865600
  Set-Cookie: 
 _github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--884981fc5aa85daf318eeff084d98e2cff92578f;
 path=/; expires=Wed, 01 Jan 2020 08:00:00 GMT; HttpOnly
  Cache-Control: no-cache
 
 * Ignoring the response-body
 * Connection #0 to host github.com left intact
 * Issue another request to this URL: 'http://github.com/session'
 * About to connect() to github.com port 80 (#1)
 *   Trying 207.97.227.239... * connected
 * Connected to github.com (207.97.227.239) port 80 (#1)
 GET /session HTTP/1.1
 Host: github.com
 Accept: */*
 Cookie: 
 _github_ses=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--884981fc5aa85daf318eeff084d98e2cff92578f

  HTTP/1.1 302 Found
  Server: nginx/0.7.67
  Date: Thu, 21 Oct 2010 01:20:13 GMT
  Content-Type: text/html; charset=utf-8
  Connection: keep-alive
  Status: 302 Found
  Location: http://github.com/login
  X-Runtime: 1ms
  Content-Length: 89
 * Replaced cookie
 _github_ses=BAh7BzoRbG9jYWxlX2d1ZXNzMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--e10506e0f6935897cafe4f56774e20aa35e579a5
 for domain github.com, path /, expire 1577865600
  Set-Cookie: 
 _github_ses=BAh7BzoRbG9jYWxlX2d1ZXNzMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--e10506e0f6935897cafe4f56774e20aa35e579a5;
 path=/; expires=Wed, 01 Jan 2020 08:00:00 GMT; HttpOnly
  Cache-Control: no-cache
 
 * Ignoring the response-body
 * Connection #1 to host github.com left intact
 * Issue another request to this URL: 'http://github.com/login'
 * Re-using existing connection! (#1) with host github.com
 * Connected to github.com (207.97.227.239) port 80 (#1)
 GET /login HTTP/1.1
 Host: github.com
 Accept: */*
 Cookie: 
 _github_ses=BAh7BzoRbG9jYWxlX2d1ZXNzMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--e10506e0f6935897cafe4f56774e20aa35e579a5

  HTTP/1.1 302 Found
  Server: nginx/0.7.67
  Date: Thu, 21 Oct 2010 01:20:13 GMT
  Content-Type: text/html; charset=utf-8
  Connection: keep-alive
  Status: 302 Found
  Location: https://github.com/login
  X-Runtime: 0ms
  Content-Length: 90
  Cache-Control: no-cache
 
 * Ignoring the response-body
 * Connection #1 to host github.com left intact
 * Issue another request to this URL: 'https://github.com/login'
 * Re-using existing connection! (#0) with host github.com
 * Connected to github.com (207.97.227.239) port 443 (#0)
 GET /login HTTP/1.1
 Host: github.com
 Accept: */*
 Cookie: 
 _github_ses=BAh7BzoRbG9jYWxlX2d1ZXNzMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--e10506e0f6935897cafe4f56774e20aa35e579a5

  HTTP/1.1 200 OK
  Server: nginx/0.7.67
  Date: Thu, 21 Oct 2010 01:20:13 GMT
  Content-Type: text/html; charset=utf-8
  Connection: keep-alive
  Status: 200 OK
  ETag: 00d0a01a93453f641cecb212b6487496
  X-Runtime: 10ms
  Content-Length: 15622
 * Added cookie csrf_id=f3ff252d5245dc4da10f0c75badbd10c for domain
 github.com, path /, expire 0
  Set-Cookie: csrf_id=f3ff252d5245dc4da10f0c75badbd10c; path=/
  Cache-Control: private, max-age=0, must-revalidate
 
 * Connection #0 to host github.com left intact
 *** Exception: Failed to log in: CurlOK -- HTTP/1.1 302 Found
 *Main * Closing connection #1
 * Closing 

Re: [Haskell-cafe] JavaScript in a browser as a Windows GUI?

2010-10-20 Thread Jeremy Shaw


On Oct 20, 2010, at 7:28 PM, Anton van Straaten wrote:


Andrew Coppin wrote:

I'd like to have a go at writing CGI in Haskell.

...

Does anybody know of a solution that works on Windows?


I've previously run Happstack on Windows.  That was a couple of  
years ago, though, so I don't know whether its Windows support is  
currently working.


It should work. Windows is an officially supported happstack platform.  
All releases are tested to ensure they work under Windows.


- jeremy

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


[Haskell-cafe] data.time.zoneinfo

2010-10-20 Thread Anatoly Yakovenko
I am trying to figure out how to use this library, seems like this should work


Prelude Data.Time.ZoneInfo ctx - newContext Nothing
Prelude Data.Time.ZoneInfo name - zoneInfoName (utcOlsonZone ctx) True
Prelude Data.Time.ZoneInfo newOlsonZone ctx name
*** Exception: Data.Time.ZoneInfo.newOlsonZone: invalid argument
(Invalid argument)


but it doesn't, neither does


Prelude Data.Time.ZoneInfo newOlsonZone ctx America/New_York
*** Exception: Data.Time.ZoneInfo.newOlsonZone: invalid argument
(Invalid argument)


and my zoneinfo seems to be kosher on my machine


$ ls /usr/share/zoneinfo/America/New_York
/usr/share/zoneinfo/America/New_York


$ ls /usr/share/zoneinfo/GMT
/usr/share/zoneinfo/GMT


what am i missing?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: data.time.zoneinfo

2010-10-20 Thread Anatoly Yakovenko
passing a full path seems to work, despite the fact that the documentation says

newContext :: Maybe String - IO ContextSource

Create a Context object. A path to the zone-info database may be
specified. Otherwise, the TZDIR environment variable, or a reasonable
default, will be used. An IOError will be thrown on failure.



On Wed, Oct 20, 2010 at 10:40 PM, Anatoly Yakovenko
aeyakove...@gmail.com wrote:
 I am trying to figure out how to use this library, seems like this should work


 Prelude Data.Time.ZoneInfo ctx - newContext Nothing
 Prelude Data.Time.ZoneInfo name - zoneInfoName (utcOlsonZone ctx) True
 Prelude Data.Time.ZoneInfo newOlsonZone ctx name
 *** Exception: Data.Time.ZoneInfo.newOlsonZone: invalid argument
 (Invalid argument)


 but it doesn't, neither does


 Prelude Data.Time.ZoneInfo newOlsonZone ctx America/New_York
 *** Exception: Data.Time.ZoneInfo.newOlsonZone: invalid argument
 (Invalid argument)


 and my zoneinfo seems to be kosher on my machine


 $ ls /usr/share/zoneinfo/America/New_York
 /usr/share/zoneinfo/America/New_York


 $ ls /usr/share/zoneinfo/GMT
 /usr/share/zoneinfo/GMT


 what am i missing?

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