Re: [Haskell-cafe] Indenting with PPrint

2007-05-08 Thread Joel Reymont
Brandon, On May 8, 2007, at 12:33 AM, Brandon Michael Moore wrote: braces x = group (PP. braces (nest 4 (linebreak x) linesbreak) I ended up with the following: nest = PP.nest 4 braces x = nest (lbrace $ x) $ rbrace If you happen to be formatting C I've also worked out how to get nice

[Haskell-cafe] Co-arbitrary

2007-05-08 Thread Joel Reymont
Would someone kindly explain why we need co-arbitrary in QuickCheck and how to define it? Detailed examples would be awesome! I would be willing to paste an in-depth explanation on my wall and keep it forever. Thanks in advance, Joel -- http://wagerlabs.com/

Re: [Haskell-cafe] Co-arbitrary

2007-05-08 Thread Donald Bruce Stewart
joelr1: Would someone kindly explain why we need co-arbitrary in QuickCheck and how to define it? Generating random function generators. A nice explanation was given recently on the programming subreddit: The CoArbitrary class continues to confuse me

Re: [Haskell-cafe] Co-arbitrary

2007-05-08 Thread Malcolm Wallace
Joel Reymont [EMAIL PROTECTED] writes: Would someone kindly explain why we need co-arbitrary in QuickCheck and how to define it? Ever written a higher-order function and wanted to quickcheck it? So where do you get your random functional arguments from? Whereas the 'arbitrary' method allows

Re[2]: [Haskell-cafe] The Trivial Monad

2007-05-08 Thread Bulat Ziganshin
Hello Ketil, the whole monadic business was introduced with the sole goal to let haskellers believe that they are smarter than other programmers :) Or perhaps to ensure that they are? you mean Darwin's idea of natural selection? :) -- Best regards, Bulat

[Haskell-cafe] QuickCheck invariants for AST transformations

2007-05-08 Thread Joel Reymont
I'm looking for suggestions on how to create invariants for the following AST transformation code. Any suggestions are appreciated! I asked this question before and Lennart suggested abstract interpretation as a solution. This would require interpreters for both ASTs to determine that the

Re: [Haskell-cafe] Co-arbitrary

2007-05-08 Thread Bjorn Bringert
On May 8, 2007, at 9:33 , Joel Reymont wrote: Would someone kindly explain why we need co-arbitrary in QuickCheck and how to define it? Detailed examples would be awesome! I would be willing to paste an in-depth explanation on my wall and keep it forever. Thanks in advance, Joel

Re: [Haskell-cafe] How to parse a date and time?

2007-05-08 Thread Bjorn Bringert
On May 8, 2007, at 1:04 , Justin Bailey wrote: Looking at the libraries documentation, it seems like parsing a string into a time and date should be as simple as: import Data.Time.Format (parseTime) myDate = parseTime ... where ... is some string. But these functions don't seem to

[Haskell-cafe] Using dump in Netwotk.Pcap

2007-05-08 Thread Harald ROTTER
Dear Haskellers, as a Haskell newbie I really enjoyed Austin Seipp's article on writing a packet sniffer in Haskell using the libpcap. I played around with Network.Pcap and tried to dump packets into a pcap file using the dump function: dump :: Ptr PcapDumpTag - Ptr PktHdr - Ptr Word8 - IO ()

[Haskell-cafe] Re: Listing package dependencies from GHC

2007-05-08 Thread Simon Marlow
Duncan Coutts wrote: On Thu, 2007-05-03 at 16:49 +0200, Thomas Schilling wrote: By dependencies I meant, library packages that GHC knows about. For example, if I load something simple like import System.Posix.Files main = touchFile example into GHCi and execute :main it prints Loading

[Haskell-cafe] How to decrease ghc link time

2007-05-08 Thread Georg Sauthoff
Hi, well, I work with a Haskell project which I regulary compile with ghc. I am a bit unhappy with the link time of the project (i.e. the time ghc needs to link everyting). The project consinst of ~60 Haskell and ~25 foreign files. Some parts of the project are organized like a 'cluster', i.e.

Re: [Haskell-cafe] QuickCheck invariants for AST transformations

2007-05-08 Thread Brandon Michael Moore
On Tue, May 08, 2007 at 10:06:32AM +0100, Joel Reymont wrote: I'm looking for suggestions on how to create invariants for the following AST transformation code. Any suggestions are appreciated! I asked this question before and Lennart suggested abstract interpretation as a solution. This

Re: [Haskell-cafe] Indenting with PPrint

2007-05-08 Thread Brandon Michael Moore
On Tue, May 08, 2007 at 07:39:15AM +0100, Joel Reymont wrote: If you happen to be formatting C I've also worked out how to get nice argument lists out of both pretty printers. I'm formatting C# but I'll certainly take your arg list tips. These narrow like foo (a, b) foo (a, b) foo

[Haskell-cafe] Re: Building the community

2007-05-08 Thread Rick Moen
Back on December 14, Conrad Parker write: On 15/12/06, Nicolas Frisby [EMAIL PROTECTED] wrote: 2) The welcome to the mailing list message could say if you're new to Haskell, please check this FAQ first. I'm talking big letters here; I'd even be OK with marquee. .. hence I'd caution

Re: [Haskell-cafe] Vanishing polymorphism

2007-05-08 Thread David House
On 08/05/07, Matthew Sackman [EMAIL PROTECTED] wrote: :t let f r s = (return negate) = (\(fn::forall n . (Num n) = n - n) - return (fn r, fn s)) in f interactive:1:35: Couldn't match expected type `a - a' against inferred type `forall n. (Num n) = n - n' In the pattern: fn

[Haskell-cafe] Safe forward-mode AD in Haskell?

2007-05-08 Thread Björn Buckwalter
Dear all, = Introduction = In [1] Siskind and Pearlmutter expose the danger of perturbation confusion in forward-mode automatic differentiation. In particular they state: We discuss a potential problem with forward-mode AD common to many AD systems, including all attempts to

[Haskell-cafe] Re: Safe forward-mode AD in Haskell?

2007-05-08 Thread Björn Buckwalter
Oops, that went to soon. My intention was to ask for comments from those who know better than I. These corners of the type system are pretty unknown to me but I am trying to learn from e.g. Oleg's array branding[1]. Anyway, please rip my exposition apart and expose my sure-to-be flawed logic

Re: [Haskell-cafe] Safe forward-mode AD in Haskell?

2007-05-08 Thread David Roundy
On Tue, May 08, 2007 at 06:06:56PM -0400, Björn Buckwalter wrote: We provide a type signature for 'd' where we existentially quantify the phantom type 's' to prevent mixing of bundles from different 'd' operators. d :: Num a = (forall s. Bundle s a - Bundle s a) - a - a d f x = let (Bundle

Re: [Haskell-cafe] Safe forward-mode AD in Haskell?

2007-05-08 Thread David Roundy
On Tue, May 08, 2007 at 05:59:48PM -0700, David Roundy wrote: Couldn't you do the same without branding if you simply made your function polymorphic: data Bundle a = Bundle a a d :: Num a = (forall b. Num b = b - b) - a - a d f x = let (Bundle y y') = f (Bundle x 1) in y' and defined

Re: [Haskell-cafe] Safe forward-mode AD in Haskell?

2007-05-08 Thread David Roundy
Okay, here's an alternate, unbranded approach: data Bundle a = Bundle a a instance Num a = Show (Bundle a) where showsPrec p (Bundle x x') = showsPrec p [x,x'] instance Num a = Eq (Bundle a) where (Bundle x x') == (Bundle y y') = (x == y) instance Num a = Num (Bundle a) where

Re: [Haskell-cafe] Re: Cost of Overloading vs. HOFs

2007-05-08 Thread John Meacham
On Fri, May 04, 2007 at 07:20:03PM -0700, Conal Elliott wrote: [switching to haskell-cafe] thanks for the explanation, John. doesn't the list cases mentioned in the definition of (+) below assume whole program, in order to know all Num instances? Yes it does in the current implementation,