Re: [Haskell-cafe] Non-recursive let [Was: GHC bug? Let with guards loops]

2013-07-12 Thread Andreas Abel
On 12.07.2013 02:22, Richard A. O'Keefe wrote: For what it's worth, let x = 1 in - let x = x+1 in - let x = x+2 in - x;; prints val it : int = 4 in the F# interactive system, but let x = 1 in - let x = x+1 in - let x = x+2 in - x;; prints Duplicate definition of x at the

[Haskell-cafe] Quick-check: how to generate arbitrary complex data?

2013-07-12 Thread martin
Hello all, I have a type (Mail) which consists of hash and a list, where the hash keeps some redundant data of the list for faster access. I can add and remove elements to values of this type using custom functions, called push and pop. Now I wanted to write some quick checks, but I have no clue

Re: [Haskell-cafe] Quick-check: how to generate arbitrary complex data?

2013-07-12 Thread Roman Cheplyaka
* martin martin.drautzb...@web.de [2013-07-12 08:33:54+0200] Hello all, I have a type (Mail) which consists of hash and a list, where the hash keeps some redundant data of the list for faster access. I can add and remove elements to values of this type using custom functions, called push

Re: [Haskell-cafe] How to use cabal-dev ghci and multiple targets/build-depends from cabal file?

2013-07-12 Thread Kirill Zaborsky
It looks like cabal repl [1] could solve this kind of problems, but it is not clear when it will be merged in cabal HEAD. [1] https://github.com/haskell/cabal/issues/375 KInd regards, Kirill Zaborsky четверг, 11 июля 2013 г., 15:55:15 UTC+4 пользователь Kirill Zaborsky написал: Currently

Re: [Haskell-cafe] Comparing functions

2013-07-12 Thread Vlatko Basic
Thanks Roman. Tried it and implemented, but had troubles until I realized that for String, 10 test take quite long. :-) However, I decided to solve this problem in a more natural way Original Message Subject: Re: [Haskell-cafe] Comparing functions From: Roman Cheplyaka

[Haskell-cafe] Deriving with generics without values

2013-07-12 Thread JP Moresmau
Hello all, My problem is the following: I have my own data types, and I'd like to derive automatically instances of some type class from them. I've started looking at GHC.Generics, which offer tools to do exactly that. However, some functions of my typeclass do not take my data type as a

Re: [Haskell-cafe] Deriving with generics without values

2013-07-12 Thread Roman Cheplyaka
Well, in your case, you need not 'from', but 'to', in order to convert from a generic representation to yours. Take a look at how a similar task is done in SmallCheck: https://github.com/feuerbach/smallcheck/blob/master/Test/SmallCheck/Series.hs#L180

Re: [Haskell-cafe] Deriving with generics without values

2013-07-12 Thread JP Moresmau
Yes, this looks like a similar task, thanks a million! JP On Fri, Jul 12, 2013 at 10:57 AM, Roman Cheplyaka r...@ro-che.info wrote: Well, in your case, you need not 'from', but 'to', in order to convert from a generic representation to yours. Take a look at how a similar task is done in

[Haskell-cafe] Reify type

2013-07-12 Thread Jose A. Lopes
Hello everyone, Is there a way to automatically reify a type ? In other words, to do the following: reifyType (LitT ...) = ConT ''LitT ... I am using Template Haskell and I want the generated code to have access to Type datatypes that were available to the Template Haskell code. Cheers, Jose

Re: [Haskell-cafe] Reify type

2013-07-12 Thread Michael Sloan
Hello! I'm not sure if this is what you're asking for, as it doesn't fit that line of code. 'LitT' is a data constructor not a type constructor. So instead it'd be reifyType (LitT ...) = ConE 'LitT ... If this is what you're looking for, then 'lift' is what you want:

Re: [Haskell-cafe] Reify type

2013-07-12 Thread Jose A. Lopes
That's exactly what I mean! I'll give it a try. Thanks Michael, Jose ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Reify type

2013-07-12 Thread Jose A. Lopes
Hello, I am getting the following error message: No instance for (Lift Type) arising from a use of `lift' Possible fix: add an instance declaration for (Lift Type) I have imported Language.Haskell.TH.Instances. Is there anything else I have to do ? Regards, Jose

Re: [Haskell-cafe] Reify type

2013-07-12 Thread Michael Sloan
You might need to cabal update - I recently uploaded a new version to hackage, because I realized the package was a bit out of date from the github repo. It works for me: https://gist.github.com/mgsloan/f9238b2272df43e53896 On Fri, Jul 12, 2013 at 5:49 AM, Jose A. Lopes jabolo...@google.com

Re: [Haskell-cafe] Correct way to catch all exceptions

2013-07-12 Thread Michael Snoyman
When I implemented this stuff yesterday, I included `Deep` variants for each function which used NFData. I'm debating whether I think the right recommendation is to, by default, use the `async`/NFData versions of catch, handle, and try, or to have them as separate functions. I wrote up the blog

[Haskell-cafe] getting haddock to cooperate with cpp

2013-07-12 Thread Evan Laforge
So haddock ignores {-# LANGUAGE CPP #-}, which makes it crash on any file that uses it. But if you pass --optghc=-cpp, it runs CPP on everything, which makes it crash on any file that uses string gaps, or happens to contain a /*. /* is rare and easily fixed, but not string gaps. It looks like a

Re: [Haskell-cafe] getting haddock to cooperate with cpp

2013-07-12 Thread Brandon Allbery
On Fri, Jul 12, 2013 at 2:25 PM, Evan Laforge qdun...@gmail.com wrote: In the broader scheme, it seems perverse to be using CPP in the first place. I use it to configure imports and exports, e.g. to swap out a driver backend on different OSes, and to export more symbols when testing. Would

Re: [Haskell-cafe] getting haddock to cooperate with cpp

2013-07-12 Thread Roman Cheplyaka
* Evan Laforge qdun...@gmail.com [2013-07-12 14:25:00-0400] So haddock ignores {-# LANGUAGE CPP #-}, which makes it crash on any file that uses it. I'm pretty sure it's not true in general. If you click on the Source link at this haddock page:

Re: [Haskell-cafe] getting haddock to cooperate with cpp

2013-07-12 Thread Felipe Almeida Lessa
Are you using `cabal haddock` or calling haddock manually? Cheers, On Fri, Jul 12, 2013 at 3:25 PM, Evan Laforge qdun...@gmail.com wrote: So haddock ignores {-# LANGUAGE CPP #-}, which makes it crash on any file that uses it. But if you pass --optghc=-cpp, it runs CPP on everything, which

Re: [Haskell-cafe] getting haddock to cooperate with cpp

2013-07-12 Thread Evan Laforge
I'm calling haddock myself. Cabal might have some special magic for CPP, when I searched for haddock CPP I got some old bugs about adding cabal support. So presumably it's possible. On Jul 12, 2013 1:15 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: Are you using `cabal haddock` or

Re: [Haskell-cafe] getting haddock to cooperate with cpp

2013-07-12 Thread Felipe Almeida Lessa
I guess that cabal preprocesses the files before calling Haddock then. Perhaps that's why it asks me to `cabal configure` before `cabal haddock`ing =). If you're able to switch over to cabal, that may be the easiest solution. Cheers, On Fri, Jul 12, 2013 at 6:31 PM, Evan Laforge