Re: [Haskell-cafe] A first glimps on the {-# NOUPDATE #-} pragma

2012-08-29 Thread Joachim Breitner
Hi,

Am Dienstag, den 28.08.2012, 18:16 -0400 schrieb Carter Schonwald:
 On Tuesday, August 28, 2012, Yves Parès wrote:
 Monad? Simple strictness anotation is enough in that case:
 
 upd_noupd n =
 let l = myenum' 0 n
 h = head l
 in h `seq` last l + h

darn, I though I changed my examples before posting to:

upd_noupd n = 
let l = myenum' 0 n
in last l + length l

(head was a bad example because actually due to strictness analysis
and worker/wrapper transformation, GHC would yield good code even
without `seq`).

In this case (which is actually the benchmarked case), reordering or
strictness annotations do not help.

Greetings and sorry for the confusion,
Joachim


-- 
Dipl.-Math. Dipl.-Inform. Joachim Breitner
Wissenschaftlicher Mitarbeiter
http://pp.info.uni-karlsruhe.de/~breitner


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A first glimps on the {-# NOUPDATE #-} pragma

2012-08-29 Thread Facundo Domínguez
Hi,

 upd_noupd n =
 let l = myenum' 0 n
 in last l + length l

This could be rewritten as

 upd_noupd n =
 let l n = myenum' 0 n
 in last (l n) + length (l n)

Or a special form of let could be introduced to define locally-scoped macros:

 upd_noupd n =
 let# l = myenum' 0 n
 in last l + length l

What's the strength of the {-# NOUPDATE #-} approach?

Regards,
Facundo


 Date: Wed, 29 Aug 2012 10:20:21 +0200
 From: Joachim Breitner breit...@kit.edu
 Subject: Re: [Haskell-cafe] A first glimps on the {-# NOUPDATE #-}
 pragma
 To: haskell-cafe@haskell.org
 Message-ID: 1346228421.4271.9.camel@kirk
 Content-Type: text/plain; charset=iso-8859-15

 Hi,

 Am Dienstag, den 28.08.2012, 18:16 -0400 schrieb Carter Schonwald:
 On Tuesday, August 28, 2012, Yves Par?s wrote:
 Monad? Simple strictness anotation is enough in that case:

 upd_noupd n =
 let l = myenum' 0 n
 h = head l
 in h `seq` last l + h

 darn, I though I changed my examples before posting to:

 upd_noupd n =
 let l = myenum' 0 n
 in last l + length l

 (head was a bad example because actually due to strictness analysis
 and worker/wrapper transformation, GHC would yield good code even
 without `seq`).

 In this case (which is actually the benchmarked case), reordering or
 strictness annotations do not help.

 Greetings and sorry for the confusion,
 Joachim


 --
 Dipl.-Math. Dipl.-Inform. Joachim Breitner
 Wissenschaftlicher Mitarbeiter
 http://pp.info.uni-karlsruhe.de/~breitner

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


Re: [Haskell-cafe] A first glimps on the {-# NOUPDATE #-} pragma

2012-08-29 Thread Joachim Breitner
Hi Facundo,

Am Mittwoch, den 29.08.2012, 10:26 -0300 schrieb Facundo Domínguez:
  upd_noupd n =
  let l = myenum' 0 n
  in last l + length l
 
 This could be rewritten as
 
  upd_noupd n =
  let l n = myenum' 0 n
  in last (l n) + length (l n)
 
 Or a special form of let could be introduced to define locally-scoped macros:
 
  upd_noupd n =
  let# l = myenum' 0 n
  in last l + length l
 
 What's the strength of the {-# NOUPDATE #-} approach?

it does not require refactoring of the code. There is not always a
parameter handy that you can use to prevent sharing, and using () for
that sometimes fails due to the full-lazyness-transformation.

And a locally-scoped macros would not help in this case:

test g n = g (myenum' 0 n)

Now you still might want to prevent the long list to be stored, but here
it cannot be done just by inlining or macro expansion.


Greetings,
Joachim

-- 
Dipl.-Math. Dipl.-Inform. Joachim Breitner
Wissenschaftlicher Mitarbeiter
http://pp.info.uni-karlsruhe.de/~breitner


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A first glimps on the {-# NOUPDATE #-} pragma

2012-08-29 Thread timothyhobbs
And of course the biggest reason for this change, is we want GHC to continue
to become smarter.  Remember, Haskell is a high level language.  The
original promise, is that the code should be algebraically optimizable by 
the compiler itself.  Yes, of course many Haskell coders have learned to
deal with the places where Haskell is all to close to the metal.  But we
hope that this will not always be the case.  The interesting part, may not
be that you can add the pragma yourself, but that in the future, you won't
have to change anything at all.

Tim


-- Původní zpráva --
Od: Joachim Breitner breit...@kit.edu
Datum: 29. 8. 2012
Předmět: Re: [Haskell-cafe] A first glimps on the {-# NOUPDATE #-} pragma
Hi Facundo,

Am Mittwoch, den 29.08.2012, 10:26 -0300 schrieb Facundo Domínguez:
  upd_noupd n =
  let l = myenum' 0 n
  in last l + length l

 This could be rewritten as

  upd_noupd n =
  let l n = myenum' 0 n
  in last (l n) + length (l n)

 Or a special form of let could be introduced to define locally-scoped
macros:

  upd_noupd n =
  let# l = myenum' 0 n
  in last l + length l

 What's the strength of the {-# NOUPDATE #-} approach?

it does not require refactoring of the code. There is not always a
parameter handy that you can use to prevent sharing, and using () for
that sometimes fails due to the full-lazyness-transformation.

And a locally-scoped macros would not help in this case:

test g n = g (myenum' 0 n)

Now you still might want to prevent the long list to be stored, but here
it cannot be done just by inlining or macro expansion.


Greetings,
Joachim

--
Dipl.-Math. Dipl.-Inform. Joachim Breitner
Wissenschaftlicher Mitarbeiter
http://pp.info.uni-karlsruhe.de/~breitner
(http://pp.info.uni-karlsruhe.de/%7Ebreitner)___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A first glimps on the {-# NOUPDATE #-} pragma

2012-08-29 Thread Thomas Schilling
On 29 August 2012 15:21, Joachim Breitner breit...@kit.edu wrote:

 Hi Facundo,

 Am Mittwoch, den 29.08.2012, 10:26 -0300 schrieb Facundo Domínguez:
   upd_noupd n =
   let l = myenum' 0 n
   in last l + length l
 
  This could be rewritten as
 
   upd_noupd n =
   let l n = myenum' 0 n
   in last (l n) + length (l n)
 
  Or a special form of let could be introduced to define locally-scoped
 macros:
 
   upd_noupd n =
   let# l = myenum' 0 n
   in last l + length l
 
  What's the strength of the {-# NOUPDATE #-} approach?

 it does not require refactoring of the code. There is not always a
 parameter handy that you can use to prevent sharing, and using () for
 that sometimes fails due to the full-lazyness-transformation.

 And a locally-scoped macros would not help in this case:

 test g n = g (myenum' 0 n)

 Now you still might want to prevent the long list to be stored, but here
 it cannot be done just by inlining or macro expansion.


Syntactically, I'd prefer something that looks more like a function.  With
a pragma it's difficult to see what expression it actually affects.  For
example, we already have the special functions lazy and inline. Since
avoiding updates essentially turns lazy evaluation into call-by-name you
could call it cbn. Perhaps that suggests a different use case, though, so
nonstrict, unshared, or nonlazy might be more self-explanatory.

I'd also like to point out that avoiding updates can dramatically improve
the kind of speedups my tracing JIT can achieve. In particular, on some
benchmarks, it can optimise idiomatic Haskell code to the same level as
stream fusion. I can simulate that by avoiding *all* updates (i.e., use
call-by-name), but that would break some programs badly. (Technically,
that's all legal, but I'm pretty sure it breaks any tying-the-knot
tricks.)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCE: persistent-vector-0.1.0.1

2012-08-29 Thread Tristan Ravitch
I uploaded a package implementing persistent vectors using array
mapped tries (based on the implementation in clojure).  Version
0.1.0.0 was broken, so I am starting off with 0.1.0.1.

  http://hackage.haskell.org/package/persistent-vector

Persistent vectors are a sequence container offering efficient and
purely functional append (snoc), indexing, and updates.  This is
similar to Data.Sequence from containers.  The array mapped trie
is closely related to the data structure used in the
unordered-containers package.

Comparison to Sequence:

 * Faster indexing and append

 * Slightly slower updates to existing elements

 * O(1) slicing

 * Sequence offers efficient prepend and concatenate
   (persistent-vector does not implement prepend, while concatenate is
   O(n)).

I tried to model the API after Sequence as much as was reasonable, but
a few functions are still missing.  Some are reasonable to implement
and some would be difficult to make efficient.  The results from
criterion (mostly comparing against Sequence and IntMap) are posted
here:

  http://pages.cs.wisc.edu/~travitch/pvec.html

The *Vec* runs are the vectors from this package and IM and Seq are
IntMap and Sequence from containers.


Hopefully someone will find this useful.  Comments and suggestions are
definitely welcome for anything: API, implementation, test suite, or
benchmarks.


pgpGGufATcanJ.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: persistent-vector-0.1.0.1

2012-08-29 Thread Alberto G. Corona
Where the persistent part of the name comes from?. It can be
serialized/deserialized from a persistent storage automatically or on
demand?

2012/8/29 Tristan Ravitch travi...@cs.wisc.edu

 I uploaded a package implementing persistent vectors using array
 mapped tries (based on the implementation in clojure).  Version
 0.1.0.0 was broken, so I am starting off with 0.1.0.1.

   http://hackage.haskell.org/package/persistent-vector

 Persistent vectors are a sequence container offering efficient and
 purely functional append (snoc), indexing, and updates.  This is
 similar to Data.Sequence from containers.  The array mapped trie
 is closely related to the data structure used in the
 unordered-containers package.

 Comparison to Sequence:

  * Faster indexing and append

  * Slightly slower updates to existing elements

  * O(1) slicing

  * Sequence offers efficient prepend and concatenate
(persistent-vector does not implement prepend, while concatenate is
O(n)).

 I tried to model the API after Sequence as much as was reasonable, but
 a few functions are still missing.  Some are reasonable to implement
 and some would be difficult to make efficient.  The results from
 criterion (mostly comparing against Sequence and IntMap) are posted
 here:

   http://pages.cs.wisc.edu/~travitch/pvec.html

 The *Vec* runs are the vectors from this package and IM and Seq are
 IntMap and Sequence from containers.


 Hopefully someone will find this useful.  Comments and suggestions are
 definitely welcome for anything: API, implementation, test suite, or
 benchmarks.

 ___
 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] ANNOUNCE: persistent-vector-0.1.0.1

2012-08-29 Thread Johan Tibell
On Wed, Aug 29, 2012 at 10:13 AM, Alberto G. Corona agocor...@gmail.com wrote:
 Where the persistent part of the name comes from?. It can be
 serialized/deserialized from a persistent storage automatically or on
 demand?

Persistent have two meanings unfortunately. In functional programming
it's used to mean that every operation on a data structure preserves
the old version as well.

-- Johan

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


Re: [Haskell-cafe] ANNOUNCE: persistent-vector-0.1.0.1

2012-08-29 Thread Tristan Ravitch
Sorry, persistent as in purely functional.  Updates to one vector
don't affect others.  I guess the distinction isn't as useful in
Haskell as it is in other languages since it is the default.

On Wed, Aug 29, 2012 at 07:13:38PM +0200, Alberto G. Corona  wrote:
 Where the persistent part of the name comes from?. It can be
 serialized/deserialized from a persistent storage automatically or on
 demand?

 2012/8/29 Tristan Ravitch travi...@cs.wisc.edu

  I uploaded a package implementing persistent vectors using array
  mapped tries (based on the implementation in clojure).  Version
  0.1.0.0 was broken, so I am starting off with 0.1.0.1.
 
http://hackage.haskell.org/package/persistent-vector
 
  Persistent vectors are a sequence container offering efficient and
  purely functional append (snoc), indexing, and updates.  This is
  similar to Data.Sequence from containers.  The array mapped trie
  is closely related to the data structure used in the
  unordered-containers package.
 
  Comparison to Sequence:
 
   * Faster indexing and append
 
   * Slightly slower updates to existing elements
 
   * O(1) slicing
 
   * Sequence offers efficient prepend and concatenate
 (persistent-vector does not implement prepend, while concatenate is
 O(n)).
 
  I tried to model the API after Sequence as much as was reasonable, but
  a few functions are still missing.  Some are reasonable to implement
  and some would be difficult to make efficient.  The results from
  criterion (mostly comparing against Sequence and IntMap) are posted
  here:
 
http://pages.cs.wisc.edu/~travitch/pvec.html
 
  The *Vec* runs are the vectors from this package and IM and Seq are
  IntMap and Sequence from containers.
 
 
  Hopefully someone will find this useful.  Comments and suggestions are
  definitely welcome for anything: API, implementation, test suite, or
  benchmarks.
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 


pgpyRTf9uZFKs.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Darcs fetches too little files

2012-08-29 Thread Stefan Monnier
 Albert Einstein said:
   Insanity: doing the same thing over and over again and expecting
 different results.
 I repeated the command today and it worked!

So, did you expect the result to be different, or did you re-try just to
confirm that it doesn't work?


Stefan


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


Re: [Haskell-cafe] Darcs fetches too little files

2012-08-29 Thread Henk-Jan van Tuyl
On Wed, 29 Aug 2012 23:10:24 +0200, Stefan Monnier  
monn...@iro.umontreal.ca wrote:



Albert Einstein said:
  Insanity: doing the same thing over and over again and expecting
different results.
I repeated the command today and it worked!


So, did you expect the result to be different, or did you re-try just to
confirm that it doesn't work?


The day after I tried the command the first time, I thought the result  
might be different; I have the experience that my browser crashes, and  
starting it again results in an immediate crash. Logging off and on again  
solves the problem. This might be because of a corrupted DLL or a  
corrupted data area of a DLL.


The command failure could have also been caused by a problem at the server  
side.


In conclusion: repeating the same thing could give different results.

Regards,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--

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


[Haskell-cafe] Iterations (Was: Re: Darcs fetches too little files)

2012-08-29 Thread Jerzy Karczmarczuk

Le 29/08/2012 23:55, Henk-Jan van Tuyl a écrit :

In conclusion: repeating the same thing could give different results.


Certainly!

My favourite example is : sex.

Jerzy Karczmarczuk



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


[Haskell-cafe] Haskell Weekly News: Issue 242

2012-08-29 Thread Daniel Santa Cruz
Welcome to issue 242 of the HWN, an issue covering crowd-sourced bits
of information about Haskell from around the web. This issue covers the
week of August 19 to 25, 2012.

Quotes of the Week

   * srhb: I think that's going into space rather than diving into the
   deep end.

   * edwardk: normally i don't bother with little things like
  documentation, benchmarks and tests, but I recently
  discovered that when I do, I get these curious things called
  users.

   * shachaf: Number of comonads released by edwardk will exceed the
  number of words in the English language by 2015, experts report.

Top Reddit Stories

   * Hackage2 server ready for testing
 Domain: haskell.org, Score: 75, Comments: 16
 On Reddit: [1] http://goo.gl/WTebL
 Original: [2] http://goo.gl/dHkGo

   * Monads In Pictures
 Domain: newartisans.com, Score: 60, Comments: 24
 On Reddit: [3] http://goo.gl/QMfGv
 Original: [4] http://goo.gl/ycmvx

   * A new fast and easy to use CSV library
 Domain: blog.johantibell.com, Score: 53, Comments: 26
 On Reddit: [5] http://goo.gl/eRKSm
 Original: [6] http://goo.gl/uRmfz

   * duckduckgo.com just became my favorite search engine due to haskell support
 Domain: self.haskell, Score: 50, Comments: 14
 On Reddit: [7] http://goo.gl/1tBCg
 Original: [8] http://goo.gl/1tBCg

   * An example on how ridiculously powerful haskells type system is
 Domain: chrisdone.com, Score: 44, Comments: 61
 On Reddit: [9] http://goo.gl/iwJT2
 Original: [10] http://goo.gl/NovM7

   * Galois Internship Available: Come build high-assurance autonomous vehicles!
 Domain: corp.galois.com, Score: 43, Comments: 13
 On Reddit: [11] http://goo.gl/iJEih
 Original: [12] http://goo.gl/8ckL4

   * Issue 20 « The Monad.Reader
 Domain: themonadreader.wordpress.com, Score: 34, Comments: 8
 On Reddit: [13] http://goo.gl/K5Cc7
 Original: [14] http://goo.gl/dBSdK

   * Functional Game Design: Making Pong in Elm
 Domain: elm-lang.org, Score: 29, Comments: 11
 On Reddit: [15] http://goo.gl/sCdfE
 Original: [16] http://goo.gl/RL2i1

   * Making HaskellDB slightly more type-safe
 Domain: chrisdone.com, Score: 28, Comments: 3
 On Reddit: [17] http://goo.gl/b16v5
 Original: [18] http://goo.gl/7v38l

   * Identifying outdated packages in cabal install plans
 Domain: byorgey.wordpress.com, Score: 24, Comments: 5
 On Reddit: [19] http://goo.gl/4yTrR
 Original: [20] http://goo.gl/Zjw7b

   * ghcLiVE project escapes!
 Domain: ghclive.wordpress.com, Score: 23, Comments: 16
 On Reddit: [21] http://goo.gl/IiXaA
 Original: [22] http://goo.gl/QzUHW

   * My view on why relational algebra matters
 Domain: users.utu.fi, Score: 22, Comments: 16
 On Reddit: [23] http://goo.gl/byYZW
 Original: [24] http://goo.gl/3NSmI

   * ANN basic-prelude 0.3 (now comes with a fully-featured Prelude replacement)
 Domain: haskell.org, Score: 21, Comments:
 On Reddit: [25] http://goo.gl/klUAO
 Original: [26] http://goo.gl/4Ccyv

   * I just realized that running monads is applying a left monad action
 Domain: self.haskell, Score: 21, Comments: 53
 On Reddit: [27] http://goo.gl/Geus4
 Original: [28] http://goo.gl/Geus4

   * You can soon play in the cabal sandbox
 Domain: blog.johantibell.com, Score: 20, Comments: 10
 On Reddit: [29] http://goo.gl/QuVo0
 Original: [30] http://goo.gl/6Q9a9

   * Unordered tuples and type algebra
 Domain: byorgey.wordpress.com, Score: 18, Comments: 3
 On Reddit: [31] http://goo.gl/N8iuz
 Original: [32] http://goo.gl/8l11g

   * Haskell-Type-Exts Passed the Final Evaluation
 Domain: cleantypecheck.wordpress.com, Score: 16, Comments: 3
 On Reddit: [33] http://goo.gl/ok7CL
 Original: [34] http://goo.gl/ttsFb

   * LambdaJam Conference (from the creator of Strange Loop)
 -- Coming to Chicago in Summer 2013!
 Domain: lambdajam.com, Score: 15, Comments:
 On Reddit: [35] http://goo.gl/ytWNE
 Original: [36] http://goo.gl/ziyYc

   * Hello world in SKI combinator calculus
 Domain: self.haskell, Score: 14, Comments: 16
 On Reddit: [37] http://goo.gl/qVDMw
 Original: [38] http://goo.gl/qVDMw

   * Is this Monoid instance in the standard library somewhere?
 Domain: self.haskell, Score: 14, Comments: 7
 On Reddit: [39] http://goo.gl/cFHG7
 Original: [40] http://goo.gl/cFHG7

   * Applicative functors: definition and syntax (a reply)
 Domain: tomasp.net, Score: 13, Comments: 7
 On Reddit: [41] http://goo.gl/4VPKR
 Original: [42] http://goo.gl/saU2j

Top StackOverflow Questions

   * Lazy Evaluation and Time Complexity
 votes: 40, answers: 7
 Read on SO: [43] http://goo.gl/f9QTO

   * What is the purpose of Rank2Types?
 votes: 21, answers: 3
 Read on SO: [44] http://goo.gl/XrPHP

   * “Modern” HList?
 votes: 16, answers: 1
 Read 

[Haskell-cafe] Build regressions due to GHC 7.6

2012-08-29 Thread Bryan O'Sullivan
Since the release of the GHC 7.6 RC, I've been going through my packages
and fixing up build problems so that people who upgrade to 7.6 will have a
smooth ride.

Sad to say, my experience of 7.6 is that it has felt like a particularly
rough release for backwards incompatibility. I wanted to quantify the pain,
so I did some research, and here's what I found.

I maintain 25 open source Haskell packages. Of these, the majority have
needed updates due to the GHC 7.6 release:

   - base16-bytestring
   - blaze-textual
   - bloomfilter
   - configurator
   - criterion
   - double-conversion
   - filemanip
   - HDBC-mysql
   - mwc-random
   - pcap
   - pool
   - riak-haskell-client
   - snappy
   - text
   - text-format
   - text-icu

That's 16 out of 25 packages I've had to update. I've also either reported
bugs on, or had to fix, several other people's packages along the way
(maybe four?). So let's say I've run into problems with 20 out of the
combined 29 packages of mine and my upstreams.

The reasons for these problems fall into three bins:

   - Prelude no longer exports catch, so a lot of import Prelude hiding
   (catch) had to change.
   - The FFI now requires constructors to be visible, so CInt has to be
   imported as CInt(..).
   - bytestring finally got bumped to 0.10, so many upper bounds had to be
   relaxed (*cf* my suggestion that the upper-bounds-by-default policy is
   destructive).

It has been a lot of work to test 29 packages, and then modify, rebuild,
and release 20 of them. It has consumed most of my limited free time for
almost two weeks. Worse, this has felt like make-work, of no practical
benefit to anyone beyond scrambling to restore the status quo ante.

If over half of my packages needed fixing, I'm alarmed at the thought of
the effects on the rest of Hackage.

I'm torn over this. I understand and agree with the impetus to improve the
platform by tidying things up, and yet just two seemingly innocuous changes
(catch and FFI) have forced me to do a bunch of running to stand still.

I don't have any suggestions about what to do; I know that it's hard to
estimate the downstream effects of what look like small changes. And so I'm
not exactly complaining. Call this an unhappy data point.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe