Re: [Haskell-cafe] relational data representation in memory using haskell?

2008-05-21 Thread Salvatore Insalaco
2008/5/22 Marc Weber <[EMAIL PROTECTED]>: > I'd like to illustrate two different ideas using a small example: > (A) >data CD = CD { title :: String, tracks :: [ Track ] } >data Track = Track { track :: String, cd :: CD } >data PDB = PDB { cds :: Set CD, tracks :: Set Track }

Re: [Haskell-cafe] relational data representation in memory using haskell?

2008-05-21 Thread Dan Weston
Consider SQLite [1], which is "a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine." It is embeddable, can reside completely in memory (including the data), and can be saved and restored to disk when needed. It neatly fills the

Re: [Haskell-cafe] relational data representation in memory using haskell?

2008-05-21 Thread Marc Weber
On Wed, May 21, 2008 at 05:05:21PM -0700, Jeremy Shaw wrote: > At Thu, 22 May 2008 01:04:24 +0200, > Marc Weber wrote: > > > Some way representing relational data which is typically stored in > > databases such as Postgresql.. > > > > Rewriting something like Postgresql in haskell would take ages

Re: [Haskell-cafe] Ubuntu and ghc

2008-05-21 Thread Darrin Thompson
2008/5/21 Galchin, Vasili <[EMAIL PROTECTED]>: > Hi Dan, > > I am still looking into this myself. I just stumbled across the URL > below. i would suggest keeping an eye on this URL for more news. > I quit using the ubuntu debs. I've just been downloading the linux binaries and runing them in

Re: [Haskell-cafe] relational data representation in memory using haskell?

2008-05-21 Thread Jeremy Shaw
At Thu, 22 May 2008 01:04:24 +0200, Marc Weber wrote: > Some way representing relational data which is typically stored in > databases such as Postgresql.. > > Rewriting something like Postgresql in haskell would take ages.. > So I'd be satisfied with having in memory representation only (this >

Re: [Haskell-cafe] one-way monads

2008-05-21 Thread Creighton Hogg
On Wed, May 21, 2008 at 6:37 PM, Neil Mitchell <[EMAIL PROTECTED]> wrote: > Hi > > > Real Haskell Programmers Only Use Top Level IO! > > > > (But then again, real programmers wouldn't use Haskell: > > http://www.pbm.com/~lindahl/real.programmers.html

Re: [Haskell-cafe] one-way monads

2008-05-21 Thread Neil Mitchell
Hi > Real Haskell Programmers Only Use Top Level IO! > > (But then again, real programmers wouldn't use Haskell: > http://www.pbm.com/~lindahl/real.programmers.html) It's amazing how many phone interviews I've done where the HR person at the other end tries to tick the "knows Pascal" box, despite

Re: [Haskell-cafe] one-way monads

2008-05-21 Thread Dan Piponi
On Wed, May 21, 2008 at 4:08 PM, Lennart Augustsson <[EMAIL PROTECTED]> wrote: > I certainly don't use 50% IO monads. I regard any use of the IO monad > except at the top level as a failure. :) Real Haskell Programmers Only Use Top Level IO! (But then again, real programmers wouldn't use Haskell

Re: [Haskell-cafe] one-way monads

2008-05-21 Thread Don Stewart
lennart: > I certainly don't use 50% IO monads. I regard any use of the IO monad > except at the top level as a failure. :) IO fail -- Don Background: http://failblog.org/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/m

Re: [Haskell-cafe] one-way monads

2008-05-21 Thread Lennart Augustsson
I certainly don't use 50% IO monads. I regard any use of the IO monad except at the top level as a failure. :) On Wed, May 21, 2008 at 7:14 PM, Dan Weston <[EMAIL PROTECTED]> wrote: > Dan Doel wrote: >> >> On Tuesday 20 May 2008, [EMAIL PROTECTED] wrote: >>> >>> Actually, it's true less than 50%

[Haskell-cafe] relational data representation in memory using haskell?

2008-05-21 Thread Marc Weber
I'm kind of stuck that's why I'm posting here to ask wether this makes sense at all, maybe someone else has already done it? What I'd like to have: Some way representing relational data which is typically stored in databases such as Postgresql.. Rewriting something like Postgresql in haskell wou

Re: [Haskell-cafe] Ubuntu and ghc

2008-05-21 Thread Galchin, Vasili
Hi Dan, I am still looking into this myself. I just stumbled across the URL below. i would suggest keeping an eye on this URL for more news. Vasili On Wed, May 21, 2008 at 5:45 PM, Dan Weston <[EMAIL PROTECTED]> wrote: > Now you tell me! I also upgraded late last night and got the exact sa

Re: [Haskell-cafe] Ubuntu and ghc

2008-05-21 Thread Dan Weston
Now you tell me! I also upgraded late last night and got the exact same problem. :( I just uninstalled the ghc from the Update Manager and was going to reinstall tonight. Are you saying that something else is screwed up because of this? Galchin, Vasili wrote: Hello, https://bugs.lau

[Haskell-cafe] Ubuntu and ghc

2008-05-21 Thread Galchin, Vasili
Hello, https://bugs.launchpad.net/ubuntu/+source/gtk2hs/+bug/229489 this is almost identical to my problem. I am just trying to help others on this list who are using Ubuntu Linux to avoid my predicament! Kind regards, Vasili ___ Haskell-Caf

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-21 Thread Dmitri O.Kondratiev
-- Jules, Oliver, thanks! Things are getting clarified, I hope. -- Let me summarize how I now understand getAny operation, please correct me if I am wrong. getAny :: (Random a) => State StdGen a getAny = do g <- get (x,g') <- return $ random g put g' return x {--

Re: [Haskell-cafe] MD5 performance optimizations

2008-05-21 Thread Salvatore Insalaco
2008/5/21 Andrew Coppin <[EMAIL PROTECTED]>: > Woo! > > Salvatore kindly sent me a Darcs patch, and applying it does indeed make it > run faster. Yay! Hi Andrew, I'm glad that -fvia-c works for you: maybe it's a Mac OS X specific bug? Anyway, did you compile with -fvia-c -optc-O3? I expect regist

Re: [Haskell-cafe] MD5 performance optimizations

2008-05-21 Thread Andrew Coppin
Woo! Salvatore kindly sent me a Darcs patch, and applying it does indeed make it run faster. Yay! [Note that -fvia-c works just fine for me. It doesn't appear to produce a huge speed difference, but it compiles just fine.] Thanks for the tips, guys! :-D The changes are in the online Darcs rep

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-21 Thread Olivier Boudry
On Wed, May 21, 2008 at 11:10 AM, Dmitri O.Kondratiev <[EMAIL PROTECTED]> wrote: > But how will 'g1' actually get delivered from 'makeRandomValueST g1' to > invocation of 'getAny' I don't yet understand! > > It may be easier to understand the state passing if you remove the do notation and replace

Re: [Haskell-cafe] one-way monads

2008-05-21 Thread Dan Weston
Dan Doel wrote: On Tuesday 20 May 2008, [EMAIL PROTECTED] wrote: Actually, it's true less than 50% of the time. In particular, it's not true of any monad transformer. Sure it is. Any particular transformer t typically comes with some particular way of writing a function of type t m a -> m a

[Haskell-cafe] Re: Return user state in Parsec

2008-05-21 Thread Achim Schneider
Maciej Podgurski <[EMAIL PROTECTED]> wrote: > Hi, > > I'm currently writing a parser using the Parsec library. What I want > is to store the order of each subparser called in a user state. So > every single parser will be marked with a label that is stored in a > special treelike structure when t

RE: [Haskell-cafe] [Solved] Installing Cabal-Install

2008-05-21 Thread Aditya Siram
That worked. Thank you. > Date: Wed, 21 May 2008 12:22:33 -0400 > From: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > Subject: Re: [Haskell-cafe] Installing Cabal-Install > CC: haskell-cafe@haskell.org > > On Wed, May 21, 2008 at 12:11 PM, Aditya Siram wro

[Haskell-cafe] Return user state in Parsec

2008-05-21 Thread Maciej Podgurski
Hi, I'm currently writing a parser using the Parsec library. What I want is to store the order of each subparser called in a user state. So every single parser will be marked with a label that is stored in a special treelike structure when the parser is run. My problem is to return the last

Re: [Haskell-cafe] Installing Cabal-Install

2008-05-21 Thread Denis Bueno
On Wed, May 21, 2008 at 12:11 PM, Aditya Siram <[EMAIL PROTECTED]> wrote: > > Hi all, > I am trying to install cabal-install so I can install xmonad-contrib. I have > all the dependancies in place but when I do: > runhaskell Setup.lhs build > I get: > Hackage/Types.hs:19:29: >Module `Distribut

[Haskell-cafe] Installing Cabal-Install

2008-05-21 Thread Aditya Siram
Hi all, I am trying to install cabal-install so I can install xmonad-contrib. I have all the dependancies in place but when I do: runhaskell Setup.lhs build I get: Hackage/Types.hs:19:29: Module `Distribution.Version' does not export `Dependency' Any ideas? Thanks ... Deech

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-21 Thread Jules Bean
Dmitri O.Kondratiev wrote: Jules, Stupid question, please bear with me: x :: Int -- x declared, but not constructed x = 1 -- x constructed s1 :: State StdGen a -- s1 declared, yes, but why s1 is *also already constructed* ? it's not. it's constructed when you do s1 = return 1 ... or ...

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-21 Thread Dmitri O.Kondratiev
Jules, Stupid question, please bear with me: x :: Int -- x declared, but not constructed x = 1 -- x constructed s1 :: State StdGen a -- s1 declared, yes, but why s1 is *also already constructed* ? On Wed, May 21, 2008 at 6:54 PM, Jules Bean <[EMAIL PROTECTED]> wrote: > Dmitri O.Kondratiev wrot

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-21 Thread Dmitri O.Kondratiev
State is a data type. As any other data type it can be instantiated. State instance is a structure of one record that contains (\s ->(a,s)) lambda function. This function can be parametrized by types of its arguments 's' and 'a'. I don't see magic here :) Ok, then from declaration: getAny :: (Ran

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-21 Thread Jules Bean
Dmitri O.Kondratiev wrote: Thanks everybody for your help! Oliver, you provided an excellent write-up on State monad without going into 'scary' :) details, great work indeed! Alas, in this case I need the details, and in particular the most scary ones! So let's start with fundamental a

Re: [Haskell-cafe] ghc-pkg package.conf files?

2008-05-21 Thread Brandon S. Allbery KF8NH
On 2008 May 21, at 2:35, Galchin, Vasili wrote: hmm ... ;^). I found and read through part of ghc-pkg.hs .. ghc-6.8.2/utils/ghc-pkg/ .. I have 6 "broken" Haskell package databases (not debian) under /usr/lib/haskell-packages/ghc6/lib/. When I run ghc-pkg on them I get [EMAIL PROTECTED]:/us

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-21 Thread Olivier Boudry
On Wed, May 21, 2008 at 8:42 AM, Dmitri O.Kondratiev <[EMAIL PROTECTED]> wrote: > So let's start with fundamental and most intriguing (to me) things: > > getAny :: (Random a) => State StdGen a > getAny = do g <- get -- magically get the current StdGen > > First line above declares a data type: >

Re: [Haskell-cafe] RealFloat constraint on Complex type

2008-05-21 Thread Bryan O'Sullivan
Richard A. O'Keefe wrote: >> I think the practice of constraint in type definitions is generally >> discouraged, > > Is this true? If so, why? As a practical matter, a Haskell 98 constraint infects every place you might like to use the type. They're like prion proteins, corrupting everything t

Re: [Haskell-cafe] RealFloat constraint on Complex type

2008-05-21 Thread Henning Thielemann
On Tue, 20 May 2008, Conal Elliott wrote: GHC's (maybe Haskell98's?) Complex type is defined with a RealFloat constraint on type type itself, rather than on some of the instances and functions: data (RealFloat a) => Complex a = !a :+ !a I think the practice of constraint in type definitio

[Haskell-cafe] Re: HaXml and the XHTML 1.0 Strict DTD

2008-05-21 Thread Malcolm Wallace
Peter Gammie <[EMAIL PROTECTED]> wrote: > Can you lay out some kind of plan for HaXml? (is 1.13.x now dead, is > 1.19.x stable, ...?) This would help for new-ish projects like mine. The 1.13.x stable branch sees minimal maintenance only, mostly to repair it to build after each new release of gh

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-21 Thread Dmitri O.Kondratiev
Thanks everybody for your help! Oliver, you provided an excellent write-up on State monad without going into 'scary' :) details, great work indeed! Alas, in this case I need the details, and in particular the most scary ones! So let's start with fundamental and most intriguing (to me) thing

[Haskell-cafe] Re: HaXml and the XHTML 1.0 Strict DTD

2008-05-21 Thread Peter Gammie
On 21/05/2008, at 5:44 PM, Malcolm Wallace wrote: Peter Gammie <[EMAIL PROTECTED]> wrote: Using a slightly hacked HaXml v1.13.3, I get this from DtdToHaskell: data Table = Table Table_Attrs (Maybe Caption) (OneOf2 [Col] [Colgroup]) (Maybe Thead) (Maybe Tfoot)

[Haskell-cafe] Re: HaXml and the XHTML 1.0 Strict DTD

2008-05-21 Thread Malcolm Wallace
Peter Gammie <[EMAIL PROTECTED]> wrote: >(caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))> > > Using a slightly hacked HaXml v1.13.3, I get this from DtdToHaskell: > > data Table = Table Table_Attrs (Maybe Caption) > (OneOf2 [Col] [Colgroup]) (Maybe Thead) (

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-21 Thread Yitzchak Gale
Thomas Hartman wrote: > I would be interested in seeing good motivating examples for use of > the state monad... > Okay, it's good for randomness. What else? > ...I saw an example about > using state to uniquely label elements of a tree > So, are there any other simple motivating examples that show

[Haskell-cafe] Re: HaXml and the XHTML 1.0 Strict DTD

2008-05-21 Thread Peter Gammie
On 30/04/2008, at 5:32 PM, Malcolm Wallace wrote: Peter Gammie <[EMAIL PROTECTED]> wrote: The most-recent darcs version relies on a newer ByteString than I have, so it is not easy for me to test it. I believe there was a patch to fix this. Apparently only one version of the bytestring pac

Re: [Haskell-cafe] Rotating backdrop (aka learning Haskell)

2008-05-21 Thread Yann Golanski
Quoth Derek Elkins on Tue, May 20, 2008 at 11:45:57 -0500 > On Tue, 2008-05-20 at 10:55 +0200, Ketil Malde wrote: > > Yann Golanski <[EMAIL PROTECTED]> writes: > > > > > 1- Get a list out of a file: I managed to do that using the following: > > > > > > parseImageFile :: FilePath -> IO [String] >

RE: [Haskell-cafe] RealFloat constraint on Complex type

2008-05-21 Thread Bayley, Alistair
> From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Richard A. O'Keefe > > On 21 May 2008, at 9:25 am, Conal Elliott wrote: > > I think the practice of constraint in type definitions is > generally > > discouraged, > > Is this true? If so, why? > If I have a data type that

Re: [Haskell-cafe] Newbie: State monad example questions

2008-05-21 Thread Thomas Hartman
I would be interested in seeing good motivating examples for use of the state monad, other than that example from All About Monads. Okay, it's good for randomness. What else? Reading the source code for State, I think I saw an example about using state to uniquely label elements of a tree with as