[Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Ashley Yakeley
Ganesh Sittampalam wrote: In any case, what I'm trying to establish below is that it should be a safety property of - that the entire module (or perhaps mutually recursive groups of them?) can be duplicated safely - with a new name, or as if with a new name - and references to it randomly

RE: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Sittampalam, Ganesh
Ashley Yakeley wrote: Ganesh Sittampalam wrote: In any case, what I'm trying to establish below is that it should be a safety property of - that the entire module (or perhaps mutually recursive groups of them?) can be duplicated safely - with a new name, or as if with a new name - and

[Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Ashley Yakeley
David Menendez wrote: Isn't that what we have right now? Typeable gives you a TypeRep, which can be compared for equality. All the introspection stuff is in Data. Oh, yes, you're right. -- Ashley Yakeley ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread David Menendez
On Wed, Sep 3, 2008 at 2:53 AM, Ashley Yakeley [EMAIL PROTECTED] wrote: It's worth mentioning that the current Data.Unique is part of the standard base library, while hs-plugins is rather experimental. Currently Data.Unique uses the NOINLINE unsafePerformIO hack to create its MVar. If

RE: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Sittampalam, Ganesh
Dave Menendez wrote: The Haskell 98 report includes NOINLINE, but also states that environments are not required to respect it. So hs-plugins wouldn't necessarily be at fault if it didn't support Data.Unique. Also, the definition of NOINLINE in the report doesn't preclude copying both the

[Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Ashley Yakeley
Sittampalam, Ganesh wrote: That's not acceptable. This would cause Unique to break, as its MVar would be created twice. It would also mean that individual Unique and IOWitness values created by - would have different values depending on which bit of code was referencing them. It would render

[Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Ashley Yakeley
David Menendez wrote: On Wed, Sep 3, 2008 at 2:53 AM, Ashley Yakeley [EMAIL PROTECTED] wrote: It's worth mentioning that the current Data.Unique is part of the standard base library, while hs-plugins is rather experimental. Currently Data.Unique uses the NOINLINE unsafePerformIO hack to create

[Haskell-cafe] RE: [Haskell] Top Level -

2008-09-03 Thread Sittampalam, Ganesh
Ashley Yakeley wrote: I don't understand. If the dynamic loader were to load the same package name and version, and it duplicated the MVar, then Unique values would have the same type and could be compared. I am suggesting that this duplication process, whether conducted by the dynamic loader

RE: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Sittampalam, Ganesh
Ashley Yakeley wrote: To solve this the hs-plugins dynamic loader maintains state storing a list of what modules and packages have been loaded already. If load is called on a module that is already loaded, or dependencies are attempted to load, that have already been loaded, the dynamic

[Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Ashley Yakeley
Sittampalam, Ganesh wrote: I am suggesting that this duplication process, whether conducted by the dynamic loader or something else, should behave as if they did not have the same package name or version. This is certainly a valid transformation for Data.Unique, I am simply saying that it

Re: [Haskell-cafe] What monad am I in?

2008-09-03 Thread Yitzchak Gale
Henry Laxen wrote: Have I, like Monsier Jourdain, been running in the IO monad all my life, and didn't even know it? Marc Weber wrote: Sure... But the ghci error message is another one: Try this: :set -XNoMonomorphismRestriction And I highly recommend putting that line in your .ghci file.

[Haskell-cafe] RE: [Haskell] Top Level -

2008-09-03 Thread Sittampalam, Ganesh
Ashley Yakeley wrote: Sittampalam, Ganesh wrote: I am suggesting that this duplication process, whether conducted by the dynamic loader or something else, should behave as if they did not have the same package name or version. This is certainly a valid transformation for Data.Unique,

Re: [haskell-cafe] Monad and kinds

2008-09-03 Thread Yitzchak Gale
Ramin wrote: ...no matter how many tutorials I read, I find the only kind of monad I can write is the monad that I copied and pasted from the tutorial... I am writing a mini-database... The query itself is stateful... The query may also make updates to the records. I also thought of trying

[Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Ashley Yakeley
Sittampalam, Ganesh wrote: I think it treats them as compatible, using the fact that Data.Typeable returns the same type reps (which was why I initially mentioned Data.Typeable in this thread). This is fine for normal modules. There's a bit of description in the Dynamic Typing section of

[Haskell-cafe] RE: [Haskell] Top Level -

2008-09-03 Thread Sittampalam, Ganesh
Ashley Yakeley wrote: I think it's bad design for a dynamic loader to load a module more than once anyway. In compiled code module boundaries don't necessarily exist. So how do you relink the loaded code so that it points to the unique copy of the module? It's a waste of memory, for a

[Haskell-cafe] Is it usual to read a Maybe (IORef a) ?

2008-09-03 Thread minh thu
Hi, I'd like to write a data structure to be used inside the IO monad. The structure has some handles of type Maybe (IORef a), i.e. IORef are pointers and the Maybe is like null pointers. So I came up with the following functions : readHandle :: Maybe (IORef a) - IO (Maybe a) readField :: (a -

Re: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Yitzchak Gale
Ashley Yakeley wrote: Currently Data.Unique uses the NOINLINE unsafePerformIO hack to create its MVar. If hs-plugins duplicates that MVar, that's a bug in hs-plugins. Sittampalam, Ganesh wrote: Also, the definition of NOINLINE in the report doesn't preclude copying both the MVar *and* its

RE: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Sittampalam, Ganesh
Yitzhak Gale wrote: Right. It would not be a bug in hs-plugins. That is the most urgent problem right now. [...] For the short term - can we *please* get an ONLYONCE pragma that has the correct semantics? So the purpose of this pragma would solely be so that you can declare hs-plugins buggy

Re: [Haskell-cafe] Is it usual to read a Maybe (IORef a) ?

2008-09-03 Thread Bulat Ziganshin
Hello minh, Wednesday, September 3, 2008, 2:09:38 PM, you wrote: I'd like to write a data structure to be used inside the IO monad. The structure has some handles of type Maybe (IORef a), i.e. IORef are pointers and the Maybe is like null pointers. i've not used this but overall it seems

[Haskell-cafe] Types and Trees

2008-09-03 Thread Matt Morrow
I really learned a lot from writing the below code, and thought I'd share it with the group. I'm slightly at a loss for words, having just spent the last two hours on this when I most certainly should have been doing other work, but these are two hours I won't regret. I'm very interested in

Re: [Haskell-cafe] Is it usual to read a Maybe (IORef a) ?

2008-09-03 Thread Ryan Ingram
Looks like MaybeT? http://hackage.haskell.org/cgi-bin/hackage-scripts/package/MaybeT-0.1.1 readHandle x = runMaybeT $ do ref - MaybeT (return x) liftIO (readIORef ref) readField f h = runMaybeT $ do a - MaybeT (readHandle h) return (f a) (or, the short version) readHandle

Re: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Yitzchak Gale
I wrote: For the short term - can we *please* get an ONLYONCE pragma that has the correct semantics? Sittampalam, Ganesh wrote: So the purpose of this pragma would solely be so that you can declare hs-plugins buggy for not respecting it? No, the hs-plugins problem - whether hypothetical or

RE: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Sittampalam, Ganesh
(apologies for misspelling your name when quoting you last time) Yitzchak Gale wrote: For the short term - can we *please* get an ONLYONCE pragma that has the correct semantics? Until a permanent solution is implemented and deployed in the compilers (if ever), can we please have a pragma

Re: [Haskell-cafe] Is it usual to read a Maybe (IORef a) ?

2008-09-03 Thread minh thu
2008/9/3 Bulat Ziganshin [EMAIL PROTECTED]: Hello minh, Wednesday, September 3, 2008, 2:09:38 PM, you wrote: I'd like to write a data structure to be used inside the IO monad. The structure has some handles of type Maybe (IORef a), i.e. IORef are pointers and the Maybe is like null

Re: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Yitzchak Gale
For the short term - can we *please* get an ONLYONCE pragma that has the correct semantics? Sittampalam, Ganesh wrote: How do you propose that this pragma would be implemented? As far as I know now, in GHC it could currently just be an alias for NOINLINE, but the GHC gurus could say for sure.

RE: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Sittampalam, Ganesh
Yitzchak Gale wrote Other applications and libraries that support the pragma - such as other compilers, and hs-plugins - would be required to respect the guarantee, and bugs could be filed against them if they don't. If hs-plugins were loading object code, how would it even know of the

Re: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Yitzchak Gale
I wrote Other applications and libraries that support the pragma - such as other compilers, and hs-plugins - would be required to respect the guarantee, and bugs could be filed against them if they don't. Sittampalam, Ganesh wrote: If hs-plugins were loading object code, how would it even

Re: [Haskell-cafe] Is it usual to read a Maybe (IORef a) ?

2008-09-03 Thread minh thu
2008/9/3 Lennart Augustsson [EMAIL PROTECTED]: I think you should think about why your application needs IORef at all. Do you really need mutation? And why isn't STRef good enough. Using IORef is really the last resort. This is for an interactive application (3D mesh editing, the data

[Haskell-cafe] Re: joyent, solaris and ghc

2008-09-03 Thread Christian Maeder
Jason Dusek wrote: Is anyone on the list using GHC on Joyent's Solaris (x86_64) setup? If so, I would love to know whether it was easy/hard and what the process is. Sorry, I don't know a thing about Joyent. On x86-Solaris there seems to exist only a 32bit distribution that should run on

Re: [Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread David Menendez
On Wed, Sep 3, 2008 at 9:30 AM, Yitzchak Gale [EMAIL PROTECTED] wrote: I wrote Other applications and libraries that support the pragma - such as other compilers, and hs-plugins - would be required to respect the guarantee, and bugs could be filed against them if they don't. Sittampalam,

Re: [Haskell-cafe] Compiler's bane

2008-09-03 Thread Andrew Coppin
Brandon S. Allbery KF8NH wrote: You can define a set of valid transformations, have the interpreter log each transformation, and verify that all are correct (that is, that both the transformation and the logged result are correct. This assumes the interpreter can be resolved down to a

Re: [Haskell-cafe] Compiler's bane

2008-09-03 Thread Andrew Coppin
Brandon S. Allbery KF8NH wrote: On 2008 Sep 1, at 14:47, Andrew Coppin wrote: I wonder - how do the GHC developers check that GHC works properly? (I guess by compiling stuff and running it... It's a bit harder to check that a lambda interpretter is working right.) GHC has a comprehensive

Re: [Haskell-cafe] Is it usual to read a Maybe (IORef a) ?

2008-09-03 Thread hs
On Wednesday 03 September 2008 12:09:38 minh thu wrote: Hi, I'd like to write a data structure to be used inside the IO monad. The structure has some handles of type Maybe (IORef a), i.e. IORef are pointers and the Maybe is like null pointers. So I came up with the following functions :

[Haskell-cafe] Re: [Haskell] Top Level -

2008-09-03 Thread Ashley Yakeley
Sittampalam, Ganesh wrote: In compiled code module boundaries don't necessarily exist. So how do you relink the loaded code so that it points to the unique copy of the module? hs-plugins loads modules as single .o files, I believe. It crashes the RTS of the plugins loader, which is based on

[Haskell-cafe] Hackage - MacPorts?

2008-09-03 Thread John MacFarlane
It would be great if there were an automated or semi-automated way of generating a MacPorts Portfile from a HackageDB package, along the lines of dons' cabal2arch. Has anyone been working on such a thing? And, are any haskell-cafe readers MacPorts committers? John

[Haskell-cafe] analyzing modules import/export

2008-09-03 Thread Han Joosten
I am currently involved with a Haskell project to create a toolset for a formal language. The toolset contains a parser, a typechecker and s range of other features. The Haskell code currently consists of about 20 modules. I am new in the project, and my impression is that a lot of code does not

Re: [Haskell-cafe] Hackage - MacPorts?

2008-09-03 Thread Duncan Coutts
On Wed, 2008-09-03 at 13:14 -0700, John MacFarlane wrote: It would be great if there were an automated or semi-automated way of generating a MacPorts Portfile from a HackageDB package, along the lines of dons' cabal2arch. Has anyone been working on such a thing? And, are any haskell-cafe

Re: [Haskell-cafe] analyzing modules import/export

2008-09-03 Thread Don Stewart
j.m.m.joosten: I am currently involved with a Haskell project to create a toolset for a formal language. The toolset contains a parser, a typechecker and s range of other features. The Haskell code currently consists of about 20 modules. I am new in the project, and my impression is that

Re: [Haskell-cafe] Hackage - MacPorts?

2008-09-03 Thread Don Stewart
duncan.coutts: On Wed, 2008-09-03 at 13:14 -0700, John MacFarlane wrote: It would be great if there were an automated or semi-automated way of generating a MacPorts Portfile from a HackageDB package, along the lines of dons' cabal2arch. Has anyone been working on such a thing? And, are

Re: [Haskell-cafe] Haskell audio libraries audio formats

2008-09-03 Thread Gwern Branwen
On 2008.08.24 11:41:04 -0400, Eric Kidd [EMAIL PROTECTED] scribbled 3.7K characters: Greetings, Haskell folks! I'm working on a toy program for drum synthesis. This has lead me to explore the various sound-related libraries in Hackage. Along the way, I've learned several things: 1.

Re: [Haskell-cafe] Hackage - MacPorts?

2008-09-03 Thread David Menendez
On Wed, Sep 3, 2008 at 4:14 PM, John MacFarlane [EMAIL PROTECTED] wrote: It would be great if there were an automated or semi-automated way of generating a MacPorts Portfile from a HackageDB package, along the lines of dons' cabal2arch. Has anyone been working on such a thing? And, are any

Re: [Haskell-cafe] Compiler's bane

2008-09-03 Thread Ryan Ingram
On Wed, Sep 3, 2008 at 11:34 AM, Andrew Coppin [EMAIL PROTECTED] wrote: data Expression = Var String | Apply Expression Expression | Lambda String Expression How would you go about building random expression trees? It's pretty simple, I think. Keep an environment of variable names that are

Re: [Haskell-cafe] Compiler's bane

2008-09-03 Thread Brandon S. Allbery KF8NH
On 2008 Sep 3, at 14:34, Andrew Coppin wrote: Brandon S. Allbery KF8NH wrote: You can define a set of valid transformations, have the interpreter log each transformation, and verify that all are correct (that is, that both the transformation and the logged result are correct. This assumes

Re: [Haskell-cafe] Re: Research language vs. professional language

2008-09-03 Thread wren ng thornton
Jonathan Cast wrote: But Haskell's community is also growing This is good! and becoming more results-oriented. This is not; see my other post. I think it's great that Haskellers are starting to accomplish useful things, but if in the process I think elders like Lennart Augustsson and

Re: [haskell-cafe] Monad and kinds

2008-09-03 Thread wren ng thornton
Ramin wrote: Hello, I'm new here, but in the short time I have known Haskell, I can already say it's my favorite computer language. Except for monads, and no matter how many tutorials I read, I find the only kind of monad I can write is the monad that I copied and pasted from the tutorial,

[Haskell-cafe] Haskell and i18n (aka gettext) support

2008-09-03 Thread Gour
Dear Haskellers, Some time ago the question was asked on gtk2hs mailing list about how to work with *.po files, i.e. how to make Haskell program i18n-aware. (see http://thread.gmane.org/gmane.comp.lang.haskell.gtk2hs/592) The answer was that Gtk2hs does not have gettext support