[Haskell-cafe] (Lazy) SmallCheck and peano numbers

2008-06-19 Thread Levi Stephen
Hi, I have the following definitions type Zero type Succ a so that I can muck around with a Vector type that includes its length encoded in its type. I was wondering whether it was possible to use SmallCheck (or QuickCheck) to generate random Peano numbers? Is there an issue here in that what

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-19 Thread Jules Bean
Richard A. O'Keefe wrote: - what you get is a reference to a variable (as you do in Scheme) but loop variables really are variables, not names for values, so lambdas created in different iterations of the same loop point so the same loop variable, and do not remember the value it had

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-19 Thread Richard A. O'Keefe
On 19 Jun 2008, at 5:53 pm, Jules Bean wrote: Richard A. O'Keefe wrote: - what you get is a reference to a variable (as you do in Scheme) but loop variables really are variables, not names for values, so lambdas created in different iterations of the same loop point so the same loop

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-19 Thread Jules Bean
Richard A. O'Keefe wrote: The mutablity of r here really isn't a problem. Nor is the mutability of variables _as such_ really the problem in the PHP proposal. The problem is that it's the *same* variable every time. If PHP loops introduced new bindings on every iteration, this particular

Re: [Haskell-cafe] Meaning of ribbonsPerLine at Text.PrettyPrint.HughesPJ ?

2008-06-19 Thread Alfonso Acosta
On Wed, Jun 18, 2008 at 5:41 PM, Duncan Coutts [EMAIL PROTECTED] wrote: And isn't 100 columns a bit non-standard for a default? I thought 80 columns had more traction? I know that's what my terminals are at... Yeah. I'd vote for 80. That's what we use in pretty printing messages in Cabal.

Re: [Haskell-cafe] Meaning of ribbonsPerLine at Text.PrettyPrint.HughesPJ ?

2008-06-19 Thread Thorkil Naur
Hello, On Wednesday 18 June 2008 22:13, Alfonso Acosta wrote: Hi, Can anyone give a good explanation of what ribbonsPerLine means? Maybe it would be better to simply ask for the meaning of ribbon in this context. The documentation is totally meaningless to me: reibbonsPerLine: Ratio of

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Ketil Malde
jinjing [EMAIL PROTECTED] writes: Any way here's the code: module Dot where import Prelude hiding ( (.) ) (.) :: a - (a - b) - b a . f = f a infixl 9 . Isn't this (roughly?) the same as flip ($)? As a side note, may I advise you to use another symbol, and leave the poor dot alone?

[Haskell-cafe] ANN: dataenc 0.11 and omnicodec 0.2

2008-06-19 Thread Magnus Therning
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 A few days ago I uploaded dataenc 0.11[1] and omnicode 0.2[2]. The short description of the (most visible) changes would be the added support for Base85 encoding and decoding in dataenc. The dataenc package (version 0.11) Data encoding library

Re: [Haskell-cafe] Design suggestion for Data.Binary.Defer

2008-06-19 Thread Neil Mitchell
Hi Actually, you ought to be able to pretty easily remove this tradeoff by introducing a strict read function as a new method in your class. So anyone who wants to strictly read lazy data can use that function instead of the lazy one. Not quite, the library is written so that strict fields

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Duncan Coutts
On Thu, 2008-06-19 at 11:33 +0800, jinjing wrote: Hi guys, This is my second attempt to learn Haskell :) Any way here's the code: module Dot where import Prelude hiding ( (.) ) (.) :: a - (a - b) - b a . f = f a infixl 9 . Note that if you redefine (.) composition to be

[Haskell-cafe] News of the day: C fails to stay self-hosting

2008-06-19 Thread Achim Schneider
http://article.gmane.org/gmane.comp.gcc.patches/165063 -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited.

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Gwern Branwen
On 2008.06.19 11:33:56 +0800, jinjing [EMAIL PROTECTED] scribbled 0.5K characters: Hi guys, This is my second attempt to learn Haskell :) Any way here's the code: module Dot where import Prelude hiding ( (.) ) (.) :: a - (a - b) - b a . f = f a infixl 9 . So for example, 99

[Haskell-cafe] Re: Meaning of ribbonsPerLine at Text.PrettyPrint.HughesPJ ?

2008-06-19 Thread Benedikt Huber
Evan Laforge schrieb: byorgey: fons: I can't explain it, all I know is that you must set it to 1 or else it does bizarre things fons: hahah, ok fons: byorgey: that's funny considering its default value is 1.5 byorgey: if you set it to 1 then lineLength means what you think it should byorgey:

Re: [Haskell-cafe] Meaning of ribbonsPerLine at Text.PrettyPrint.HughesPJ ?

2008-06-19 Thread Malcolm Wallace
To answer the original question (in the subject line), The ribbon ratio is the number of times the ribbon fits into a line. The ribbon is the number of characters on a line excluding leading and trailing white spaces. See also the original paper on which the Text.PrettyPrint.HughesPJ

[Haskell-cafe] Access to Oracle database from Haskell

2008-06-19 Thread Henning Thielemann
Is there a way of accessing a remote Oracle database by one of the common Haskell database interfaces (HaskellDB, Takusen, etc.) ? I tried to get unixODBC and Oracle's Instant Client running on a Linux machine, but I'm trapped in the notorious error: $ isql USER -v [IM004][unixODBC][Driver

[Haskell-cafe] network-related segfaults

2008-06-19 Thread Brent Yorgey
Hi all, Has anyone else experienced segfaults related to network stuff? Observe: [11:50:56 [EMAIL PROTECTED]:~]$ ghci -ignore-dot-ghci GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude :m +Text.HTML.Download Prelude

Re: [Haskell-cafe] type constructor confusion

2008-06-19 Thread Stephen Howard
Cool, Either looks like what I'm looking for. I'll have to look into that. What do I do about the fact that both HttpRequest and HttpResponse have some of the same named fields (headers and body, for example). Seems a pain to drop them into separate modules just so I can keep the naming

Re: [Haskell-cafe] cabal-install failure

2008-06-19 Thread Gwern Branwen
On 2008.06.14 08:56:34 +0100, Duncan Coutts [EMAIL PROTECTED] scribbled 1.3K characters: On Fri, 2008-06-13 at 22:10 -0400, Gwern Branwen wrote: I think this may be Cabal's fault anyway. The yi.cabal includes the line: build-tools: alex = 2.0.1 3 in the 'executable yi'

Re: [Haskell-cafe] Re: Bit Streams

2008-06-19 Thread Adam Langley
On Wed, Jun 18, 2008 at 11:00 AM, Evan Laforge [EMAIL PROTECTED] wrote: Inclusion in the official Data.Binary would be nice, especially if it could be a drop-in replacement, say by changing the Data.Binary instance definitions to Strict.Binary or something. I have a class defined to abstract

Re: [Haskell-cafe] Re: Bit Streams

2008-06-19 Thread Adam Langley
On Wed, Jun 18, 2008 at 11:07 AM, Bryan O'Sullivan [EMAIL PROTECTED] wrote: If you provide Applicative and Alternative instances for your getter monads (perhaps you already do?) I have Alternative instances, and they're used a fair bit in my HTTP parser (network-minihttp). You're right that I

Re: [Haskell-cafe] (Lazy) SmallCheck and peano numbers

2008-06-19 Thread Matthew
Hi Levi, so that I can muck around with a Vector type that includes its length encoded in its type. I suppose you have some operations over these vectors, such as nil :: Vec Zero a (|) :: a - Vec n a - Vec (Succ n) a If so, you could write a SmallCheck Series instance as follows.

[Haskell-cafe] Re: network-related segfaults

2008-06-19 Thread Brent Yorgey
On Thu, Jun 19, 2008 at 12:00 PM, Brent Yorgey [EMAIL PROTECTED] wrote: Hi all, Has anyone else experienced segfaults related to network stuff? Observe: Well, just to keep everyone updated, I suddenly remembered that cabal-install now writes log information! =D So I looked in the logs and

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Adam Vogt
* On Thursday, June 19 2008, Ketil Malde wrote: As a side note, may I advise you to use another symbol, and leave the poor dot alone? Overloading it as a module separator is bad enough. If you have a keyboard that allows greater-than-ascii input, there are plenty of options: « » ¡ £ ¥ ł € ® ª...

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-19 Thread Derek Elkins
On Thu, 2008-06-19 at 07:25 +0100, Jules Bean wrote: Richard A. O'Keefe wrote: The mutablity of r here really isn't a problem. Nor is the mutability of variables _as such_ really the problem in the PHP proposal. The problem is that it's the *same* variable every time. If PHP loops

[Haskell-cafe] This is a bug?

2008-06-19 Thread Samuel Silva
Hello I'm using HaXml library to handle XML. How I solve this issue when call readXml: in score-partwise, In a sequence: in part, In a sequence: in measure, Too many elements inside measure at file ../../../parsers/elite2.xml at line 75 col 15 Found excess: Done. I don't

[Haskell-cafe] Re: (Lazy) SmallCheck and peano numbers

2008-06-19 Thread Benedikt Huber
Levi Stephen schrieb: Hi, I have the following definitions type Zero type Succ a so that I can muck around with a Vector type that includes its length encoded in its type. I was wondering whether it was possible to use SmallCheck (or QuickCheck) to generate random Peano numbers? Is there an

[Haskell-cafe] Wrapping FTGL in FFI calls

2008-06-19 Thread Jefferson Heard
I've been looking for awhile now for a simple way to get truetype fonts into my visualizations so I can abandon the hideous GLUT fonts and make things that look like they were developed in the 1990s instead of back in the days of TRON. I found FTGL, but I'm mostly a Haskell developer these days,

[Haskell-cafe] reactive and loop

2008-06-19 Thread stefan kersten
hi, i'm having problems with a very simple example using conal elliott's 'reactive' library: module Main where import Control.Applicative import Control.Concurrent import Control.Monad import Data.Reactive import System.Random main :: IO () main = do (e, snk) - mkEvent forkIO $

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Chaddaï Fouché
2008/6/19 jinjing [EMAIL PROTECTED]: encode xs = xs.group.map token where token x = (x.length, x.head) Working in this direction is a question of taste, but the choice of the dot for the operator is a pretty bad idea... On the other hand, my favourite would be : encode = map (length head) .

Re: [Haskell-cafe] type constructor confusion

2008-06-19 Thread Dan Weston
If it helps, feel free to use a different name for the data constructors and their data type until the difference is painfully clear to you (maybe suffix the constructor with a C or prefix by Mk). Data types and constructors live in different namespaces and can happily use the same

[Haskell-cafe] HDBC converting a date sql value to UTCTime

2008-06-19 Thread George Moschovitis
Hello, I am HDBC with the Postgres driver. I am trying to read a simple date column from the DB: stmt - DB.prepare conn SELECT date FROM my_table ORDER BY date DESC LIMIT 1 DB.execute stmt [] DB.commit conn rows - fetchAllRows' stmt let ((d:_):_) = rows the d variable is of type: SqlEpochTime

[Haskell-cafe] Wrapping FTGL in FFI calls

2008-06-19 Thread Jefferson Heard
I've been looking for awhile now for a simple way to get truetype fonts into my visualizations so I can abandon the hideous GLUT fonts and make things that look like they were developed in the 1990s instead of back in the days of TRON. I found FTGL, but I'm mostly a Haskell developer these days,

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Brent Yorgey
On Thu, Jun 19, 2008 at 3:35 AM, Ketil Malde [EMAIL PROTECTED] wrote: jinjing [EMAIL PROTECTED] writes: Any way here's the code: module Dot where import Prelude hiding ( (.) ) (.) :: a - (a - b) - b a . f = f a infixl 9 . Isn't this (roughly?) the same as flip ($)? As a side

[Haskell-cafe] Burn ACM

2008-06-19 Thread Achim Schneider
for monetary reasons. I just wanted my voice to be heard, you may pass on now. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this

Re: [Haskell-cafe] cabal-install failure

2008-06-19 Thread Duncan Coutts
On Mon, 2008-06-16 at 13:25 +0100, Claus Reinke wrote: The main point of the Program abstraction is about configuring and running programs. As it happens some programs are provided by some haskell packages (but not all, eg ld, ar, etc). option to get version info and code to extract it

[Haskell-cafe] do and ifthenelse indentation in GHC

2008-06-19 Thread Stefan Monnier
http://hackage.haskell.org/trac/haskell-prime/wiki/DoAndIfThenElse says (and my memory seems to agree) that GHC has been changed to accept things like readnums f n = do eof - hIsEOF f if eof then return n else do l - hGetLine f

Re: [Haskell-cafe] Gtk2Hs and GCs

2008-06-19 Thread Brandon S. Allbery KF8NH
On 2008 Jun 18, at 23:23, Tim Newsham wrote: I can't seem to find any other way short of making a whole new GC (as is done in Gtk2Hs/demos/graphic/Drawing.hs). Am I missing something? Is there a reason the GC's arent retrievable? Join the gtk2hs list (

Re: [Haskell-cafe] type constructor confusion

2008-06-19 Thread Brandon S. Allbery KF8NH
On 2008 Jun 19, at 12:28, Stephen Howard wrote: Cool, Either looks like what I'm looking for. I'll have to look into that. What do I do about the fact that both HttpRequest and HttpResponse have some of the same named fields (headers and body, for example). Seems a pain to drop them

Re: [Haskell-cafe] cabal-install failure

2008-06-19 Thread Claus Reinke
In the specific case of parsing --version strings, I'm not sure regexes are any easier. Using words and then selecting the Nth word seems to do pretty well. for comparison, see the examples below:-) There's no reason this can't be massaged further, but it already allows for IO if necessary (I

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-19 Thread Alexander Wagner
On Wednesday 18 June 2008, Luke Palmer wrote: I don't know that much PHP, but I find the lexical keyword to be a nuisance. What are the semantics if the lexical keyword is omitted? In PHP Variables are local by default, the keyword global defines them as references to the global namespace.

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-19 Thread Alexander Wagner
CC to Christian Seiler http://www.haskell.org/pipermail/haskell-cafe/2008-June/044379.html http://www.haskell.org/pipermail/haskell-cafe/2008-June/thread.html On Wednesday 18 June 2008, Luke Palmer wrote: * A closure must be able to call itself recursively (via a higher-order function

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Albert Y. C. Lai
Adam Vogt wrote: While we are kind of on this topic, what makes the characters ħ þ prefix operator by default, while º and most other odd ones infix? alphanumeric vs non-alphanumeric ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: (Lazy) SmallCheck and peano numbers

2008-06-19 Thread Levi Stephen
If so, you could write a SmallCheck Series instance as follows. instance Serial (Vec Zero a) where series = cons0 nil instance (Serial a, Serial (Vec n a)) = Serial (Vec (Succ n) a) where series = cons2 (|) If we have the property prop_vector :: Vec (Succ (Succ Zero)) Bool -

[Haskell-cafe] Re: (Lazy) SmallCheck and peano numbers

2008-06-19 Thread Levi Stephen
On Fri, Jun 20, 2008 at 3:30 AM, Benedikt Huber [EMAIL PROTECTED] wrote: Levi Stephen schrieb: Hi, I have the following definitions type Zero type Succ a so that I can muck around with a Vector type that includes its length encoded in its type. I was wondering whether it was possible

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Derek Elkins
On Thu, 2008-06-19 at 15:24 -0400, Brent Yorgey wrote: On Thu, Jun 19, 2008 at 3:35 AM, Ketil Malde [EMAIL PROTECTED] wrote: jinjing [EMAIL PROTECTED] writes: Any way here's the code: module Dot where import Prelude hiding ( (.) )

[Haskell-cafe] Haddock compilation problem

2008-06-19 Thread Ronald Guida
I just upgraded to ghc-6.8.3, using a linux binary, and I am having a problem compiling Haddock. Haddock 2.1.0 and Haddock 2.0.0.0 both fail to build under ghc-6.8.3, but they both build successfully with ghc-6.8.2. I don't know if this is a Haddock problem, or a GHC problem, or perhaps

Re: [Haskell-cafe] Access to Oracle database from Haskell

2008-06-19 Thread Alistair Bayley
Is there a way of accessing a remote Oracle database by one of the common Haskell database interfaces (HaskellDB, Takusen, etc.) ? I tried to get unixODBC and Oracle's Instant Client running on a Linux machine, but I'm trapped in the notorious error: Takusen's Oracle backend uses the Oracle

[Haskell-cafe] Re: Wrapping FTGL in FFI calls

2008-06-19 Thread Achim Schneider
Jefferson Heard [EMAIL PROTECTED] wrote: I've been looking for awhile now for a simple way to get truetype fonts into my visualizations so I can abandon the hideous GLUT fonts and make things that look like they were developed in the 1990s instead of back in the days of TRON. I found FTGL,

RE: [Haskell-cafe] Re: Meaning of ribbonsPerLine at Text.PrettyPrint.HughesPJ ?

2008-06-19 Thread Simon Peyton-Jones
Benedikt Despite the name, neither I nor John Hughes are actively maintaining this library, so if you have got some better implementations of 'cat' and 'sep', do please submit a patch. That's how it'll improve. Do test carefully! Preferably add some Quickcheck tests too. Thanks Simon |

Re: [Haskell-cafe] message passing style like in Haskell?

2008-06-19 Thread Ketil Malde
Albert Y. C. Lai [EMAIL PROTECTED] writes: While we are kind of on this topic, what makes the characters ħ þ prefix operator by default, while º and most other odd ones infix? alphanumeric vs non-alphanumeric Testing this, I find that isAlpha is True also for 'º', but as the OP claims,