Re: [Haskell-cafe] ghc 7.2.1 Generics problem

2011-11-01 Thread Andres Löh
Hi.

  I do not know why, my ghc 7.2.1 does not seem to support
 DeriveRepresentable. I compiled the ghc 7.2.1 myself by ghc 7.0.4. All
 options default.

 $ ghc Types/TopTalkerRecord.hs

 Types/TopTalkerRecord.hs:2:14:
    Unsupported extension: DeriveRepresentable

There's no extension of that name in 7.2.1. Do you mean DeriveGeneric?

Cheers,
  Andres

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


Re: [Haskell-cafe] ghc 7.2.1 Generics problem

2011-11-01 Thread Ivan Lazar Miljenovic
On 1 November 2011 16:07, Magicloud Magiclouds
magicloud.magiclo...@gmail.com wrote:
 Hi,
  I do not know why, my ghc 7.2.1 does not seem to support
 DeriveRepresentable. I compiled the ghc 7.2.1 myself by ghc 7.0.4. All
 options default.

 $ ghc Types/TopTalkerRecord.hs

 Types/TopTalkerRecord.hs:2:14:
    Unsupported extension: DeriveRepresentable

 $ ghc --version
 The Glorious Glasgow Haskell Compilation System, version 7.2.1

All I can find about DeriveRepresentable is a patch submitted in April
[1].  However, it seems [2] that it has been renamed to DeriveGenerics

[1]: http://www.haskell.org/pipermail/cvs-ghc/2011-April/061666.html
[2]: 
http://code.galois.com/cgi-bin/gitweb?p=type-naturals/base.git;a=commitdiff;h=792a8b86185d4cc74bb3d0d31b481ff0de4cf0d6


-- 
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] blog software in Haskell?

2011-11-01 Thread Jason Dagit
On Mon, Oct 31, 2011 at 2:14 AM, Ketil Malde ke...@malde.org wrote:

 Hi,

 I just upgraded my server, and set up everything again.  Except
 wordpress, as 1) I'm not too fond of its user interface, and 2) it's a
 big pile of PHP, difficult to keep updated, and basically a disaster
 waiting to happen (and in fact, it was hacked at one point).

 Before I enable it again, is there any alternatives I should consider?
 Preferably written in Haskell, of course, but other suggestions welcome
 as well.

Not in Haskell, but it looks really promising (and it's driven by
version control), I give you Octopress:
http://octopress.org/

It's basically jekyll + github.  Who knows, maybe you can use Hakyll
instead of jekyll.

Since you didn't ask for it, I'll include my $0.02 :)

I don't worry about my blog being written in Haskell because I don't
actually want to spend any time shaving yaks related to running my
blog.  I use blogspot.  It's not great but I pay $0/year and someone
else deals with the issues of keeping it secure, keeping it backed up,
etc.

If you find a cool solution, let us know.

Jason

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


Re: [Haskell-cafe] Amazon AWS storage best to use with Haskell?

2011-11-01 Thread dokondr
On Tue, Nov 1, 2011 at 5:03 AM, Ryan Newton rrnew...@gmail.com wrote:

  Any example code of using hscassandra package would really help!


 I'll ask my student.  We may have some simple examples.

 Also, I have no idea as to their quality but I was pleasantly surprised to
 find three different amazon related packages on Hackage (simply by
 searching for the word Amazon in the package list).

http://hackage.haskell.org/package/hS3
http://hackage.haskell.org/package/hSimpleDB
http://hackage.haskell.org/package/aws

 It would be great to know if these work.


Thinking about how to implement Data.Map on top of hscassandra or any other
key-value storage ...
For example creating new map with fromList will require to store *all*
(key, value) list elements in external storage at once. How to deal with
laziness in this case?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Amazon AWS storage best to use with Haskell?

2011-11-01 Thread Neil Davies
We use all three (in various ways as they have arrived on the scene over time) 
in production systems.


On 1 Nov 2011, at 02:03, Ryan Newton wrote:

  Any example code of using hscassandra package would really help!
 
 I'll ask my student.  We may have some simple examples.
 
 Also, I have no idea as to their quality but I was pleasantly surprised to 
 find three different amazon related packages on Hackage (simply by searching 
 for the word Amazon in the package list).  
 
http://hackage.haskell.org/package/hS3
http://hackage.haskell.org/package/hSimpleDB
http://hackage.haskell.org/package/aws
 
 It would be great to know if these work.
 
  -Ryan

 ___
 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] Amazon AWS storage best to use with Haskell?

2011-11-01 Thread Neil Davies
Word of caution

Understand the semantics (and cost profile) of the AWS services first - you 
can't just open a HTTP connection and dribble data out over several days and 
hope for things to work. It is not a system that has that sort of laziness at 
its heart.

AWS doesn't supply a traditional remote file store semantics - is queuing, 
simple database and object store have all been designed for large scale systems 
being offered as a service to a (potentially hostile) large set of users - you 
can see that in the way that things are designed. There are all sorts of 
(sensible from their point of view) performance related limits and retries.

The challenge in designing nice clean layers on top of AWS is how/when to hide 
the transient/load related failures.



Neil


On 1 Nov 2011, at 06:21, dokondr wrote:

 On Tue, Nov 1, 2011 at 5:03 AM, Ryan Newton rrnew...@gmail.com wrote:
  Any example code of using hscassandra package would really help!
 
 I'll ask my student.  We may have some simple examples.
 
 Also, I have no idea as to their quality but I was pleasantly surprised to 
 find three different amazon related packages on Hackage (simply by searching 
 for the word Amazon in the package list).  
 
http://hackage.haskell.org/package/hS3
http://hackage.haskell.org/package/hSimpleDB
http://hackage.haskell.org/package/aws
 
 It would be great to know if these work.
 
  
 Thinking about how to implement Data.Map on top of hscassandra or any other 
 key-value storage ...
 For example creating new map with fromList will require to store *all* 
 (key, value) list elements in external storage at once. How to deal with 
 laziness in this case?
 
 ___
 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] Organizing big repository

2011-11-01 Thread Alexander Bernauer
Hi

On Thu, Oct 27, 2011 at 08:02:58PM +0300, Konstantin Litvinenko wrote:
 Having program 'foo' depends on lib 'bar' I want to edit some files
 in 'bar' than build 'foo' and get 'bar' rebuilt and 'foo'
 rebuilt/relink.
 How can I do this?

I use cabal-dev [1] along with the react tool [2]. The former does the
dependencies-configure-build-install and the latter is a command-line
wrapper around inotify.

With this combo you can rebuild your project whenever any Haskell source
file changes:

react -p *.hs src/ cabal-dev install

For my workflow, I have an additional wrapper script for cabal-dev that
generates a quickfix file for Vim [3]. Then the workflow goes like:
safe file - wait for build to complete (OSD/libnotify) - press F5 to
jump to the location of the first compiler error or warning.

Together with NERDTree [4] this is almost like an IDE ;-)

Greetings

Alex

[1] https://github.com/creswick/cabal-dev
[2] https://github.com/copton/react
[3] http://vimdoc.sourceforge.net/htmldoc/quickfix.html
[4] http://www.vim.org/scripts/script.php?script_id=1658


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


[Haskell-cafe] LDTA 2012: Call for Papers

2011-11-01 Thread Anya Helene Bagge

  LDTA 2012 Call for Papers

12th International Workshop on
Language Descriptions, Tools, and Applications

 www.ldta.info

Tallinn, Estonia
March 31  April 1, 2012
   an ETAPS workshop

LDTA is an application and tool-oriented workshop focused on
grammarware - software based on grammars in some form. Grammarware
applications are typically language processing applications and
traditional examples include parsers, program analyzers, optimizers
and translators. A primary focus of LDTA is grammarware that is
generated from high-level grammar-centric specifications and thus
submissions on parser generation, attribute grammar systems,
term/graph rewriting systems, and other grammar-related
meta-programming tools, techniques, and formalisms are encouraged.

LDTA is also a forum in which theory is put to the test, in many cases
on real-world software engineering challenges. Thus, LDTA also
solicits papers on the application of grammarware to areas including,
but not limited to, the following:
- program analysis, transformation, generation, and verification,
- implementation of Domain-Specific Languages,
- reverse engineering and re-engineering,
- refactoring and other source-to-source transformations,
- language definition and language prototyping, and
- debugging, profiling, IDE support, and testing.

Note that LDTA is a well-established workshop similar to other
conferences on (programming) language engineering topics such as SLE
and GPCE, but is solely focused on grammarware.

Paper Submission

LDTA solicits papers in the following categories.

- research papers: original research results within the scope of LDTA
  with a clear motivation, description, analysis, and evaluation.

- short research papers: new innovative ideas that have not been
  completely fleshed out.  As a workshop, LDTA strongly encourages
  these types of submissions.

- experience report papers: description of the use of a grammarware
  tool or technique to solve a non-trivial applied problem with an
  emphasis on the advantages and disadvantages of the chosen approach
  to the problem.

- tool demo papers: discussion of a tool or technique that explains
  the contributions of the tool and what specifically will be
  demonstrated.

Each submission must clearly state in which of these categories it
falls, and must not be published or submitted elsewhere.  Papers are to use
the standard LaTeX article style and the authblk style for
affiliations; a sample of which is provided at www.ldta.info.
Research and experience papers are limited to 15 pages, tool
demonstration papers are limited to 10 pages, and short papers are
limited to 6 pages.  The final version of the accepted papers will,
pending approval, be published in the ACM Digital Library and will
also be made available during the workshop.

Please submit your abstract and paper using EasyChair at
http://www.easychair.org/conferences/?conf=ldta2012.

The authors of each submission are required to give a presentation at
LDTA 2011 and tool demonstration paper presentations are intended to
include a significant live, interactive demonstration.

The authors of the best papers will be invited to write a journal
version of their paper which will be separately reviewed and, assuming
acceptance, be published in journal form.  As in past years this will
be done in a special issue of the journal Science of Computer
Programming (Elsevier Science).

Invited Speaker
---
To be announced

Important Dates
---
Abstract submission: Nov. 28, 2011
Full paper submission: Dec. 5, 2011
Author notification: Jan. 20, 2012
Camera-ready papers: Feb. 05, 2012
LDTA Workshop: Mar. 31 - Apr. 1, 2012

LDTA Tool Challenge
---
The 2011 Workshop pioneered the LDTA Tool Challenge where tool
developers were invited to develop solutions to a range of language
processing tasks over a simple but evolving set of imperative
programming languages. We expect a challenge to form part of LDTA
every two years. The 2012 workshop will feature presentations devoted
to a de-brief of the 2011 challenge, based on the paper currently
being prepared by challenge participants.

Program Committee
-
Suzana Andova, Eindhoven University of Technology, The Netherlands 
(co-chair)

Anya Helene Bagge, University of Bergen, Norway
Kyung-Goo Doh, Hanyang University, Ansan, South Korea
Jeff Gray, University of Alabama, USA
Görel Hedin, Lund Institute of Technology, Sweden
Zoltán Horváth, Eötvös Loránd University, Budapest, Hungary
Zhenjiang Hu, National Institute of Informatics, Japan
Roberto Ierusalimschy, Pontifícia Universidade Católica do Rio de 
Janeiro, Brazil

Ivan Kurtev, University of Twente, The Netherlands
Marjan Mernik, University of Maribor, Slovenia
Nate Nystrom, University of Lugano, Switzerland
João Saraiva, 

Re: [Haskell-cafe] Amazon AWS storage best to use with Haskell?

2011-11-01 Thread dokondr
On Tue, Nov 1, 2011 at 10:53 AM, Neil Davies
semanticphilosop...@gmail.comwrote:

 Word of caution

 Understand the semantics (and cost profile) of the AWS services first -
 you can't just open a HTTP connection and dribble data out over several
 days and hope for things to work. It is not a system that has that sort of
 laziness at its heart.

 AWS doesn't supply a traditional remote file store semantics - is queuing,
 simple database and object store have all been designed for large scale
 systems being offered as a service to a (potentially hostile) large set of
 users - you can see that in the way that things are designed. There are all
 sorts of (sensible from their point of view) performance related limits and
 retries.

 The challenge in designing nice clean layers on top of AWS is how/when to
 hide the transient/load related failures.



As a straw-man approach I would go first to NData.Map backed by Data.Map
with addition of flush function  to write Data.Map to external key-value
store / NoSQL DB.
Another requirement for NData.Map is concurrent consistency, so different
clients could modify its state preserving happen-before relationship. For
this I would add to NData.Map a reftresh function, that updates local
copy from  external key-value store.

As for hSimpleDB package, it looks like it doesn't build on ghc7:
http://hackage.haskell.org/package/hSimpleDB


 The hSimpleDB package

 Interface to Amazon's SimpleDB service.
 PropertiesVersions0.1 http://hackage.haskell.org/package/hSimpleDB-0.1,
 0.2 http://hackage.haskell.org/package/hSimpleDB-0.2, *0.3*Dependencies
 base http://hackage.haskell.org/package/base-3.0.3.2 (≥3  ≤4),
 bytestring http://hackage.haskell.org/package/bytestring-0.9.2.0, 
 Cryptohttp://hackage.haskell.org/package/Crypto-4.2.4,
 dataenc http://hackage.haskell.org/package/dataenc-0.14.0.2, 
 HTTPhttp://hackage.haskell.org/package/HTTP-4000.1.2,
 hxt http://hackage.haskell.org/package/hxt-9.1.4, 
 networkhttp://hackage.haskell.org/package/network-2.3.0.7,
 old-locale http://hackage.haskell.org/package/old-locale-1.0.0.3,
 old-time http://hackage.haskell.org/package/old-time-1.0.0.7,
 utf8-string http://hackage.haskell.org/package/utf8-string-0.3.7License
 BSD3AuthorDavid Himmelstrup 2009, Greg Heartsfield 2007MaintainerDavid
 Himmelstrup 
 lem...@gmail.comCategoryDatabasehttp://hackage.haskell.org/packages/archive/pkg-list.html#cat:database,
 Web http://hackage.haskell.org/packages/archive/pkg-list.html#cat:web,
 Networkhttp://hackage.haskell.org/packages/archive/pkg-list.html#cat:networkUpload
 dateThu Sep 17 17:09:26 UTC 2009Uploaded byDavidHimmelstrupBuilt onghc-6.10,
 ghc-6.12Build failureghc-7.0 
 (loghttp://hackage.haskell.org/packages/archive/hSimpleDB/0.3/logs/failure/ghc-7.0
 )

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Ketil Malde
Yitzchak Gale g...@sefer.org writes:

 Gregory Crosswhite wrote:
 could [Hackage] have a feature where when a
 working package breaks with a new version of
 GHC the author is automatically e-mailed?

 This would be nice. However, there would have to be
 a way for it to be turned on and off by the author.
 (Spam is not nice.)

This is where it stranded the last time, IIRC.  That sentiment makes me
a bit uneasy; so you are the official maintainer of a package on
Hackage, but you do not want to hear about it when it fails to compile?

To me, this raises the question whether you should take on the
responsibility as maintainer at all.  Ideally, I think Hackage
should avoid being a dumping ground for non-working code, and I think
the key to high quality software is having active maintainers for each
package.  If the author of a package is unwilling to accept failure
reports, I suggest she could leave the Maintainer field blank, or fill
it with a dummy value (e.g. unmaintained).

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants

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


Re: [Haskell-cafe] ghc 7.2.1 Generics problem

2011-11-01 Thread Magicloud Magiclouds
On Tue, Nov 1, 2011 at 1:59 PM, Andres Löh andres.l...@googlemail.com wrote:
 Hi.

  I do not know why, my ghc 7.2.1 does not seem to support
 DeriveRepresentable. I compiled the ghc 7.2.1 myself by ghc 7.0.4. All
 options default.

 $ ghc Types/TopTalkerRecord.hs

 Types/TopTalkerRecord.hs:2:14:
    Unsupported extension: DeriveRepresentable

 There's no extension of that name in 7.2.1. Do you mean DeriveGeneric?

 Cheers,
  Andres


I do not know. I will try that.
I got the name from http://www.haskell.org/haskellwiki/Generics.

-- 
竹密岂妨流水过
山高哪阻野云飞

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


Re: [Haskell-cafe] ghc 7.2.1 Generics problem

2011-11-01 Thread José Pedro Magalhães
Oh, right, I see that some things on that page need updating; I'll do so.


Thanks,
Pedro

On Tue, Nov 1, 2011 at 09:33, Magicloud Magiclouds 
magicloud.magiclo...@gmail.com wrote:

 On Tue, Nov 1, 2011 at 1:59 PM, Andres Löh andres.l...@googlemail.com
 wrote:
  Hi.
 
   I do not know why, my ghc 7.2.1 does not seem to support
  DeriveRepresentable. I compiled the ghc 7.2.1 myself by ghc 7.0.4. All
  options default.
 
  $ ghc Types/TopTalkerRecord.hs
 
  Types/TopTalkerRecord.hs:2:14:
 Unsupported extension: DeriveRepresentable
 
  There's no extension of that name in 7.2.1. Do you mean DeriveGeneric?
 
  Cheers,
   Andres
 

 I do not know. I will try that.
 I got the name from http://www.haskell.org/haskellwiki/Generics.

 --
 竹密岂妨流水过
 山高哪阻野云飞

 ___
 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] Problem with TemplateHaskell

2011-11-01 Thread Magicloud Magiclouds
Hi,
  I have code as following, to make a toDocument function (using
Data.Bsin.=:) for a data structure.

bson :: DecsQ - DecsQ
bson decsq = do
  decs - decsq
  let datad = head decs
  DataD _ _ _ cons _ = datad
  to = mkName toDocument
  from = mkName fromDocument
  fund - mapM (\con -
 case con of
   RecC n types - do
 let nvs = map (\(nv, _, _) -
 nv
   ) types
 funD to [clause [conP n $ map varP nvs]
  (normalB $ listE $ map (\nv -
   infixE (Just $
litE $ stringL $ show nv)
  (varE $
mkName =:)
  $ Just $
appE (varE $ mkName val)

 $ varE nv
 ) nvs) []]
   ) cons
  return (datad : fund)

  Testing code is as:

data T = T { a :: Int
   , b :: Char }

*TH runQ (bson [d|data T = T {a :: Int, b :: Char}|])

[DataD [] T_0 [] [RecC T_1 [(a_2,NotStrict,ConT
GHC.Types.Int),(b_3,NotStrict,ConT GHC.Types.Char)]] [],FunD
toDocument [Clause [ConP T_1 [VarP a_2,VarP b_3]] (NormalB (ListE
[InfixE (Just (LitE (StringL a_2))) (VarE =:) (Just (AppE (VarE val)
(VarE a_2))),InfixE (Just (LitE (StringL b_3))) (VarE =:) (Just
(AppE (VarE val) (VarE b_3)))])) []]]

  So you see that, it changed the name from T/a/b to T_0/T_1/a_2/b_3.
Why is that? I did not have code to modify original data declaration.
-- 
竹密岂妨流水过
山高哪阻野云飞

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Conrad Parker
On 1 November 2011 03:43, Alexander Kjeldaas
alexander.kjeld...@gmail.com wrote:

 On 31 October 2011 17:22, Yitzchak Gale g...@sefer.org wrote:

 Gregory Crosswhite wrote:
  could [Hackage] have a feature where when a
  working package breaks with a new version of
  GHC the author is automatically e-mailed?

 This would be nice. However, there would have to be
 a way for it to be turned on and off by the author.
 (Spam is not nice.)


 How about sending an email to haskell-package-packate-name@haskell.org,
 and then people can join that mailing list if they are interested in that
 sort of stuff?  Mailman is good at doing subscribe and unsubscribe.

+1

I like this because it is opt-in for the maintainer, and also allows
anyone else who is interested in the package to track it.

Per-package RSS updates of build failures would also be useful.

Conrad.

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Max Bolingbroke
On 1 November 2011 09:00, Ketil Malde ke...@malde.org wrote:
 This is where it stranded the last time, IIRC.  That sentiment makes me
 a bit uneasy; so you are the official maintainer of a package on
 Hackage, but you do not want to hear about it when it fails to compile?

Don't forget that some packages fail to compile on Hackage even though
they work fine, because e.g. they depend on a third-party C library
that is not installed, or depend on some other package that Hackage
cannot build.

Max

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread José Pedro Magalhães
On Tue, Nov 1, 2011 at 09:43, Conrad Parker con...@metadecks.org wrote:

 On 1 November 2011 03:43, Alexander Kjeldaas
 alexander.kjeld...@gmail.com wrote:
 
  On 31 October 2011 17:22, Yitzchak Gale g...@sefer.org wrote:
 
  Gregory Crosswhite wrote:
   could [Hackage] have a feature where when a
   working package breaks with a new version of
   GHC the author is automatically e-mailed?
 
  This would be nice. However, there would have to be
  a way for it to be turned on and off by the author.
  (Spam is not nice.)
 
 
  How about sending an email to haskell-package-packate-name@haskell.org
 ,
  and then people can join that mailing list if they are interested in that
  sort of stuff?  Mailman is good at doing subscribe and unsubscribe.

 +1

 I like this because it is opt-in for the maintainer, and also allows
 anyone else who is interested in the package to track it.

 Per-package RSS updates of build failures would also be useful.


+1


Pedro



 Conrad.

 ___
 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] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Yitzchak Gale
I wrote:
 This would be nice. However, there would have to be
 a way for it to be turned on and off by the author.
 (Spam is not nice.)

Ketil Malde wrote:
 This is where it stranded the last time, IIRC.  That sentiment makes me
 a bit uneasy; so you are the official maintainer of a package on
 Hackage, but you do not want to hear about it when it fails to compile?

You are absolutely right about this.

In fact, besides build failures, it probably would be a
good idea for each maintainer to get, say, one automated
email per month with a summary of all the packages
that person is officially maintaining, even when there
are no build failures.

So I'm changing my vote to +1.

But let's think about why the instinctive reaction
is to be hesitant about this.

First of all, an automated system like a build bot
can go wrong. What guarantee is there that I
won't be flooded with emails when that happens,
if I can't shut it off myself?

Second, let's say someone decides they don't
want to be maintainer anymore. Are they married for life?
There is currently no way to remove a package.
I guess they would have to upload a new version
with no maintainer.

I am just a little worried that if uploading to Hackage
requires agreeing to unlimited uncontrollable
spamming by a bot, it may cause some good
packages not to be uploaded by people who are
hesitant to agree to that.

Thanks,
Yitz

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Ketil Malde
Max Bolingbroke batterseapo...@hotmail.com writes:

 This is where it stranded the last time, IIRC.  That sentiment makes me
 a bit uneasy; so you are the official maintainer of a package on
 Hackage, but you do not want to hear about it when it fails to compile?

 Don't forget that some packages fail to compile on Hackage even though
 they work fine, because e.g. they depend on a third-party C library
 that is not installed, or depend on some other package that Hackage
 cannot build.

True, in that case, it's harder to avoid getting one email every time
you upload a new version.  We should still strive to have stuff build on
Hackage (e.g. installing C libs or fixing the ohter packages); if the
build fails for one of these reasons, you never know if it fails for
other reasons as well.

So, I'd *love* to get an email when my packages fail to build, but I will
accept that other people have a more sensitive relationship with their
inbox.  (I assume that the people who raise this objection - Max
and Yitzchak - belong in this category?  It's not entirely clear from
your comments, and I do hope we're not avoiding useful functionality
based on a purely *hypothetical* problem.)

Conrad suggested creating a mailing list per package, another option
could be to automatically post to a single maintainers list,
highlighting the package (and preferably also maintainer) name in the
Subject. A decent MUA could then up-score the more relevant messages.

I'd really like to see Hackage move to a continuous integration type of
system, where everything is automatically built and tests are run on
every submission.  If somebody works out the software infrastructure,
I'll volunteer CPU cycles.  Next hackathon?

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Max Bolingbroke
On 1 November 2011 10:14, Ketil Malde ke...@malde.org wrote:
 So, I'd *love* to get an email when my packages fail to build, but I will
 accept that other people have a more sensitive relationship with their
 inbox.  (I assume that the people who raise this objection - Max
 and Yitzchak - belong in this category?

Don't get me wrong, I personally would like such a notification
service. I'm just making a case for making it somehow opt-out, perhaps
at a per-package granularity.

I already use the packdeps service to find out when I should relax my
package's version bounds. Packdeps delivers this information to me via
RSS, which I think this is a great solution - I don't feel under any
pressure to read it but the information is there if I want to have a
look. So ideally what I would like from Hackage 2.0 is a RSS feed that
includes build failure messages, packdeps-like information and perhaps
other stuff -- notification of automated testsuite failures,
milestones reached (Your edit-distance package has been downloaded
1000 times! Congratulations! :-)) and new reviews/comments on my
packages (if Hackage ever gets that feature).

Max

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Brandon Allbery
On Tue, Nov 1, 2011 at 06:14, Ketil Malde ke...@malde.org wrote:

 Max Bolingbroke batterseapo...@hotmail.com writes:

  This is where it stranded the last time, IIRC.  That sentiment makes me
  a bit uneasy; so you are the official maintainer of a package on
  Hackage, but you do not want to hear about it when it fails to compile?

  Don't forget that some packages fail to compile on Hackage even though
  they work fine, because e.g. they depend on a third-party C library
  that is not installed, or depend on some other package that Hackage
  cannot build.

 True, in that case, it's harder to avoid getting one email every time
 you upload a new version.  We should still strive to have stuff build on
 Hackage (e.g. installing C libs or fixing the ohter packages); if the
 build fails for one of these reasons, you never know if it fails for
 other reasons as well.


Instead of immediately sending mail, a daily process should pull up the
most recent status for each package, grouped by maintainer, and send all
the failures in a single daily message.  Perhaps monthly this could be
expanded to also report for the successful packages.

-- 
brandon s allbery  allber...@gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Ketil Malde
Yitzchak Gale g...@sefer.org writes:

 I am just a little worried that if uploading to Hackage
 requires agreeing to unlimited uncontrollable
 spamming by a bot, 

The bot would, of course, be implemented in Haskell.  Anybody who still
worries about bugs, is free to implement a better one in Agda. :-)

 it may cause some good packages not to be uploaded by people who are
 hesitant to agree to that.

One solution could be to have a Maintainer field contain a name, but no
email address?  So I could do:

  Maintainer: Ketil Malde ke...@malde.org  -- send email to me

or 

  Maintainer: Ketil Malde   -- don't send email, Google me if you are
-- human and it's that important

or even

  Maintainer: Ketil Malde ketil at malde dot org  -- email me if you are human

Or of course

  Maintainer:  -- empty field means unmaintained, caveat emptor!

Generalizing from my sample of one, I think most people would stick with
the first option, but at least this policy would leave things open for
those preferring alternatives.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants

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


Re: [Haskell-cafe] arr considered harmful

2011-11-01 Thread Serguey Zefirov
2011/11/1 Ryan Ingram ryani.s...@gmail.com:
 For example, I would love to be able to use the arrow syntax to define
 objects of this type:

 data Circuit a b where
     Const :: Bool - Circuit () Bool
     Wire :: Circuit a a
     Delay :: Circuit a a
     And :: Circuit (Bool,Bool) Bool
     Or :: Circuit (Bool,Bool) Bool
     Not :: Circuit Bool Bool
     Then :: Circuit a b - Circuit b c - Circuit a c
     Pair :: Circuit a c - Circuit b d - Circuit (a,b) (c,d)
     First :: Circuit a b - Circuit (a,c) (b,c)
     Swap :: Circuit (a,b) (b,a)
     AssocL :: Circuit ((a,b),c) (a,(b,c))
     AssocR :: Circuit (a,(b,c)) ((a,b),c)
     Loop :: Circuit (a,b) (a,c) - Circuit b c
 etc.


Would you mind give me some examples on how you desribe real circuits
with that abstraction and, especially, an Arrow instance (even
imaginary one)?

I am interested because I thought about an approach like that and
found it not easy to use one. So I stuck with monadic netlists.

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Ivan Lazar Miljenovic
On 1 November 2011 21:35, Ketil Malde ke...@malde.org wrote:
 or even

  Maintainer: Ketil Malde ketil at malde dot org  -- email me if you are 
 human

Though unless the hackage email bot is smart enough, this will result
in a lot of unsendable emails...

-- 
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] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Paul R
 On 1 November 2011 21:35, Ketil Malde ke...@malde.org wrote:
 or even
 
  Maintainer: Ketil Malde ketil at malde dot org  -- email me if you
 are human

 Though unless the hackage email bot is smart enough, this will result
 in a lot of unsendable emails...

But the bot is not a human, so that's what ketil wanted after all.

That said, I agree with Ketil that a maintainer should care about its
package being broken, and the least would be to accept to be noticed.

If the build process fails because of some reasons other than broken
package (missing deps, wrong platform ...), then fix the build process.
It should not be too hard to skip packages with unmet dependencies, or
to get them installed on hackage servers, or even for the maintainer to
bundle them within the package, like for example this package :

  http://hackage.haskell.org/package/yaml-0.4.1.1


Regarding unsolicited mail, when a maintainer fill its email adress in
the project.cabal, and send it to hackage, his adress will appear in
clear text on the hackage page and rapidly be scrapped, invariably
leading to tons of spam (in the proper sens of SPAM). So I guess these
maintainers have some way to filter their mail inbox anyway, and should
be able, if they really want, to filter hackage build-failure email :)



-- 
  Paul

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Daniel Díaz Casanueva
How about to a new optional Cabal field like mail-report? (don't bother
about this name, I chose it randomly)

If a build failure happens, or there is some relevant information about
your package, Hackage will send a mail to the direction specified in that
field. A field which content will NOT appear in the package page, so
internet bots can't record so easily your mail direction to send you real
spam. This is the reason because I write my direction in the name at
domine dot com form (since a while ago), in spite of I would really like
to receive mails about fails in those packages I maintain.

Furthermore, since the field would be optional, you still can avoid to
receive these mails.

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Nick Bowler
On 2011-11-01 12:59 +0100, Daniel Díaz Casanueva wrote:
 How about to a new optional Cabal field like mail-report? (don't bother
 about this name, I chose it randomly)
 
 If a build failure happens, or there is some relevant information about
 your package, Hackage will send a mail to the direction specified in that
 field. A field which content will NOT appear in the package page, so
 internet bots can't record so easily your mail direction to send you real
 spam. This is the reason because I write my direction in the name at
 domine dot com form (since a while ago), in spite of I would really like
 to receive mails about fails in those packages I maintain.
 
 Furthermore, since the field would be optional, you still can avoid to
 receive these mails.

Doing anything like this in the .cabal file is a mistake, since there is
no way to change it after uploading.

If your mail address changes, or if you don't want to maintain a package
any more, or if you simply change your mind about receiving status
updates by email, then if this gets hardcoded in the .cabal file you
have no recourse.

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Brandon Allbery
On Tue, Nov 1, 2011 at 08:24, Nick Bowler nbow...@elliptictech.com wrote:

 On 2011-11-01 12:59 +0100, Daniel Díaz Casanueva wrote:
  How about to a new optional Cabal field like mail-report? (don't bother
  about this name, I chose it randomly)

 Doing anything like this in the .cabal file is a mistake, since there is
 no way to change it after uploading.

 If your mail address changes, or if you don't want to maintain a package
 any more, or if you simply change your mind about receiving status
 updates by email, then if this gets hardcoded in the .cabal file you
 have no recourse.


Additionally, if you maintain a lot of packages, you don't really want to
have to change it everywhere; this kind of setting is really per
maintainer, not necessarily per package.  (It is also arguably not of much
interest to someone downloading the package.  Users' questions and bug
reports would generally be expected to go to the main contact address, not
the buildbot automated report address.)

-- 
brandon s allbery  allber...@gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Daniel Díaz Casanueva
Then, the mailing list seems to be an option. But then I will receive mails
for every package, and there is a lot of packages! Is not a lot of mails
this? There is another work around?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Paterson, Ross
Daniel Díaz Casanueva writes:
 How about to a new optional Cabal field like mail-report? (don't bother 
 about this name, I chose it randomly)

 If a build failure happens, or there is some relevant information about your 
 package, Hackage will send a mail to the direction specified in that field. A 
 field which content will NOT appear in the package page, so internet bots 
 can't record so easily your mail direction to send you real spam. This is the 
 reason because I write my direction in the name at domine dot com form 
 (since a while ago), in spite of I would really like to receive mails about 
 fails in those packages I maintain.

A field in the .cabal file is just as available to bots as a field on the 
package page.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Conrad Parker
On Nov 1, 2011 8:45 PM, Daniel Díaz Casanueva dhelta.d...@gmail.com
wrote:

 Then, the mailing list seems to be an option. But then I will receive
mails for every package, and there is a lot of packages! Is not a lot of
mails this? There is another work around?


Nobody would read every build error for thousands of packages; such a list
is useless as-is, and requires any recipient to customize filters to be of
any use.

Per-package removes the need for filters: just subscribe to the packages
you care about.

An rss feed would be perfect: it's easy to ignore old reports. Also,
implementing rss is just a matter of generating one more web page per
package: no mailserver or list config required.

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


Re: [Haskell-cafe] arr considered harmful

2011-11-01 Thread David Barbour
On Mon, Oct 31, 2011 at 5:33 PM, Ryan Ingram ryani.s...@gmail.com wrote:


 For example, I would love to be able to use the arrow syntax to define
 objects of this type:

 data Circuit a b where
 Const :: Bool - Circuit () Bool
 Wire :: Circuit a a
 Delay :: Circuit a a
 And :: Circuit (Bool,Bool) Bool
 Or :: Circuit (Bool,Bool) Bool
 Not :: Circuit Bool Bool
 Then :: Circuit a b - Circuit b c - Circuit a c
 Pair :: Circuit a c - Circuit b d - Circuit (a,b) (c,d)
 First :: Circuit a b - Circuit (a,c) (b,c)
 Swap :: Circuit (a,b) (b,a)
 AssocL :: Circuit ((a,b),c) (a,(b,c))
 AssocR :: Circuit (a,(b,c)) ((a,b),c)
 Loop :: Circuit (a,b) (a,c) - Circuit b c
 etc.

 Then we can have code that examines this concrete data representation,
 converts it to VHDL, optimizes it, etc.


As mentioned by others, Adam Megacz's generalized arrow (and its syntax)
could accomplish this. But if all you want is VHDL and the like, consider
Conal Elliott's work on Vertigo, Pan, Compiling Embedded Languages [1], and
the similar work on the Haskell GPipe package.

[1] http://conal.net/papers/jfp-saig/

Regards,

Dave


 However, due to the presence of the opaque 'arr', there's no way to make
 this type an arrow without adding an 'escape hatch'
 Arr :: (a - b) - Circuit a b
 which breaks the abstraction: circuit is supposed to represent an actual
 boolean circuit; (Arr not) is not a valid circuit because we've lost the
 information about the existence of a 'Not' gate.

 The arrow syntax translation uses arr to do plumbing of variables.  I
 think a promising project would be to figure out exactly what plumbing is
 needed, and add those functions to a sort of 'PrimitiveArrow' class.  All
 of these plumbing functions are trivially implemented in terms of 'arr',
 when it exists, but if it doesn't, it should be possible to use the arrow
 syntax regardless.

   -- ryan

 ___
 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] How to implement digital filters using Arrows

2011-11-01 Thread Captain Freako
On Mon, Oct 31, 2011 at 3:19 PM, John Lask jvl...@hotmail.com wrote:
 On 1/11/2011 1:35 AM, Captain Freako wrote:

 you need to study ArrowLoop and understand that.

Thanks, John.

I'm working my way through Hughes' suggested exercise in `Programming
with Arrows', to wit:

The reader who finds this argument difficult should work out the
sequence of approximations in the call `runSF (loop (arr swap))
[1,2,3]'

I think I understand how wrapping `cs' in `stream' provides the needed
delay of evaluation, in order to avoid a self propagating `undefined'.
However, it's not clear to me exactly what finally triggers the
evaluation of c0. So, for instance, I think the `sequence of
approximations' looks like this:

1) let (bs, cs) = unzip (map swap (zip as (_:_:_:...))) in bs :
bs = [c0, (_:_:...)]
cs = [1,2,3]

At this point, `c0' is equal to 1, but what triggers the evaluation of
c0? Is it simply the binding of it to `b0'? If so, then why aren't
`c1' and `c2' also evaluated, which would yield undefined values?

Thanks,
-db

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


[Haskell-cafe] happstack file serving

2011-11-01 Thread Gary Klindt

Hello all,

I want to have a web application using one 'index.html' file with ajax requests 
and a happstack web server which response to server requests.
For that purpose I need to use some javascript libraries in my directory tree. 
I tried:

main = simpleHTTP nullConf $ msum [ serveFile (asContentType text/html) 
index.html
  , serveFile (asContentType text/javascript) 
javascript/js.js ]


The js.js - file will never be found in this way because after finding the 
index.html,
the msum function stops (as described in the happstack crash course).
If I change the order, I can see the source of js.js.
I also tried leaving it.
In every case, inside index.html a function defined in js.js cannot be called.
(naturally, I sourced the file inside index.html)

Is it possible to obtain the effect of beeing able to call a function in an 
external file
without jmacro?


I also tried:

main = simpleHTTP nullConf $ msum [ dir ok $ ok jeah!
  , serveFile (asContentType text/html) 
index.html

Couldn't match expected type `[Char]' with actual type `Response'
Expected type: ServerPartT IO [Char]
  Actual type: ServerPartT IO Response
In the return type of a call of `serveFile'
In the expression:
  serveFile (asContentType text/html) index.html

The webserver should take requests, and if there is none (no dir, personal 
convention), it should provide index.html.
The error is because msum needs the same input types. Is it possible to 
transform one of these types to the other?

It seems that my approach to the problem is not the right one, the one the 
authors thought about while programming.
I wanted to have a clear seperation from logic (haskell) and interface 
(javascript). Is it right that using a running
haskell webserver with the web application 'in it' is in general a faster 
solution than using for example apache with
the fcgi module?

Which approach would you prefer to realize such an ajax application?

Greets Gary


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


Re: [Haskell-cafe] happstack file serving

2011-11-01 Thread Antoine Latter
Hi Gary,

A convention I use in my top-level handler is:

simpleHTTP nullConf $
msum
  [ dynamic content handler
  , serveDirectory DisableBrowsing [] static
  , 404 handler
  ]

where 'serveDirectory' is a function that ships with happstack-server
and serves up the contents of a directory which it is pointed at. I
then keep all of my static CSS and Javascript files in the static
directory.

The second argument to 'serveDirectory' is used to specify the
index-files to look for in a folder if the user browses to a static
folder, so here you could specify index.html to have
'serveDirectory' look for files named index.html and serve them up
when a top-level folder is requested.

Antoine

On Tue, Nov 1, 2011 at 9:48 AM, Gary Klindt gary.kli...@googlemail.com wrote:
 Hello all,

 I want to have a web application using one 'index.html' file with ajax
 requests and a happstack web server which response to server requests.
 For that purpose I need to use some javascript libraries in my directory
 tree. I tried:

 main = simpleHTTP nullConf $ msum [ serveFile (asContentType text/html)
 index.html
                                  , serveFile (asContentType
 text/javascript) javascript/js.js ]


 The js.js - file will never be found in this way because after finding the
 index.html,
 the msum function stops (as described in the happstack crash course).
 If I change the order, I can see the source of js.js.
 I also tried leaving it.
 In every case, inside index.html a function defined in js.js cannot be
 called.
 (naturally, I sourced the file inside index.html)

 Is it possible to obtain the effect of beeing able to call a function in an
 external file
 without jmacro?


 I also tried:

 main = simpleHTTP nullConf $ msum [ dir ok $ ok jeah!
                                  , serveFile (asContentType text/html)
 index.html

 Couldn't match expected type `[Char]' with actual type `Response'
    Expected type: ServerPartT IO [Char]
      Actual type: ServerPartT IO Response
    In the return type of a call of `serveFile'
    In the expression:
      serveFile (asContentType text/html) index.html

 The webserver should take requests, and if there is none (no dir, personal
 convention), it should provide index.html.
 The error is because msum needs the same input types. Is it possible to
 transform one of these types to the other?

 It seems that my approach to the problem is not the right one, the one the
 authors thought about while programming.
 I wanted to have a clear seperation from logic (haskell) and interface
 (javascript). Is it right that using a running
 haskell webserver with the web application 'in it' is in general a faster
 solution than using for example apache with
 the fcgi module?

 Which approach would you prefer to realize such an ajax application?

 Greets Gary


 ___
 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] happstack file serving

2011-11-01 Thread Gary Klindt

Hey Antoine,

thank you for answering. Your strategy is quite similar to the one I 
prefer. I misunderstood the behaviour of serveDirectory. The problem 
with external javascript files is solved.
The other problem I had, was, that the argument 'msum' is a list, which 
has elements with the same type, so I needed a conversion from

m [Char]  to  m Response.
In Happstack.Server.Response there is a function, which actually does 
that: flatten:


module Main where

import Happstack.Server
import Control.Monad

main :: IO ()
main = simpleHTTP nullConf $
msum [ flatten $ dir ok $ ok jeahh!
 , serveDirectory DisableBrowsing [index.html] static ]


Cheers

On 11/01/2011 03:58 PM, Antoine Latter wrote:

Hi Gary,

A convention I use in my top-level handler is:

simpleHTTP nullConf $
 msum
   [dynamic content handler
   , serveDirectory DisableBrowsing [] static
   ,404 handler
   ]

where 'serveDirectory' is a function that ships with happstack-server
and serves up the contents of a directory which it is pointed at. I
then keep all of my static CSS and Javascript files in the static
directory.

The second argument to 'serveDirectory' is used to specify the
index-files to look for in a folder if the user browses to a static
folder, so here you could specify index.html to have
'serveDirectory' look for files named index.html and serve them up
when a top-level folder is requested.

Antoine

On Tue, Nov 1, 2011 at 9:48 AM, Gary Klindtgary.kli...@googlemail.com  wrote:

Hello all,

I want to have a web application using one 'index.html' file with ajax
requests and a happstack web server which response to server requests.
For that purpose I need to use some javascript libraries in my directory
tree. I tried:

main = simpleHTTP nullConf $ msum [ serveFile (asContentType text/html)
index.html
  , serveFile (asContentType
text/javascript) javascript/js.js ]


The js.js - file will never be found in this way because after finding the
index.html,
the msum function stops (as described in the happstack crash course).
If I change the order, I can see the source of js.js.
I also tried leaving it.
In every case, inside index.html a function defined in js.js cannot be
called.
(naturally, I sourced the file inside index.html)

Is it possible to obtain the effect of beeing able to call a function in an
external file
without jmacro?


I also tried:

main = simpleHTTP nullConf $ msum [ dir ok $ ok jeah!
  , serveFile (asContentType text/html)
index.html

Couldn't match expected type `[Char]' with actual type `Response'
Expected type: ServerPartT IO [Char]
  Actual type: ServerPartT IO Response
In the return type of a call of `serveFile'
In the expression:
  serveFile (asContentType text/html) index.html

The webserver should take requests, and if there is none (no dir, personal
convention), it should provide index.html.
The error is because msum needs the same input types. Is it possible to
transform one of these types to the other?

It seems that my approach to the problem is not the right one, the one the
authors thought about while programming.
I wanted to have a clear seperation from logic (haskell) and interface
(javascript). Is it right that using a running
haskell webserver with the web application 'in it' is in general a faster
solution than using for example apache with
the fcgi module?

Which approach would you prefer to realize such an ajax application?

Greets Gary


___
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] HDBC SQLite error

2011-11-01 Thread Jurriën Stutterheim
Hi all,


I have recently switched one of my web applications to SQLite via HDBC. I use 
it to store some user credentials and data. Initially it seemed to work fine, 
until I tried logging in from two different browsers. That's when I got the 
following error when trying to log in:

SqlError {seState = , seNativeError = 5, seErrorMsg = step: database is 
locked}

My application only uses two functions (query and query', see [1]) directly, 
and the authentication code[2] uses HDBC directly. I'm not sure why I'm getting 
this error, because as far as I can see, I'm not keeping any transactions open 
longer than I have to in the auth code. Does anyone have an idea what might be 
wrong and how to fix it?


Cheers,


Jurriën


[1] 
https://github.com/norm2782/snaplet-hdbc/blob/master/src/Snap/Snaplet/Hdbc.hs#L155
[2] 
https://github.com/norm2782/snaplet-hdbc/blob/master/src/Snap/Snaplet/Auth/Backends/Hdbc.hs
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] happstack file serving

2011-11-01 Thread Antoine Latter
Including list.


-- Forwarded message --
From: Antoine Latter aslat...@gmail.com
Date: Tue, Nov 1, 2011 at 11:33 AM
Subject: Re: [Haskell-cafe] happstack file serving
To: Gary Klindt gary.kli...@googlemail.com


On Tue, Nov 1, 2011 at 11:24 AM, Gary Klindt gary.kli...@googlemail.com wrote:
 Hey Antoine,

 thank you for answering. Your strategy is quite similar to the one I prefer.
 I misunderstood the behaviour of serveDirectory. The problem with external
 javascript files is solved.
 The other problem I had, was, that the argument 'msum' is a list, which has
 elements with the same type, so I needed a conversion from
 m [Char]  to  m Response.
 In Happstack.Server.Response there is a function, which actually does that:
 flatten:

 module Main where

 import Happstack.Server
 import Control.Monad

 main :: IO ()
 main = simpleHTTP nullConf $
    msum [ flatten $ dir ok $ ok jeahh!
         , serveDirectory DisableBrowsing [index.html] static ]


I would likely write that particular example:

 dir ok $ ok $ toResponse jeahh!

I find it convenient to convert to a 'Response' as close to the
'bottom' of the stack as possible.

Antoine

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Jason Dagit
On Tue, Nov 1, 2011 at 2:45 AM, Max Bolingbroke
batterseapo...@hotmail.com wrote:
 On 1 November 2011 09:00, Ketil Malde ke...@malde.org wrote:
 This is where it stranded the last time, IIRC.  That sentiment makes me
 a bit uneasy; so you are the official maintainer of a package on
 Hackage, but you do not want to hear about it when it fails to compile?

 Don't forget that some packages fail to compile on Hackage even though
 they work fine, because e.g. they depend on a third-party C library
 that is not installed, or depend on some other package that Hackage
 cannot build.

Exactly.  Building on hackage only means that it builds on hackage.
It doesn't actually mean the code works or fails to build on the
actual machines people use.

If we had a community run build farm with appropriate sandboxing and
people could test their builds there that would be amazing, but that's
not the same as checking the build on the hackage machine.

Jason

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


Re: [Haskell-cafe] HDBC SQLite error

2011-11-01 Thread Alexander Danilov

01.11.2011 20:30, Jurriën Stutterheim пишет:

Hi all,


I have recently switched one of my web applications to SQLite via HDBC. I use 
it to store some user credentials and data. Initially it seemed to work fine, 
until I tried logging in from two different browsers. That's when I got the 
following error when trying to log in:

SqlError {seState = , seNativeError = 5, seErrorMsg = step: database is 
locked}

My application only uses two functions (query and query', see [1]) directly, 
and the authentication code[2] uses HDBC directly. I'm not sure why I'm getting 
this error, because as far as I can see, I'm not keeping any transactions open 
longer than I have to in the auth code. Does anyone have an idea what might be 
wrong and how to fix it?


Cheers,




This is a problem of hdbc-sqlite package, author think, than it can't work correctly without open 
transaction, so just commit after open database or modify hdbc-sqlite like this:


--- a/Database/HDBC/Sqlite3/Connection.hs
+++ b/Database/HDBC/Sqlite3/Connection.hs
@@ -75,7 +75,7 @@ genericConnect strAsCStrFunc fp =
 mkConn :: FilePath - Sqlite3 - IO Impl.Connection
 mkConn fp obj =
 do children - newMVar []
-   begin_transaction obj children
+--   begin_transaction obj children
ver - (sqlite3_libversion = peekCString)
return $ Impl.Connection {
 Impl.disconnect = fdisconnect obj children,


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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Paul R

Ross A field in the .cabal file is just as available to bots as
Ross a field on the package page.

Yes, absolutly. There are at least one easy solution for this problem :
having a server-side user model that is related to packages, or to
packages versions, indicating wich user is the maintainer of which
package. User would be able to provide its mail address, as well as some
preferencies. I think it is planned on hackage 2.0 already.

A .cabal based solution would need hackage to use asymetric encryption
and to provide a public key that maintainer would use to encode its
email address. But I'm not sure its worth the trouble.

-- 
  Paul

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


Re: [Haskell-cafe] How to implement digital filters using Arrows

2011-11-01 Thread Captain Freako
Hi John,

I'm trying to use the GHCI debugger on this code:

 20 instance ArrowLoop SF where
 21 loop (SF f) = SF $ \as -
 22 let (bs, cs) = unzip (f (zip as (stream cs))) in bs
 23   where stream ~(x:xs) = x : stream xs
 24
 25 swap :: (a,b) - (b,a)
 26 swap (x,y) = (y,x)

in order to watch the recursion of the `loop' function unfold.
However, when I single step through the code, I never stop on line 22
(where I could, presumably, peek in at `bs' and `cs', in order to see
them develop):

*SF :break swap
Breakpoint 1 activated at SF.hs:26:1-18
*SF runSF (loop (arr swap)) [1,2,3]
Stopped at SF.hs:26:1-18
_result :: (b, a) = _
[SF.hs:26:1-18] *SF :step
Stopped at SF.hs:26:14-18
_result :: (b, a) = _
x :: a = _
y :: b = _
[SF.hs:26:14-18] *SF :
[1Stopped at SF.hs:23:34-42
_result :: [a] = _
xs :: [a] = _
[SF.hs:23:34-42] *SF :
Stopped at SF.hs:23:13-42
_result :: [a] = _
[SF.hs:23:13-42] *SF :
Stopped at SF.hs:23:30-42
_result :: [a] = _
x :: a = _
xs :: [a] = _
[SF.hs:23:30-42] *SF :
(Pattern repeats.)

Do you have any advice?

Thanks,
-db



On Mon, Oct 31, 2011 at 3:19 PM, John Lask jvl...@hotmail.com wrote:
 On 1/11/2011 1:35 AM, Captain Freako wrote:

 you need to study ArrowLoop and understand that. In the code

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


Re: [Haskell-cafe] blog software in Haskell?

2011-11-01 Thread Simon Michael

Did someone mention hakyll already ? For the record, this is a nice recent blog 
built with it:

http://www.skybluetrades.net/posts/2011/10/21/hakyll-setup.html


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


Re: [Haskell-cafe] arr considered harmful

2011-11-01 Thread Ryan Ingram
On Tue, Nov 1, 2011 at 3:36 AM, Serguey Zefirov sergu...@gmail.com wrote:

 2011/11/1 Ryan Ingram ryani.s...@gmail.com:
 Would you mind give me some examples on how you desribe real circuits
 with that abstraction and, especially, an Arrow instance (even
 imaginary one)?


Sure, here's a simple SR latch:

nor :: Circuit (Bool,Bool) Bool
nor = Or `Then` Not

rs :: Circuit (Bool,Bool) (Bool,Bool)
rs = proc (r,s) - do
rec
q - nor - (r, q')
q' - nor - (s, q)
id - (q,q')

instance Category Circuit where
   id = Wire
   (.) = flip Then

instance GArrow Circuit where
ga_first = First  -- Circuit a b - Circuit (a,c) (b,c)
ga_second = Second  -- Circuit a b - Circuit(c,a) (c,b)
ga_cancelr = Cancel -- Circuit (a,()) a
ga_cancell = Swap `Then` Cancel -- Circuit ((),a) a
ga_uncancelr = Uncancel -- Circuit a (a, ())
ga_uncancell = Uncancel `Then` Swap -- Circuit a ((),a)
ga_assoc  = AssocL -- Circuit ((a,b),c)) (a,(b,c))
ga_unassoc = AssocR -- Circuit (a,(b,c)) ((a,b),c)

instance GArrowDrop Circuit where
ga_drop = Ground -- Circuit a ()

instance GArrowCopy Circuit where
ga_copy = Split -- Circuit a (a,a)

instance GArrowSwap Circuit where
ga_swap = Swap -- Circuit (a,b) (b,a)

instance GArrowLoop Circuit where
ga_loop = Loop -- Circuit (a,c) (b,c) - Circuit a b

which would turn into something like

rs =
  -- (r,s)
  Loop (
  -- Input plumbing
  -- ((r,s),(q_in,q'_in))
  AssocL `Then`
  -- (r, (s, (q_in,q'_in))
  Second (
  -- (s, (q_in,q'_in))
  Second swap `Then`
  -- (s, (q'_in,q_in))
  AssocR `Then` First Swap `Then` AssocL
  -- (q'_in, (s,q_in))
  ) `Then`
  -- (r, (q'_in, (s,q_in)))
  AssocR `Then`
  -- ((r,q'_in), (s,q_in))

  -- Computation!
  First (Or `Then` Not) `Then`  -- from nor
  -- (q, (s,q_in))

  Second (Or `Then` Not) `Then`  -- from nor
  -- (q, q')

  -- Output plumbing
  Split
  -- ((q,q'), (q,q'))
  ) `Then`
  -- (q,q')
  Wire  -- from id

I am interested because I thought about an approach like that and
 found it not easy to use one. So I stuck with monadic netlists.


When I did some circuit generation for the ICFP contest last year, I also
went with monadic netlists.  But I had problems coming up with
compile-time-enforcable guarantees like 'this wire is only used once'

And really, this description is for more than circuit generation; it
applies to any sort of computation that you might want to create with
arrows.  I was looking at arrowized FRP earlier this year and was
frustrated by how impossible it was to optimize the resulting dataflow
networks.  I was continually plagued by the appearance of 'arr' in my
networks, in situations where I didn't think it belonged, and with no good
way to see what that 'arr' was actually doing.

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


Re: [Haskell-cafe] arr considered harmful

2011-11-01 Thread Ryan Ingram
On Mon, Oct 31, 2011 at 6:52 PM, Paterson, Ross r.pater...@city.ac.ukwrote:


 If you require the circuit to be parametric in the value types, you can
 limit the types of function you can pass to arr to simple plumbing.
 See the netlist example at the end of my Fun of Programming slides (
 http://www.soi.city.ac.uk/~ross/papers/fop.html).


That's a neat trick, Ross!  It seems really similar to using parametricity
to recover the insides of lambdas in PHOAS metaprogramming:

-- HOAS expression language
data Expr (v :: * - *) a where
Ap :: Expr v (a - b) - Expr v a - Expr v b
Var :: v a - Expr v a
Lam :: (v a - Expr v b) - Expr v (a - b)

-- some expressions that are paremetric in the variable type
ex_id :: Expr v (a - a)
ex_id = Lam $ \x - Var x

ex_const :: Expr v (a - b - a)
ex_const = Lam $ \x - Lam $ \y - Var x

-- a print function that relies on parametricity to expose the insides of
the functions inside Lam
printExpr :: (forall v. Expr v a) - String
printExpr e = pe_helper vars 0 e  where
   vars = map (:[]) ['a' .. 'z'] ++ map (\n - t ++ show n) [1..]

prec_lam = 1
prec_ap = 2

newtype VarName a = VarName String
pe_helper :: [String] - Expr VarName a - Int - ShowS
pe_helper fv prec (Var (VarName s)) = showString s
pe_helper fv prec (Ap x y) = showParen (prec  prec_ap) (pe_helper fv
prec_ap x . showString   . pe_helper fv (prec_ap+1) y)
pe_helper (v:fv) prec (Lam k) = showParen (prec  prec_lam) (showString \
. showString v . showString  -  . pe_helper fv prec_lam e)
   where e = k (VarName v)

-- some test cases
test1 = printExpr ex_const -- \a - \b - a
test2 = printExpr (ex_id `Ap` ex_const) -- (\a - a) (\a - \b - a)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Persistent Concurrent Data Structures

2011-11-01 Thread dokondr
Hi,
Please comment on the idea and advise on steps to implement it.
Real world applications need persistent data, that can be accessed and
modified concurrently by several clients, in a way that preserves
happen-before relationship.
Idea: Design and implement Persistent Concurrent Data Types in Haskell.
These data types should mirror existing Data.List , Data.Map and similar
types but provide persistency and support consistent concurrent access and
modification (or simply - concurrency).
Persistency and concurrency should be configurable through these type
interfaces. Configuration should include:
1) Media to persist data, such as file, DBMS, external key-value store (for
example Amazon SimpleDB, CouchDB, MongoDB, Redis, etc)
2) Caching policy - when (on what events) and how much data to read/write
from/to persistent media. Media reads / writes can be done asynchronously
in separate threads.
3) Concurrency configuration: optimistic or pessimistic data locking.

One may ask why encapsulate persistency and concurrency in the data type
instead of using native storage API, such as for example key-value /
row-column API that  NoSQL databases provide?
The answer is simple: APIs that your code use greatly influence the code
itself. Using low-level storage  API directly in your code results in
bloated obscure code, or you need to encapsulate this low-level API in
clear and powerful abstractions. So why not to do this encapsulation once
and for all for such powerful types as Data.Map, for example, and forget
all Cassandra and SimpleDB low-level access method details?
When the right time comes and you will need to move your application to the
next new shiny_super_cloud, you will just write the implementation of
NData.Map backed by Data.Map in terms of low-level API of this super-cloud.

(Side note: I really need such a NData.Map type. I was requested to move my
code that heavily uses Data.Map and simple text file persistence into
Amazon AWS cloud. Looking at SimpleDB API, I realized that I will have to
rewrite 90% of code. This rewrite will greatly bloat my code and will make
it very unreadable. In case I had NData.Map I would just switch
implementation from 'file' to SimpleDB persistency inside my NData.Map
type.)

Implementation:
To start playing with this idea, NData.Map persisted in a regular file will
do, no concurrency yet. Next step -   NData.Map persisted in SimpleDB or
Cassandra or Redis, with concurrent access supported.

So it looks like  NData.Map should be a monad ...
Any ideas on implementation and similar work?

Thanks!
Dmitri
---
http://sites.google.com/site/dokondr/welcome
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to implement digital filters using Arrows

2011-11-01 Thread Ryan Ingram
Try

swap p = (snd p, fst p)

or, equivalently

swap ~(x,y) = (y,x)

  -- ryan

On Tue, Nov 1, 2011 at 1:30 PM, Captain Freako capn.fre...@gmail.comwrote:

 Hi John,

 I'm trying to use the GHCI debugger on this code:

  20 instance ArrowLoop SF where
  21 loop (SF f) = SF $ \as -
  22 let (bs, cs) = unzip (f (zip as (stream cs))) in bs
  23   where stream ~(x:xs) = x : stream xs
  24
  25 swap :: (a,b) - (b,a)
  26 swap (x,y) = (y,x)

 in order to watch the recursion of the `loop' function unfold.
 However, when I single step through the code, I never stop on line 22
 (where I could, presumably, peek in at `bs' and `cs', in order to see
 them develop):

 *SF :break swap
 Breakpoint 1 activated at SF.hs:26:1-18
 *SF runSF (loop (arr swap)) [1,2,3]
 Stopped at SF.hs:26:1-18
 _result :: (b, a) = _
 [SF.hs:26:1-18] *SF :step
 Stopped at SF.hs:26:14-18
 _result :: (b, a) = _
 x :: a = _
 y :: b = _
 [SF.hs:26:14-18] *SF :
 [1Stopped at SF.hs:23:34-42
 _result :: [a] = _
 xs :: [a] = _
 [SF.hs:23:34-42] *SF :
 Stopped at SF.hs:23:13-42
 _result :: [a] = _
 [SF.hs:23:13-42] *SF :
 Stopped at SF.hs:23:30-42
 _result :: [a] = _
 x :: a = _
 xs :: [a] = _
 [SF.hs:23:30-42] *SF :
 (Pattern repeats.)

 Do you have any advice?

 Thanks,
 -db



 On Mon, Oct 31, 2011 at 3:19 PM, John Lask jvl...@hotmail.com wrote:
  On 1/11/2011 1:35 AM, Captain Freako wrote:
 
  you need to study ArrowLoop and understand that. In the code

 ___
 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] How to implement digital filters using Arrows

2011-11-01 Thread Ryan Ingram
Never mind, I misread the code, 'zip' and the lazy definition of stream
should add the necessary laziness.

  -- ryan

On Tue, Nov 1, 2011 at 3:36 PM, Ryan Ingram ryani.s...@gmail.com wrote:

 Try

 swap p = (snd p, fst p)

 or, equivalently

 swap ~(x,y) = (y,x)

   -- ryan


 On Tue, Nov 1, 2011 at 1:30 PM, Captain Freako capn.fre...@gmail.comwrote:

 Hi John,

 I'm trying to use the GHCI debugger on this code:

  20 instance ArrowLoop SF where
  21 loop (SF f) = SF $ \as -
  22 let (bs, cs) = unzip (f (zip as (stream cs))) in bs
  23   where stream ~(x:xs) = x : stream xs
  24
  25 swap :: (a,b) - (b,a)
  26 swap (x,y) = (y,x)

 in order to watch the recursion of the `loop' function unfold.
 However, when I single step through the code, I never stop on line 22
 (where I could, presumably, peek in at `bs' and `cs', in order to see
 them develop):

 *SF :break swap
 Breakpoint 1 activated at SF.hs:26:1-18
 *SF runSF (loop (arr swap)) [1,2,3]
 Stopped at SF.hs:26:1-18
 _result :: (b, a) = _
 [SF.hs:26:1-18] *SF :step
 Stopped at SF.hs:26:14-18
 _result :: (b, a) = _
 x :: a = _
 y :: b = _
 [SF.hs:26:14-18] *SF :
 [1Stopped at SF.hs:23:34-42
 _result :: [a] = _
 xs :: [a] = _
 [SF.hs:23:34-42] *SF :
 Stopped at SF.hs:23:13-42
 _result :: [a] = _
 [SF.hs:23:13-42] *SF :
 Stopped at SF.hs:23:30-42
 _result :: [a] = _
 x :: a = _
 xs :: [a] = _
 [SF.hs:23:30-42] *SF :
 (Pattern repeats.)

 Do you have any advice?

 Thanks,
 -db



 On Mon, Oct 31, 2011 at 3:19 PM, John Lask jvl...@hotmail.com wrote:
  On 1/11/2011 1:35 AM, Captain Freako wrote:
 
  you need to study ArrowLoop and understand that. In the code

 ___
 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] How to implement digital filters using Arrows

2011-11-01 Thread John Lask



I can't comment on using ghci debugger to observe evaluation. I have in 
the past used hood (http://hackage.haskell.org/package/hood) and found 
it both convenient and useful when trying to observe evaluation order.


On 2/11/2011 7:00 AM, Captain Freako wrote:

Hi John,

I'm trying to use the GHCI debugger on this code:

  20 instance ArrowLoop SF where
  21 loop (SF f) = SF $ \as -
  22 let (bs, cs) = unzip (f (zip as (stream cs))) in bs
  23   where stream ~(x:xs) = x : stream xs
  24
  25 swap :: (a,b) -  (b,a)
  26 swap (x,y) = (y,x)

in order to watch the recursion of the `loop' function unfold.
However, when I single step through the code, I never stop on line 22
(where I could, presumably, peek in at `bs' and `cs', in order to see
them develop):



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


Re: [Haskell-cafe] How to implement digital filters using Arrows

2011-11-01 Thread Ryan Ingram
First, let's lay out our definitions:

unzip [] = ([], [])
unzip ((x,y):xys) = (x:xs, y:ys) where (xs,ys) = unzip xys

zip [] _ = []
zip _ [] = []
zip (x:xs) (y:ys) = (x,y) : zip xs ys

map _ [] = []
map f (x:xs) = f x : map f xs

stream ~(a:as) = a : stream as
-- equivalently
stream xs = head xs : stream (tail xs)

Now we want to evaluate this:
runSF (loop (arr swap))  [1,2,3]

Lets simplify some of the insides a bit:
arr swap
  = SF $ map swap
  = SF $ map (\(x,y)-(y,x))

loop (arr swap)
  = SF $ \as -
let (bs,cs) = unzip (map swap (zip as (stream cs))) in bs

runSF (loop (arr swap))  [1,2,3]
  = runSF (SF $ ...) [1,2,3]
  = (\as - let (bs,cs) = unzip (map swap (zip as (stream cs))) in bs)
[1,2,3]

Here is our heap at this point; we are trying to evaluate bs:

p = unzip (map swap (zip as (stream cs)))
as = [1,2,3]
bs = fst p
cs = snd p

snd p forces p, unzip forces its argument, map forces its second argument,
and zip forces both its arguments.
So now we have:

p = unzip retmap
retmap = map swap retzip
retzip = zip as retstream
retstream = stream cs
as = [1,2,3]
bs = fst p
cs = snd p

Evaluating further:
retstream = head cs : retstream2
retstream2 = stream (tail cs)
retzip = (1, head cs) : retzip2
retzip2 = zip [2,3] (stream (tail cs))
retmap = (head cs, 1) : retmap2
retmap2 = map swap retzip2
p = (head cs : xs1, 1 : ys1)
(xs1,ys1) = unzip retmap2
bs = head cs : xs1
cs = 1 : ys1
bs = 1 : xs1

and we can now return the first cons cell of bs.

This repeats until we get [1,2,3] back out; note that each value goes
through both sides of the swap before coming out the 'front' again.

  -- ryan

On Tue, Nov 1, 2011 at 1:30 PM, Captain Freako capn.fre...@gmail.comwrote:

 Hi John,

 I'm trying to use the GHCI debugger on this code:

  20 instance ArrowLoop SF where
  21 loop (SF f) = SF $ \as -
  22 let (bs, cs) = unzip (f (zip as (stream cs))) in bs
  23   where stream ~(x:xs) = x : stream xs
  24
  25 swap :: (a,b) - (b,a)
  26 swap (x,y) = (y,x)

 in order to watch the recursion of the `loop' function unfold.
 However, when I single step through the code, I never stop on line 22
 (where I could, presumably, peek in at `bs' and `cs', in order to see
 them develop):

 *SF :break swap
 Breakpoint 1 activated at SF.hs:26:1-18
 *SF runSF (loop (arr swap)) [1,2,3]
 Stopped at SF.hs:26:1-18
 _result :: (b, a) = _
 [SF.hs:26:1-18] *SF :step
 Stopped at SF.hs:26:14-18
 _result :: (b, a) = _
 x :: a = _
 y :: b = _
 [SF.hs:26:14-18] *SF :
 [1Stopped at SF.hs:23:34-42
 _result :: [a] = _
 xs :: [a] = _
 [SF.hs:23:34-42] *SF :
 Stopped at SF.hs:23:13-42
 _result :: [a] = _
 [SF.hs:23:13-42] *SF :
 Stopped at SF.hs:23:30-42
 _result :: [a] = _
 x :: a = _
 xs :: [a] = _
 [SF.hs:23:30-42] *SF :
 (Pattern repeats.)

 Do you have any advice?

 Thanks,
 -db



 On Mon, Oct 31, 2011 at 3:19 PM, John Lask jvl...@hotmail.com wrote:
  On 1/11/2011 1:35 AM, Captain Freako wrote:
 
  you need to study ArrowLoop and understand that. In the code

 ___
 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] Persistent Concurrent Data Structures

2011-11-01 Thread Jeremy Shaw
If I have a list [a], and I want to make that persistence, then I have
to have some way to serialize values of type 'a'. If I then modify my
type, then the serialized structure will be out of sync with the new
version of the type -- so I will need some sort of migration feature.

safecopy addresses both the issues of serializing the data and
migrating it when the datastructure changes:

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

You should definitely consider using that.

When it comes to concurrency.. my big question is how do you plan to
deal with transaction boundaries / atomicness.

For example, if each function (like, filter, map, etc) is atomic. That
doesn't mean you have something atomic when you do:

 filter pred = map f l

something could sneak in between the 'map' and the 'filter'.

An obviously solution would be to do something like:

 transaction $ filter pred = map f l

Which could mean that the datastore would have to be locked until that
entire operation is done?

Also.. what does it mean to have a 'persistent list'. In that example,
is map destructive? Does it modify the list ? Or does it produce a new
list?

A somewhat related system is, of course, acid-state (formerly happstack-state).

The solution there is pretty simple, and somewhat more flexible. To
write code you basically just use the State monad. You can store just
about any types you want and use just about any functions you want. To
get and update the state you just use get/set.

simpleTransaction
  do l - get
  let l' = filter pred (map f l)
  put l'
  return l'

That updates the list and returns the modified list as well.

To make that into a transaction we use a bit of template-haskell to
mark it is a transaction

$(makeAcidic ''MyDatabase ['simpleTransaction])

The appeal of this solution is that you are not limited to just a List
or Map or whatever types people have bother to import into the system.
If you decide you want to use Data.Tree you need only do:

$(deriveSafeCopy 1 'base ''Tree)

And now you can use it persistently and concurrently as well. You do
not have to recreate every function in Data.Tree.

Still, I can see the appeal of just being able to import NData.Map,
deriving a serialize instance for your data, and start writing very
normal looking code. There is something very nice about just being
able to use a function like 'transaction' to mark the boundaries of a
transaction rather than having to give the transaction and name and
call some template haskell function.

Using acid-state, it would be very easy to implement a persistent
version of Data.Map where each function is atomic. However, there is
currently no way to group multiple events into a single transaction.
Though I think I can imagine how to add such a feature. Of course, the
idea of having a big lock blocking everything is not very appealing.
But as an experimental fork it could be interesting..

But, first I would like to hear more about how you imagined
transactions would actually work in the first place..

The big issue I see is that transactions can be a real performance
problem. If I write code for a Map-like persistent structure:

 transaction $ do v - lookup key pmap
 v' - doSomethingExpensive v
 insert v pmap

That is going to really lock things up, since nothing else can happen
while that transaction is running?

Still, it sounds interesting.. just not easy :)

I would definitely encourage you to consider safecopy at the very
least. It is completely independent of acid-state. It is simply a fast
versioned data serialization library.

- jeremy



On Tue, Nov 1, 2011 at 5:31 PM, dokondr doko...@gmail.com wrote:
 Hi,
 Please comment on the idea and advise on steps to implement it.
 Real world applications need persistent data, that can be accessed and
 modified concurrently by several clients, in a way that preserves
 happen-before relationship.
 Idea: Design and implement Persistent Concurrent Data Types in Haskell.
 These data types should mirror existing Data.List , Data.Map and similar
 types but provide persistency and support consistent concurrent access and
 modification (or simply - concurrency).
 Persistency and concurrency should be configurable through these type
 interfaces. Configuration should include:
 1) Media to persist data, such as file, DBMS, external key-value store (for
 example Amazon SimpleDB, CouchDB, MongoDB, Redis, etc)
 2) Caching policy - when (on what events) and how much data to read/write
 from/to persistent media. Media reads / writes can be done asynchronously in
 separate threads.
 3) Concurrency configuration: optimistic or pessimistic data locking.

 One may ask why encapsulate persistency and concurrency in the data type
 instead of using native storage API, such as for example key-value /
 row-column API that  NoSQL databases provide?
 The answer is simple: APIs that your code use greatly influence the code
 itself. Using low-level storage  API 

Re: [Haskell-cafe] Persistent Concurrent Data Structures

2011-11-01 Thread Evan Laforge
So I guess you're talking about imperative mutated data structures
(which is btw the opposite of what persistence usually means in
haskell).

It seems like switching data storage would be as easy or hard as
you've been able to abstract it, e.g. if you can put everything
through 'get' and 'put' then it's easy, just change those two
functions.  But if you can't, then maybe it's because you're relying
on features specific to some data store, and then some generic
interface won't help you.

So I guess I'm skeptical that generic auto-serialized types would be
able to help.  Why not write to an interface that expresses exactly
what your app requires instead?  Anyway, unless I'm misunderstanding
your question, this just an imperative style design thing, and no
different in haskell than python or java, except of course haskell
will encourage you to not write in this style in the first place :)

But maybe you can factor out the IO by e.g. 'data - readData;
writeData (diff data (transform data))' where data is a plain
persistent (in the haskell sense) data structure.  That way
interaction with the storage is in one place.

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


Re: [Haskell-cafe] Persistent Concurrent Data Structures

2011-11-01 Thread David Barbour
Several of the Haskell web server frameworks (Yesod, HAppS, etc.) come with
persistence support.

I believe you're taking the wrong approach here, with respect to `modified
concurrently` and the like. What does it mean for a Data.List to be
'modified concurrently'? If you need concurrency, first find a good
abstraction for a concurrent collection - one that already covers such
details as ordered or collaborative updates. The result might not look much
like Data.List.



On Tue, Nov 1, 2011 at 3:31 PM, dokondr doko...@gmail.com wrote:

 Hi,
 Please comment on the idea and advise on steps to implement it.
 Real world applications need persistent data, that can be accessed and
 modified concurrently by several clients, in a way that preserves
 happen-before relationship.
 Idea: Design and implement Persistent Concurrent Data Types in Haskell.
 These data types should mirror existing Data.List , Data.Map and similar
 types but provide persistency and support consistent concurrent access and
 modification (or simply - concurrency).
 Persistency and concurrency should be configurable through these type
 interfaces. Configuration should include:
 1) Media to persist data, such as file, DBMS, external key-value store
 (for example Amazon SimpleDB, CouchDB, MongoDB, Redis, etc)
 2) Caching policy - when (on what events) and how much data to read/write
 from/to persistent media. Media reads / writes can be done asynchronously
 in separate threads.
 3) Concurrency configuration: optimistic or pessimistic data locking.

 One may ask why encapsulate persistency and concurrency in the data type
 instead of using native storage API, such as for example key-value /
 row-column API that  NoSQL databases provide?
 The answer is simple: APIs that your code use greatly influence the code
 itself. Using low-level storage  API directly in your code results in
 bloated obscure code, or you need to encapsulate this low-level API in
 clear and powerful abstractions. So why not to do this encapsulation once
 and for all for such powerful types as Data.Map, for example, and forget
 all Cassandra and SimpleDB low-level access method details?
 When the right time comes and you will need to move your application to
 the next new shiny_super_cloud, you will just write the implementation of
 NData.Map backed by Data.Map in terms of low-level API of this super-cloud.

 (Side note: I really need such a NData.Map type. I was requested to move
 my code that heavily uses Data.Map and simple text file persistence into
 Amazon AWS cloud. Looking at SimpleDB API, I realized that I will have to
 rewrite 90% of code. This rewrite will greatly bloat my code and will make
 it very unreadable. In case I had NData.Map I would just switch
 implementation from 'file' to SimpleDB persistency inside my NData.Map
 type.)

 Implementation:
 To start playing with this idea, NData.Map persisted in a regular file
 will do, no concurrency yet. Next step -   NData.Map persisted in SimpleDB
 or Cassandra or Redis, with concurrent access supported.

 So it looks like  NData.Map should be a monad ...
 Any ideas on implementation and similar work?

 Thanks!
 Dmitri
 ---
 http://sites.google.com/site/dokondr/welcome



 ___
 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] Persistent Concurrent Data Structures

2011-11-01 Thread Alberto G. Corona
hi Dimitri

Take a look at TCache. It is a transactional cache with configurable
persistence.

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

It defines persistent TVars  (DBRef`s)  with similar primitives.
Persistence can be defined by the user for each datatype by an
instance declaration. There is a default persistence in files.

Cache size, synchronization with the database and caching policies are
also defined by the user.

Using this package is easy to define persistent concurrent data
structures. An example are the persistent Queues defined in the
package Workflow:

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



2011/11/1 dokondr doko...@gmail.com:
 Hi,
 Please comment on the idea and advise on steps to implement it.
 Real world applications need persistent data, that can be accessed and
 modified concurrently by several clients, in a way that preserves
 happen-before relationship.
 Idea: Design and implement Persistent Concurrent Data Types in Haskell.
 These data types should mirror existing Data.List , Data.Map and similar
 types but provide persistency and support consistent concurrent access and
 modification (or simply - concurrency).
 Persistency and concurrency should be configurable through these type
 interfaces. Configuration should include:
 1) Media to persist data, such as file, DBMS, external key-value store (for
 example Amazon SimpleDB, CouchDB, MongoDB, Redis, etc)
 2) Caching policy - when (on what events) and how much data to read/write
 from/to persistent media. Media reads / writes can be done asynchronously in
 separate threads.
 3) Concurrency configuration: optimistic or pessimistic data locking.

 One may ask why encapsulate persistency and concurrency in the data type
 instead of using native storage API, such as for example key-value /
 row-column API that  NoSQL databases provide?
 The answer is simple: APIs that your code use greatly influence the code
 itself. Using low-level storage  API directly in your code results in
 bloated obscure code, or you need to encapsulate this low-level API in clear
 and powerful abstractions. So why not to do this encapsulation once and for
 all for such powerful types as Data.Map, for example, and forget all
 Cassandra and SimpleDB low-level access method details?
 When the right time comes and you will need to move your application to the
 next new shiny_super_cloud, you will just write the implementation of
 NData.Map backed by Data.Map in terms of low-level API of this super-cloud.

 (Side note: I really need such a NData.Map type. I was requested to move my
 code that heavily uses Data.Map and simple text file persistence into Amazon
 AWS cloud. Looking at SimpleDB API, I realized that I will have to rewrite
 90% of code. This rewrite will greatly bloat my code and will make it very
 unreadable. In case I had NData.Map I would just switch implementation from
 'file' to SimpleDB persistency inside my NData.Map type.)

 Implementation:
 To start playing with this idea, NData.Map persisted in a regular file will
 do, no concurrency yet. Next step -   NData.Map persisted in SimpleDB or
 Cassandra or Redis, with concurrent access supported.

 So it looks like  NData.Map should be a monad ...
 Any ideas on implementation and similar work?

 Thanks!
 Dmitri
 ---
 http://sites.google.com/site/dokondr/welcome



 ___
 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] Persistent Concurrent Data Structures

2011-11-01 Thread dokondr
Thanks everybody for advice!
I'll try to clarify what I mean by persistence and concurrent access that
preserves happens-before relationship.
1) Persistence - imagine Haskell run-time executing in infinite physical
memory. My idea is to implement really huge,  almost infinite memory in
the cloud of one or another type. Nothing more nothing less, nothing
imperative, exactly the same environment that GHC runtime  works today, but
extended to huge virtual memory in the cloud.

2) Concurrent access that preserves happens-before relationship. Before
talking about transactions, I would use locking data structures in two
different ways:
- Optimistic lock - everybody can read and write / delete simultaneously,
system ensures only happens-before relationship. In other words Best
Effort Modification - you can try to modify data, but there is no guarantee
that  your modification will work.
- Pessimistic lock - when you get lock - structure is all yours  as long as
you held the lock - everybody else can only read, happens-before
relationship is ensured at all times.
About happens-before relationship:
http://en.wikipedia.org/wiki/Happened-before
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Persistent Concurrent Data Structures

2011-11-01 Thread dokondr
On Wed, Nov 2, 2011 at 3:12 AM, dokondr doko...@gmail.com wrote:

 Thanks everybody for advice!
 I'll try to clarify what I mean by persistence and concurrent access that
 preserves happens-before relationship.
 1) Persistence - imagine Haskell run-time executing in infinite physical
 memory. My idea is to implement really huge,  almost infinite memory in
 the cloud of one or another type. Nothing more nothing less, nothing
 imperative, exactly the same environment that GHC runtime  works today, but
 extended to huge virtual memory in the cloud.


I am afraid I am confused everybody, didn't mean it, sorry. I understand
that  infinite physical memory is not quite the same that implementing
NData.* on top of some cloud framework. Yet NData.* may be the first step
in this direction. Infinite memory will require support in Haskell
run-time, run-time distributed across many physical instances. Yet, it
looks like physical memory will eventually will be very huge virtual memory
persistent in the cloud for some period of time. IMHO this will simplify
programming model considerably.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Diego Souza
The perl community has something really interesting for quite long time:
http://wiki.cpantesters.org/wiki/HomePage

Or more specifically:
http://matrix.cpantesters.org/?dist=DBI

The idea is simple: there are many different platforms that would be
to expensive for one to support. So they ask the community for help,
and then distribute the load amongst the perl community.

It servers for testing modules and also perl distribution itself.

It may work better for this purpose than relying on a single
centralized platform, namely Hackage.

~dsouza

At Mon, 31 Oct 2011 17:08:22 +1000,
Gregory Crosswhite wrote:
 
 [1  multipart/alternative (7bit)]
 [1.1  text/plain; us-ascii (quoted-printable)]
 Hey everyone,
 
 I have uploaded a number of small packages to Hackage that I no longer 
 actively use so that I don't find out immediately when a new version of GHC 
 has broken them.  Since Hackage is going to the trouble of finding out when a 
 package no longer builds anyway, could it have a feature where when a working 
 package breaks with a new version of GHC the author is automatically 
 e-mailed?  This would make me (and probably others) a lot more likely to 
 notice and proactively fix broken packages.  (Heck, I wouldn't even 
 necessarily mind being nagged about it from time to time.  :-) )
 
 Cheers,
 Greg
 [1.2  text/html; us-ascii (7bit)]
 
 [2  text/plain; us-ascii (7bit)]
 ___
 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