[Haskell-cafe] Cabal --enable-tests
Hi cafe, I wanted to ask this as I couldn't find this in cabal documentation. Is there any CCP macro set when a package is configured with --enable-testing? If not is there a way to do that? -Satvik ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Applicative is like an Arrow
Whenever I am confused I refer to this article http://www.haskell.org/haskellwiki/Typeclassopedia#Arrow -Satvik On Fri, Aug 16, 2013 at 7:34 PM, Thiago Negri evoh...@gmail.com wrote: I just stumbled upon the Applicative term. Arrows are quite difficult for me to understand at the moment. I guess it needs time to digest. But, as I understand so far, Applicative and Arrows looks like the same thing. Please, enlight me. ___ 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
[Haskell-cafe] ForeignPtr and Garbage Collection
Hi Cafe, Is it guaranteed that the value of `ForeignPtr` will not be changed (for example due to compaction etc) by haskell garbage collector until it goes out of scope and finalizer is run. -Satvik ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] GHC API wiki update
I was playing with the GHC api and found that examples on the GHC wiki don't seem to work with GHC 7.6.1. Does anybody have the updated examples of the same? Regards, Satvik ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Need urgent help with Network.tls
You can use HaskellNet http://hackage.haskell.org/package/HaskellNet or imapget http://hackage.haskell.org/package/imapget directly or look into their source code for connecting to imap manually. -Satvik On Sat, Feb 23, 2013 at 8:58 PM, C K Kashyap ckkash...@gmail.com wrote: Hi, I am trying to use Haskell to download email/attachments from gmail. For which I am exploring Network.TLS. I got this sample from the net that connects to gmail smtp and works just fine - http://hpaste.org/82890 However, when I modify it a bit to try to connect to imap, it simply does not work. To debug, I tried to connect to a webserver, even that seems to not work. I modified the function as follows. emailGmail2 = do let host = localhost let port = 443 let params = defaultParamsClient{pCiphers = ciphers} g - RNG.makeSystem h - connectTo host (PortNumber (fromIntegral port)) hSetBuffering h LineBuffering cWrite h GET / HTTP/1.0 cWrite h cWaitFor h ABCD con - contextNewOnHandle h params g handshake con bye con And I get a BAD request response from the server - Can some please give me a sample code that uses Network.TLS to connect to a imap.google.com(or even a webserver for that matter)? Regards, Kashyap ___ 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] Generating random arguments for a function
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, 2013 at 2:58 PM, Roman Cheplyaka r...@ro-che.info wrote: * 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 introspection in Haskell. This can be done with relatively simple type class hackery. In fact, QuickCheck already does that in order to generate arguments and print them in case of failure. Roman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Generating random arguments for a function
I am trying to use quickcheck to generate random arguments of a given function (assuming all its types have Arbitrary instance and Show instance) along with the evaluation of the function at those arguments. Suppose I have a function add :: Int - Int - Int add a b = a+b Then I assume a behavior like randomEvaluate add ([1,3],4) where 1 and 3 are random values generated for `Int` and 4 is `f 1 3`. I have asked this on SOhttp://stackoverflow.com/questions/14294802/evaluating-function-at-random-arguments-using-quickcheck but am not fully satisfied with the answers. -Satvik ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Proving programs
Which book does that chapter belongs to? -Satvik On Thu, Jan 3, 2013 at 11:44 AM, Andrés Sicard-Ramírez andres.sicard.rami...@gmail.com wrote: On Wed, Jan 2, 2013 at 12:22 PM, Simon Thompson s.j.thomp...@kent.ac.uk wrote: Christopher, there's an introduction to proof for functional programs at http://www.cs.kent.ac.uk/people/staff/sjt/Pubs/ProofChapter.pdf Simon, is it possible to get the list of the bibliographic references used in the chapter? Best regards, -- Andrés ___ 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] Non polymorphic numerals option -- avoiding type classes
I don't know about the RebindableSyntax extension. But Prelude :t [[1,2],3] [[1,2],3] :: (Num [t], Num t) = [[t]] The above only says that is is possible to have a list like [[1,2],3] if you have for a Num t, [t] is also an instance of Num. But it doesn't guarantee the existence of such an instance. When you actually execute the code then you see that no such instance exists by default. -Satvik ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Template Haskell Splicing
On Sat, Dec 15, 2012 at 1:30 PM, Michael Sloan mgsl...@gmail.com wrote: I don't think that there is a particular reason for not supporting quasi-quotes in where clauses.. It should be added! The reason for /splices/ to not be supported in here statements is that they are run during type checking. That way calls to reify can access type information for things before your splice. It also allows checking any AST quotes used inside your splice. Since type-checking comes after renaming, splices can't be used in patterns (because it would affect the lexical scope). Quasi-quotes, on the other hand, are run in the renamer, and ought to be able to be used in where clauses. Yet for some reason they can't - I get parse error (possibly incorrect indentation or mismatched brackets) when I try to put one under a where. Good catch! -Michael Yeah, that is the problem. I have a function inside which I need to generate some declarations using TH. I can not generate these at the top level as these generations depend on the function's parameters which are local to the function. Something like f p1 p2= ... where -- this has to be generated by TH g_1 = p1 g_2 = p2 g_3 = p1 `xor` p2 something like the above. In the above I have shown only 2 parameters but in my case it is much more. I am able to get the above splice as toplevel declaration but I am still unsuccessful in getting it inside the where. I can always make `g` a function and take parameters of `f` as arguments in the top level splice but that will defeat the purpose of optimization here(which I am trying to do), as that would result in a function call every time I use `g` instead of above variables. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Template Haskell Splicing
Is there any way to splice declarations inside where? If not, then what is the reason for not supporting this? -Satvik ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How Type inference work in presence of Functional Dependencies
Consider the code below : {-# LANGUAGE MultiParamTypeClasses,FlexibleInstances,FunctionalDependencies,UndecidableInstances,FlexibleContexts #-} class Foo a c | a - c instance Foo Int Float f :: (Foo Int a) = Int - a f = undefined Now when I see the inferred type of f in ghci :t f f :: Int - Float Now If I add the following code g :: Int - Float g = undefined h :: (Foo Int a) = Int - a h = g I get the error Could not deduce (a ~ Float) I am not able to understand what has happened here ? The restriction Foo Int a should have restricted the type of h to Int - Float as shown in the inferred type of f. - Satvik ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] OpenShift a free PaaS from RedHat
OpenShift gives access to Linux virtual machines on the cloud. However, we do not have root access so we cannot install any new package. I was trying to get my haskell code compiled into native on my local linux box and taking it to those machines. That does not seem to work because of two things - 1. GLIBC version mismatch 2. libgmp missing on the openshift box Regards, Kashyap I think you might want to check out CDE. http://www.pgbovine.net/cde.html This will take care of the version mismatch of the libraries. - Satvik ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Testing Concurrent Programs
How do you test concurrent programs in which you actually have to test over all possible interleaving schedules by the scheduler . Is this possible to do with quickcheck . Thanks , Satvik ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe