[Haskell-cafe] Re: type level functions (type of decreasing list)

2006-10-17 Thread oleg
Greg Buchholz wrote: > I'm wondering about creating a data structure that has the type of > decreasing numbers. > I can try... > > class Pre a b | a -> b > instance Pre (Succ a) a > instance Pre Zero Zero > > data (Pre a b) => Seq a = Cons a (Seq b) | Nil > > decreasing = Cons three (Cons two

Re: [Haskell-cafe] Type level functions (type of decreasing list)

2006-10-17 Thread Stefan Holdermans
Greg, What about the following (tested with GHC 6.6)? {-# OPTIONS -fglasgow-exts #-} data Zero = Zero data Succ n = Succ n zero = Zero one = Succ zero two = Succ one three = Succ two -- etc data Seq :: * -> * where Nil :: Seq Zero Cons :: Succ n -> Seq n -> S

[Haskell-cafe] Best Introduction To Monads For Newbies (& Especially Imparative Minds) I'v Ever Read!!!

2006-10-17 Thread Kaveh Shahbazian
This is the best introduction to "Monads" for newbies and imparative mined that I'v ever read! For a long time I was searching for such an excellent text on monads. Ofcourse there are many good text there. But all of them are about mathematics and how clever the monads are. After all most of them

Re: [Haskell-cafe] Re: optimization help

2006-10-17 Thread jeff p
Hello, Good, writeCSV writes out every row immediately after it got it. I eliminated (++ [nl]) in the hope of reducing the constant factor slightly. Using difference lists for that is nicer but here you go. I'm not sure how you'd use difference lists here. Also, for some reason GHC runs sligh

Re: [Haskell-cafe] Type level functions (type of decreasing list)

2006-10-17 Thread Greg Buchholz
Spencer Janssen wrote: ] Here's an attempt with GADTs: ] ] \begin{code} ] {-# OPTIONS_GHC -fglasgow-exts #-} ] data Succ a ] data Zero ] data Seq a b where ] Cons :: a -> Seq a b -> Seq a (Succ b) ] Nil :: Seq a Zero ] \end{code} ] ] Seems to work for me. Hmm. Maybe I'm missing som

Re: [Haskell-cafe] Type level functions (type of decreasing list)

2006-10-17 Thread Spencer Janssen
Here's an attempt with GADTs: \begin{code} {-# OPTIONS_GHC -fglasgow-exts #-} data Succ a data Zero data Seq a b where Cons :: a -> Seq a b -> Seq a (Succ b) Nil :: Seq a Zero \end{code} Seems to work for me. Spencer Janssen On Oct 17, 2006, at 6:37 PM, Greg Buchholz wrote: I'm

[Haskell-cafe] Type level functions (type of decreasing list)

2006-10-17 Thread Greg Buchholz
I'm wondering about creating a data structure that has the type of decreasing numbers. If I want an increasing list, it is easy... > {-# OPTIONS -fglasgow-exts #-} > > data Succ a = S a deriving Show > data Zero = Z deriving Show > > data Seq' a = Cons' a (Seq' (Succ a)) | Nil' deri

[Haskell-cafe] 6.4 -> 6.6, scoped type variables, prescribing poly-/mono-morphism

2006-10-17 Thread Nicolas Frisby
I've been writing some code that relies heavily on the type system. Some of my polymorphic functions end up too polymorphic. I'm looking for some tips and references regarding prescribing poly-/mono-morphism. I know of three ways to do it: 1) rely on the monomorphism-restriction -- kind of scary

Re: [Haskell-cafe] Newbie and working with IO Int and Int

2006-10-17 Thread Daniel Fischer
Am Dienstag, 17. Oktober 2006 19:37 schrieb Víctor A. Rodríguez: > > What's wrong with doing it this way? > > > > -- ** UNTESTED CODE ** > > > > verifyAdd :: Int -> Int -> Int -> Bool > > verifyAdd a b sum | a + b == sum = True > > otherwise = False > > > > testAddMundane :: Int -> Int -> Bool > >

Re: [Haskell-cafe] Error building Edison 1.2.0.1

2006-10-17 Thread Gregory Wright
On Oct 17, 2006, at 1:07 PM, Robert Dockins wrote: On Oct 17, 2006, at 12:55 PM, Gregory Wright wrote: Hi Rob, I've built Edison 1.2.0.1 using ghc-6.6. (I'm testing the macports, formerly darwinports, packages for the new 6.6 release.) The build goes fine, but the ./Setup register fails

Re: [Haskell-cafe] Newbie and working with IO Int and Int

2006-10-17 Thread Robert Dockins
On Oct 17, 2006, at 1:37 PM, Víctor A. Rodríguez wrote: What's wrong with doing it this way? -- ** UNTESTED CODE ** verifyAdd :: Int -> Int -> Int -> Bool verifyAdd a b sum | a + b == sum = True otherwise = False testAddMundane :: Int -> Int -> Bool testAddMundane a b = verifyAdd a b (a + b)

Re: [Haskell-cafe] Newbie and working with IO Int and Int

2006-10-17 Thread Víctor A. Rodríguez
> What's wrong with doing it this way? > > -- ** UNTESTED CODE ** > > verifyAdd :: Int -> Int -> Int -> Bool > verifyAdd a b sum | a + b == sum = True > otherwise = False > > testAddMundane :: Int -> Int -> Bool > testAddMundane a b = verifyAdd a b (a + b) > > -- all the IO-dependent stuff is below

Re: [Haskell-cafe] Error building Edison 1.2.0.1

2006-10-17 Thread Robert Dockins
On Oct 17, 2006, at 12:55 PM, Gregory Wright wrote: Hi Rob, I've built Edison 1.2.0.1 using ghc-6.6. (I'm testing the macports, formerly darwinports, packages for the new 6.6 release.) The build goes fine, but the ./Setup register fails claiming that the directory /opt/local/lib/EdisonAPI

Re: [Haskell-cafe] Newbie and working with IO Int and Int

2006-10-17 Thread Víctor A. Rodríguez
Hi, > What's wrong with doing it this way? > > -- ** UNTESTED CODE ** > > verifyAdd :: Int -> Int -> Int -> Bool > verifyAdd a b sum | a + b == sum = True > otherwise= False > > testAddMundane :: Int -> Int -> Bool > testAddMundane a b = verifyAdd a b (a + b) > > -- all the I

Re: [Haskell-cafe] Error building Edison 1.2.0.1

2006-10-17 Thread Gregory Wright
Hi Rob, I've built Edison 1.2.0.1 using ghc-6.6. (I'm testing the macports, formerly darwinports, packages for the new 6.6 release.) The build goes fine, but the ./Setup register fails claiming that the directory /opt/local/lib/EdisonAPI-1.2/ghc-6.6/include does not exist. I can make the

Re: [Haskell-cafe] Newbie and working with IO Int and Int

2006-10-17 Thread Matthias Fischmann
On Tue, Oct 17, 2006 at 01:21:38PM -0300, V?ctor A. Rodr?guez wrote: > To: haskell-cafe@haskell.org > From: "Víctor A. Rodríguez" <[EMAIL PROTECTED]> > Date: Tue, 17 Oct 2006 13:21:38 -0300 > Subject: [Haskell-cafe] Newbie and working with IO Int and Int > > Hi all, > > I'm really newbie to Hask

Re: [Haskell-cafe] Newbie and working with IO Int and Int

2006-10-17 Thread Robert Dockins
On Oct 17, 2006, at 12:21 PM, Víctor A. Rodríguez wrote: Hi all, I'm really newbie to Haskell, and working on a program I'm trying to make some testing. I make some test on certain know values ( e.g. adding 10 to 15 must return 25) and some test on random values (eg. adding rnd1 to rnd2 m

Re: [Haskell-cafe] Newbie and working with IO Int and Int

2006-10-17 Thread Seth Gordon
Víctor A. Rodríguez wrote: > Hi all, > > I'm really newbie to Haskell, and working on a program I'm trying to make > some testing. > I make some test on certain know values ( e.g. adding 10 to 15 must return > 25) and some test on random values (eg. adding rnd1 to rnd2 must return > rnd1+rnd2). >

[Haskell-cafe] Newbie and working with IO Int and Int

2006-10-17 Thread Víctor A. Rodríguez
Hi all, I'm really newbie to Haskell, and working on a program I'm trying to make some testing. I make some test on certain know values ( e.g. adding 10 to 15 must return 25) and some test on random values (eg. adding rnd1 to rnd2 must return rnd1+rnd2). The problem that makes me mad is the rando

Re: [Haskell-cafe] getting a DB library working with ghc 6.6 and PostgreSQL 7.4.7

2006-10-17 Thread Seth Gordon
> I installed HDBC, but when I tried running a simple program that used > it, I get the error message > > ghc-6.6: > /usr/local/lib/HDBC-postgresql-1.0.1.0/ghc-6.6/HSHDBC-postgresql-1.0.1.0.o: > unknown symbol `PQserverVersion' Ah, I figured it out. The PQserverVersion function is documented in

[Haskell-cafe] Re: Automatic fixity allocation for symbolic operators

2006-10-17 Thread Jón Fairbairn
Nils Anders Danielsson <[EMAIL PROTECTED]> writes: > On Mon, 16 Oct 2006, Jón Fairbairn <[EMAIL PROTECTED]> wrote: > > > I made a more concrete proposal later and Phil Wadler tidied it up. > > I think It even got as far as a draft of the language, [...] > > Do you know where this proposal/draft

[Haskell-cafe] Re: optimization help

2006-10-17 Thread apfelmus
jeff p wrote: > Hello, > >> Yet, I'm a bit astonished. I thought that when compiling with -O2, >> cosmetic changes should become negligible. Perhaps the strict foldl' has >> an effect? >> > Perhaps... but I doubt that is the main reason. At the moment I have > no idea why there is such a discrepan

Re: [Haskell-cafe] Re: Automatic fixity allocation for symbolic operators

2006-10-17 Thread Nils Anders Danielsson
On Mon, 16 Oct 2006, Jón Fairbairn <[EMAIL PROTECTED]> wrote: > I made a more concrete proposal later and Phil Wadler tidied it up. > I think It even got as far as a draft of the language, [...] Do you know where this proposal/draft can be found? -- /NAD ___

[Haskell-cafe] Re: optimization help

2006-10-17 Thread apfelmus
> I think that you misunderstood what I said. When we went from FRP to Yampa, > we > changed from using signals directly, i.e. Signal a, to using signal > functions, i.e.: > > SF a b = Signal a -> Signal b > > When we did this, we made SF abstract, and we adopted the arrow framework to >