Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread Stephen Tetley
In general you can't do this whether you use pats of QuickCheck or not - `randomEvalute` would need to inspect the supplied function to see how many input parameters it has so it can list them, but there is no such introspection in Haskell. ___

Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread Roman Cheplyaka
* Stephen Tetley stephen.tet...@gmail.com [2013-01-13 08:49:08+] In general you can't do this whether you use pats of QuickCheck or not - `randomEvalute` would need to inspect the supplied function to see how many input parameters it has so it can list them, but there is no such

Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread Stephen Tetley
Yes - I was just checking the first QuickCheck paper to see how the authors did this. You would need a new type class that works like `Testable` and the versions of associated machinery `forAll` and `evaluate` to unroll function application. On 13 January 2013 09:28, Roman Cheplyaka

Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread satvik chauhan
I have a working code of this but for that I have to reimplement Arbitrary and Testable typeclasses which I don't want to do. I thought it might be possible to use parts of quickcheck without actually changing its code but still I am unable to find a suitable solution. -Satvik On Sun, Jan 13,

[Haskell-cafe] Where is the convergence point between Category Theory and Haskell?

2013-01-13 Thread Alfredo Di Napoli
Morning Cafe, I'm planning to do a series of write-ups about Category Theory, to publish them on the company's blog I'm currently employed. I'm not a CT expert, but since the best way to learn something is to explain it to others, I want to take a shot :) In my mind I will structure the posts

Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread Bob Ippolito
I think it's more complicated because he doesn't know what the return type or arity of the function is. In QuickCheck they know the return type of a property is Bool. In this case, we only know that the return type is an instance of Show. I don't think that's enough to simply implement this. On

Re: [Haskell-cafe] Generating random arguments for a function

2013-01-13 Thread Joachim Breitner
Hi, Am Sonntag, den 13.01.2013, 07:34 -0800 schrieb Bob Ippolito: I think it's more complicated because he doesn't know what the return type or arity of the function is. In QuickCheck they know the return type of a property is Bool. In this case, we only know that the return type is an

Re: [Haskell-cafe] Where is the convergence point between Category Theory and Haskell?

2013-01-13 Thread Alexander Solla
There was a conversation on the cafe about this last month. Check out: https://groups.google.com/forum/#!topic/haskell-cafe/tBO2AowUvMY Category theory is a language of composition. In logical terms, different categories are models of different axioms. That said, a rich enough category is

Re: [Haskell-cafe] Where is the convergence point between Category Theory and Haskell?

2013-01-13 Thread Alfredo Di Napoli
Thank you Alexander for the reply. My wondering is: is Hask a category created by Haskell researchers or was something already present in literature? Cheers, A. On 13 January 2013 17:44, Alexander Solla alex.so...@gmail.com wrote: There was a conversation on the cafe about this last month.

[Haskell-cafe] Advice on type families and non-injectivity?

2013-01-13 Thread Conal Elliott
I sometimes run into trouble with lack of injectivity for type families. I'm trying to understand what's at the heart of these difficulties and whether I can avoid them. Also, whether some of the obstacles could be overcome with simple improvements to GHC. Here's a simple example: {-# LANGUAGE

Re: [Haskell-cafe] Advice on type families and non-injectivity?

2013-01-13 Thread Iavor Diatchki
Hello Conal, The issue with your example is that it is ambiguous, so GHC can't figure out how to instantiate the use of `foo`. It might be easier to see why this is if you write it in this form: foo :: (F a ~ b) = b foo = ... Now, we can see that only `b` appears on the RHS of the `=`, so

Re: [Haskell-cafe] Advice on type families and non-injectivity?

2013-01-13 Thread Conal Elliott
Hi Iavor, Thanks for the remarks. so there is really no way for GHC to figure out what is the intended value for `a`. Indeed. Though I wonder: does the type-checker really need to find a binding for `a` in this case, i.e., given the equation `(forall a. F a) == (forall a'. F a')`? -- Conal

Re: [Haskell-cafe] Advice on type families and non-injectivity?

2013-01-13 Thread Conal Elliott
Hi Christian, Given bar :: Bool, I can't see how one could go from Bool to F a = Bool and determine a uniquely. The same question applies to foo :: Bool, right? Yet no error message there. Regards, - Conal On Sun, Jan 13, 2013 at 11:36 AM, Christian Höner zu Siederdissen

[Haskell-cafe] cabal sdist warns about optimization levels

2013-01-13 Thread Petr P
Hi all, I'm working on a library for fast sorting of MArrays. The library is primarily about speed, so I added ghc-options: -O2 to the cabal file. Now cabal sdist complains with: 'ghc-options: -O2' is rarely needed. Check that it is giving a real benefit and not just imposing longer

Re: [Haskell-cafe] Advice on type families and non-injectivity?

2013-01-13 Thread Iavor Diatchki
Hello, On Sun, Jan 13, 2013 at 12:05 PM, Conal Elliott co...@conal.net wrote: so there is really no way for GHC to figure out what is the intended value for `a`. Indeed. Though I wonder: does the type-checker really need to find a binding for `a` in this case, i.e., given the equation

[Haskell-cafe] Repa: traverse delayed array multiple times

2013-01-13 Thread Andrey Yankin
Greetings to all! Currently I'm trying to do physical simulations using finite difference method. To accomplish this I need to repeat some manipulations on 2-dimensional grid several thousands or millions times, you know. Is it possible to do using repa? I wrote this rough sketch that shows what

Re: [Haskell-cafe] Advice on type families and non-injectivity?

2013-01-13 Thread Jake McArthur
I have a trick that loses a little convenience, but may still be more convenient than data families. {-# LANGUAGE TypeFamilies #-} import Data.Tagged type family F a foo :: Tagged a (F a) foo = Tagged undefined bar :: Tagged a (F a) bar = foo This allows you to use the same newtype wrapper

Re: [Haskell-cafe] cabal sdist warns about optimization levels

2013-01-13 Thread Daniel Fischer
On Sunday 13 January 2013, 21:27:44, Petr P wrote: I wonder: (1) Is there a way how to disable the warning? As the main aim of the library is speed, I believe -O2 is appropriate here. And since the code is quite short, I'm quite sure the increased compile time won't be noticeable. (2)

Re: [Haskell-cafe] cabal sdist warns about optimization levels

2013-01-13 Thread Duncan Coutts
On 13 January 2013 20:27, Petr P petr@gmail.com wrote: to the cabal file. Now cabal sdist complains with: 'ghc-options: -O2' is rarely needed. Check that it is giving a real benefit and not just imposing longer compile times on your users. I wonder: (1) Is there a way how to

Re: [Haskell-cafe] Where is the convergence point between Category Theory and Haskell?

2013-01-13 Thread wren ng thornton
On 1/13/13 12:44 PM, Alexander Solla wrote: Hask is a very rich category, and is suitable for encoding a lot (but not all) of category theory. As far as I know, the actual boundary is as yet unknown. I'm not sure that's the most appropriate way to render things. In general, rich categories

Re: [Haskell-cafe] Where is the convergence point between Category Theory and Haskell?

2013-01-13 Thread wren ng thornton
On 1/13/13 1:53 PM, Alfredo Di Napoli wrote: Thank you Alexander for the reply. My wondering is: is Hask a category created by Haskell researchers or was something already present in literature? Hask was created by Haskellers in discussions on blogs etc. If one is being particular about the

Re: [Haskell-cafe] Where is the convergence point between Category Theory and Haskell?

2013-01-13 Thread Christopher Howard
On 01/13/2013 03:15 AM, Alfredo Di Napoli wrote: Morning Cafe, I'm planning to do a series of write-ups about Category Theory, to publish them on the company's blog I'm currently employed. I'm not a CT expert, but since the best way to learn something is to explain it to others, I want to

Re: [Haskell-cafe] Advice on type families and non-injectivity?

2013-01-13 Thread wren ng thornton
On 1/13/13 3:52 PM, Iavor Diatchki wrote: On Sun, Jan 13, 2013 at 12:05 PM, Conal Elliott co...@conal.net wrote: so there is really no way for GHC to figure out what is the intended value for `a`. Indeed. Though I wonder: does the type-checker really need to find a binding for `a` in this

[Haskell-cafe] Announce: Leksah 0.13.1.2 now 100% Gtk3 (still a bit experimental though)

2013-01-13 Thread Hamish Mackenzie
I used the MinGW32 RPMs included in Fedora to get Gtk3 working on Windows. So no more Gtk2 unless you really want it (in which case use -f-gtk3 when building). Issue with Pane - HLint not working in the binary versions should be fixed with these too. OS X Choose the version that matches