Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-26 Thread Siraaj Khandkar
On 07/23/2013 03:37 PM, i c wrote: let's consider the following: let fd = Unix.open ... let fd = Unix.open ... At this point one file descriptor cannot be closed. Static analysis will have trouble catching these bugs, so do humans. Disallowing variable shadowing prevents this. The two fd occur

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-26 Thread Andreas Abel
Mmh, true, for polymorphic definitions there is not a lot to see. This probably diminishes the applicability of a strictness analysis quite a bit. Maybe it is entirely useless at this point. It would make more sense after whole-program optimization. Ghc does not have this, I heard the

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-26 Thread Andreas Abel
On 25.07.2013 09:09, o...@okmij.org wrote: Here is a snippet from a real code that could benefit from non-recursive let. The example is notable because it incrementally constructs not one but two structures (both maps), ast and headers. The maps are constructed in a bit interleaved fashion, and

[Haskell-cafe] Are type families really this slow, or is this a GHC bug?

2013-07-26 Thread Mike Izbicki
I'm using the TypeFamilies extension to generate types that are quite large. GHC can handle these large types fine when they are created manually, but when type families get involved, GHC's performance dies. It's doing in quadratic time what looks to me like it should be linear time. I don't

Re: [Haskell-cafe] Are type families really this slow, or is this a GHC bug?

2013-07-26 Thread Jan Stolarek
I don't know much about type families, but I recall this: http://ghc.haskell.org/trac/ghc/ticket/5321 The bug is marked as fixed, but perhaps behaviour you observed shows that there are other cases where constraqint solver is slow. I'd consider reporting this as GHC bug. Janek

[Haskell-cafe] Rank N Kinds

2013-07-26 Thread Wvv
It was discussed a bit here: http://ghc.haskell.org/trac/ghc/ticket/8090 Rank N Kinds: Main Idea is: If we assume an infinite hierarchy of classifications, we have True :: Bool :: * :: ** :: *** :: :: ... Bool = False, True, ... * = Bool, Sting, Maybe Int, ... **= *,

[Haskell-cafe] Sneaky method for var-arg fns?

2013-07-26 Thread Micah Cowan
So, just for fun, I came up with a way to abuse the language in order to define a function whose argument is optional: -- dirty-trick.hs - A sneaky way to do var args fns in Haskell {-# LANGUAGE FlexibleInstances #-} class Hello a where hello :: a instance Hello (String - String)

Re: [Haskell-cafe] Sneaky method for var-arg fns?

2013-07-26 Thread Tikhon Jelvis
Take a look at Text.Printf which takes this idea even further with its printf function, which can accept an arbitrary number of arguments. This is achieved by basically using your approach but with a recursive instance. On Jul 26, 2013 10:10 PM, Micah Cowan mi...@cowan.name wrote: So, just for

Re: [Haskell-cafe] Sneaky method for var-arg fns?

2013-07-26 Thread Mateusz Kowalczyk
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 26/07/13 22:08, Micah Cowan wrote: So, just for fun, I came up with a way to abuse the language in order to define a function whose argument is optional: -- dirty-trick.hs - A sneaky way to do var args fns in Haskell {-# LANGUAGE

Re: [Haskell-cafe] Sneaky method for var-arg fns?

2013-07-26 Thread Brandon Allbery
On Fri, Jul 26, 2013 at 5:08 PM, Micah Cowan mi...@cowan.name wrote: I was wondering if there was a way to do it in pure Haskell (i.e., no GHC pragmas required), and also the specific reason for why the above example doesn't work without the pragma (I think it's just that in general a - b is

Re: [Haskell-cafe] Are type families really this slow, or is this a GHC bug?

2013-07-26 Thread Mike Izbicki
Thanks for pointing to that ticket. At first after reading through it, I thought my mistake was not using tail call recursion. But I updated the type families and they actually ran slower! I've gone ahead and reported a bug: http://ghc.haskell.org/trac/ghc/ticket/8095 On Fri, Jul 26, 2013 at