Re: Two Proposals

2011-10-09 Thread Jan-Willem Maessen
2011/10/5 Simon Peyton-Jones : > |  In the spirit of "don't let the perfect be the enemy of the good" > |  though, I'm solidly in favor of the original proposal as it is. > > This is my thought too.  George is proposing to extend Haskell's existing > mechanism for numeric literals (namely, replace

Re: Unwanted eta-expansion

2011-10-09 Thread Jan-Willem Maessen
On Sun, Oct 9, 2011 at 10:54 AM, Roman Cheplyaka wrote: > * Jan-Willem Maessen [2011-10-08 12:32:18-0400] >> It seems to be a common misconception that eta-abstracting your >> functions in this way will speed up or otherwise improve your code. >> >> Simon PJ has already provided a good explanatio

Re: Two Proposals

2011-10-09 Thread George Giorgidze
On Oct 6, 2011, at 10:30 AM, Roman Leshchinskiy wrote: > Manuel M T Chakravarty wrote: >> Roman Leshchinskiy: >>> >>> What data structures other than lists do we want to construct using list >>> literals? I'm not really sure what the use cases are. >> >> Parallel arrays! (I want to get rid of o

Re: Two Proposals

2011-10-09 Thread George Giorgidze
Thanks to all of you for providing feedback on my proposal and for providing alternatives. In this email, I will try to collect all proposals and give pros and cons for each of those (although I will try to provide a good argumentation, some of them might be subjective). Inspired by Simon's an

Re: Is this a concurrency bug in base?

2011-10-09 Thread David Brown
On Sun, Oct 09, 2011 at 03:30:20PM +0200, Jean-Marie Gaillourdet wrote: Hi Daniel, On 09.10.2011, at 14:45, Daniel Fischer wrote: On Sunday 09 October 2011, 13:52:47, Jean-Marie Gaillourdet wrote: This seems to be a Heisenbug as it is extremely fragile, when adding a "| grep 1" to the while l

Re: log time instead of linear for case matching

2011-10-09 Thread Edward Z. Yang
Excerpts from Greg Weber's message of Sun Oct 09 12:39:03 -0400 2011: > So first of all I am wondering if a sum type comparison does in fact scale > linearly or if there are optimizations in place to make the lookup constant > or logarithmic. Second, I as wondering (for the routing case) if Haskell

log time instead of linear for case matching

2011-10-09 Thread Greg Weber
We have a couple use cases in Yesod that can potentially match many different patterns. Routing connects the url of an http request to a Haskell function. The current code just uses a pattern match, which scales linearly. So if a site has a hundred different routes (urls), it could take 100 compari

Re: Is this a concurrency bug in base?

2011-10-09 Thread Jean-Marie Gaillourdet
On 09.10.2011, at 18:13, Daniel Fischer wrote: > On Sunday 09 October 2011, 17:51:06, Jean-Marie Gaillourdet wrote: >>> That sounds plausible. Do you see any workaround? Perhaps repeatedly >>> evaluating typeOf? >> >> typeOf' seems to be a working workaround: >> >> typeOf' val >>| t1 == t2

Re: Is this a concurrency bug in base?

2011-10-09 Thread Daniel Fischer
On Sunday 09 October 2011, 17:51:06, Jean-Marie Gaillourdet wrote: > > That sounds plausible. Do you see any workaround? Perhaps repeatedly > > evaluating typeOf? > > typeOf' seems to be a working workaround: > > typeOf' val > | t1 == t2 = t1 > | otherwise = typeOf' val > where > t

Re: Is this a concurrency bug in base?

2011-10-09 Thread Jean-Marie Gaillourdet
On 09.10.2011, at 17:56, wagne...@seas.upenn.edu wrote: > Quoting Jean-Marie Gaillourdet : > >> That sounds plausible. Do you see any workaround? Perhaps repeatedly >> evaluating typeOf? > > If there's a concurrency bug, surely the workaround is to protect calls to > the non-thread-safe funct

Re: "case" of an empty type should have no branches

2011-10-09 Thread Roman Beslik
On 09.10.11 15:45, Felipe Almeida Lessa wrote: On Sun, Oct 9, 2011 at 8:26 AM, Roman Beslik wrote: Why the following code does not work? data Empty quodlibet :: Empty -> a quodlibet x = case x of "parse error (possibly incorrect indentation)" Works for me: data Empty quodlibet :: Em

Re: Is this a concurrency bug in base?

2011-10-09 Thread wagnerdm
Quoting Jean-Marie Gaillourdet : That sounds plausible. Do you see any workaround? Perhaps repeatedly evaluating typeOf? If there's a concurrency bug, surely the workaround is to protect calls to the non-thread-safe function with a lock. typeOfWorkaround lock v = do () <- take

Re: Is this a concurrency bug in base?

2011-10-09 Thread Jean-Marie Gaillourdet
Hi, On 09.10.2011, at 17:37, Jean-Marie Gaillourdet wrote: > Hi, > > On 09.10.2011, at 17:27, Daniel Fischer wrote: > >> That's what I expect. >> I think what happens is: >> >> -- from Data.Typeable >> >> cache = unsafePerformIO $ ... >> >> >> mkTyConKey :: String -> Key >> mkTyConKey str

Re: Is this a concurrency bug in base?

2011-10-09 Thread Jean-Marie Gaillourdet
Hi, On 09.10.2011, at 17:27, Daniel Fischer wrote: > Jean-Marie Gaillourdet: >> the Eq instance of TypeRep shows the same non-deterministic behavior: > > Of course, equality on TypeReps is implemented by comparison of the Keys. > > On Sunday 09 October 2011, 16:40:13, Jean-Marie Gaillourdet wro

Re: Is this a concurrency bug in base?

2011-10-09 Thread Daniel Fischer
Jean-Marie Gaillourdet: > the Eq instance of TypeRep shows the same non-deterministic behavior: Of course, equality on TypeReps is implemented by comparison of the Keys. On Sunday 09 October 2011, 16:40:13, Jean-Marie Gaillourdet wrote: > Hi Daniel, > I've been chasing the source of the non-dete

Re: Is this a concurrency bug in base?

2011-10-09 Thread Jean-Marie Gaillourdet
On 09.10.2011, at 16:40, Jean-Marie Gaillourdet wrote: > I will report a bug. http://hackage.haskell.org/trac/ghc/attachment/ticket/5540/ ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/

Re: Unwanted eta-expansion

2011-10-09 Thread Roman Cheplyaka
* Jan-Willem Maessen [2011-10-08 12:32:18-0400] > It seems to be a common misconception that eta-abstracting your > functions in this way will speed up or otherwise improve your code. > > Simon PJ has already provided a good explanation of why GHC eta > expands. Let me take another tack and desc

Re: Is this a concurrency bug in base?

2011-10-09 Thread Jean-Marie Gaillourdet
Hi Daniel, On 09.10.2011, at 16:24, Daniel Fischer wrote: > On Sunday 09 October 2011, 15:30:20, Jean-Marie Gaillourdet wrote: >> Hi Daniel, >> >> On 09.10.2011, at 14:45, Daniel Fischer wrote: >>> On Sunday 09 October 2011, 13:52:47, Jean-Marie Gaillourdet wrote: This seems to be a Heise

Re: Is this a concurrency bug in base?

2011-10-09 Thread Jean-Marie Gaillourdet
Hi, the Eq instance of TypeRep shows the same non-deterministic behavior: import Control.Concurrent import Control.Exception import Control.Monad import Data.Typeable main :: IO () main = do { fin1 <- newEmptyMVar ; fin2 <- newEmptyMVar ; forkIO $ return (typeOf ()) >>= evaluate >>= pu

Re: Is this a concurrency bug in base?

2011-10-09 Thread Daniel Fischer
On Sunday 09 October 2011, 15:30:20, Jean-Marie Gaillourdet wrote: > Hi Daniel, > > On 09.10.2011, at 14:45, Daniel Fischer wrote: > > On Sunday 09 October 2011, 13:52:47, Jean-Marie Gaillourdet wrote: > >> This seems to be a Heisenbug as it is extremely fragile, when adding > >> a "| grep 1" to t

Re: Is this a concurrency bug in base?

2011-10-09 Thread Jean-Marie Gaillourdet
Hi Daniel, On 09.10.2011, at 14:45, Daniel Fischer wrote: > On Sunday 09 October 2011, 13:52:47, Jean-Marie Gaillourdet wrote: >> This seems to be a Heisenbug as it is extremely fragile, when adding a >> "| grep 1" to the while loop it seems to disappears. At least on my >> computers. > > Still

Re: Is this a concurrency bug in base?

2011-10-09 Thread Daniel Fischer
On Sunday 09 October 2011, 13:52:47, Jean-Marie Gaillourdet wrote: > This seems to be a Heisenbug as it is extremely fragile, when adding a > "| grep 1" to the while loop it seems to disappears. At least on my > computers. Still produces 1s here with a grep. > > All this was done on several Mac

Re: "case" of an empty type should have no branches

2011-10-09 Thread Felipe Almeida Lessa
On Sun, Oct 9, 2011 at 8:26 AM, Roman Beslik wrote: > Why the following code does not work? >> data Empty >> quodlibet :: Empty -> a >> quodlibet x = case x of > "parse error (possibly incorrect indentation)" Works for me: data Empty quodlibet :: Empty -> a quodlibet x = case x of _ -> un

Is this a concurrency bug in base?

2011-10-09 Thread Jean-Marie Gaillourdet
Hi, I am working on a library I'd like to release to hackage very soon, but I've found a problem with supporting GHC 6.12 and GHC 7.0. Consider the following program: import Control.Concurrent import Data.Typeable main :: IO () main = do { fin1 <- newEmptyMVar ; fin2 <- newEmptyMVar

"case" of an empty type should have no branches

2011-10-09 Thread Roman Beslik
Hi. Why the following code does not work? > data Empty > quodlibet :: Empty -> a > quodlibet x = case x of "parse error (possibly incorrect indentation)" This works in Coq, for instance. Demand for empty types is not big, but they are useful for generating finite types: > Empty ≅ {} > Maybe Em