Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread Manuel M T Chakravarty
Manuel M T Chakravarty: again, i gave a concrete example of how ghc behaves as i would expect, not as that decomposition rule would suggest. Maybe you can explain why you think so. I didn't understand why you think the example is not following the decomposition rule. Actually, see

[Haskell-cafe] separate input calculation output

2008-03-25 Thread Thomas Engel
Hello, I'm new to haskell and want to write a small program for some winder calcucations. I want to input 10-15 values and based on this input doing some calculations. After this calculations I want to print out the results. My problem is: How can I get the input values into the calculations

Re: [Haskell-cafe] separate input calculation output

2008-03-25 Thread Robert Vollmert
On Mar 25, 2008, at 09:13, Thomas Engel wrote: My problem is: How can I get the input values into the calculations and back the result to the output. In an other language I would use global variables for this. So what should I use in haskell? (I think I know enough haskell to answer

Re: [Haskell-cafe] separate input calculation output

2008-03-25 Thread Ketil Malde
Thomas Engel [EMAIL PROTECTED] writes: My problem is: How can I get the input values into the calculations and back the result to the output. In an other language I would use global variables for this. That would be bad style. An other point is that I want to separate the input from the

Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread Claus Reinke
again, i gave a concrete example of how ghc behaves as i would expect, not as that decomposition rule would suggest. Maybe you can explain why you think so. I didn't understand why you think the example is not following the decomposition rule. Actually, see

Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread Claus Reinke
type family F a :: * - * F x y ~ F u v = F x ~ F u /\ y ~ v why would F x and F u have to be the same functions? shouldn't it be sufficient for them to have the same result, when applied to y and v, respectively? Oh, yes, that is sufficient and exactly what is meant by F x ~ F u. It means,

Re: [Haskell-cafe] separate input calculation output

2008-03-25 Thread Thomas Engel
Hi Robert (I think I know enough haskell to answer this, but I may be telling you all the wrong things.) Why? What's wrong? You'll have to pass the values through, though this can be hidden to some extent. Try changing your functions to have types type Input = (Float, Float, ...) type

Re: [Haskell-cafe] separate input calculation output

2008-03-25 Thread Robert Vollmert
On Mar 25, 2008, at 13:03, Thomas Engel wrote: type Input = (Float, Float, ...) type Output = (Float, Float, ...) inputvalues :: IO Input -- add a return (ve,de,...) to the end compute :: Input - Output How can I combine several function (calculations) in this function? compute

[Haskell-cafe] True parallelism missing :-(

2008-03-25 Thread Dusan Kolar
Dear all, I've thought the following three (dummy) programs would run some of their parts in parallel (on dual core) if compiled with option threaded (smp). The truth is that only the first one exploits multicore CPU. Why? Moreover, using RTS option -sstderr makes runtime not to evaluate

Re: [Haskell-cafe] True parallelism missing :-(

2008-03-25 Thread Bulat Ziganshin
Hello Dusan, Tuesday, March 25, 2008, 3:47:50 PM, you wrote: (smp). The truth is that only the first one exploits multicore CPU. Why? +RTS -N2 -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing

Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread Claus Reinke
was hoping for. in fact, the decomposition rule seems to be saying that type function results cannot matter, only the structure of type family applications does: F x y ~ F u v = F x ~ F u /\ y ~ v or do you have a specific type rule application order in mind where all type-level reductions

Re: [Haskell-cafe] How to program with sqlite?

2008-03-25 Thread Alex Sandro Queiroz e Silva
Hallo, Bjorn Bringert wrote: This is SQLite's fault. In SQLite, all types are aliases for STRING. Whatever type you use in the create and insert, you will get strings back. That's not true. SQLite has integers (64 bits) and reals. But, if you try to read the field as text it will

Re: [Haskell-cafe] How to program with sqlite?

2008-03-25 Thread Bjorn Bringert
2008/3/22 Sebastian Sylvan [EMAIL PROTECTED]: On Sat, Mar 22, 2008 at 1:40 PM, Deng Chao [EMAIL PROTECTED] wrote: Hi all, I'm learning sqlite, and as I know haskell has some libraries like HDBC or HSQL can access sqlite DB. Can anybody give me a small example to show how to use it? It

Re: [Haskell-cafe] How to program with sqlite?

2008-03-25 Thread Bjorn Bringert
On Tue, Mar 25, 2008 at 3:29 PM, Alex Sandro Queiroz e Silva [EMAIL PROTECTED] wrote: Hallo, Bjorn Bringert wrote: This is SQLite's fault. In SQLite, all types are aliases for STRING. Whatever type you use in the create and insert, you will get strings back. That's not

Re: [Haskell-cafe] True parallelism missing :-(

2008-03-25 Thread Roberto Zunino
Dusan Kolar wrote: Dear all, I've thought the following three (dummy) programs would run some of their parts in parallel (on dual core) if compiled with option threaded (smp). The truth is that only the first one exploits multicore CPU. Why? h1 - forkIO $ putMVar v1 $ fibs (n-1)

Re: [Haskell-cafe] Problem with OpenAL

2008-03-25 Thread George Giorgidze
I am also getting the same output: 0 indicates the number of processed buffers, and 1 the number of queued buffers. It means that the small buffer which is queued for playback never gets processed completely. The first argument of playOpenAL functions is a sampling rate of an audio playback, so

[Haskell-cafe] Parsec (Zero or One of)

2008-03-25 Thread Paul Keir
Hi, I'm having some difficulty using the Parsec library, perhaps you could help. I've reduced my problem as shown below. I would like the 'only_prod' parser to require the reserved string only, _optionally_ followed by an identifier. As part of 'mytest', this should then be followed by the

[Haskell-cafe] getChar

2008-03-25 Thread Cetin Sert
Hi, is there a version of getChar that doesn't buffer keyboard input until enter is pressed? specialReadln :: IO String specialReadln = do c ← getChar if c == '#' then do return [] else do cs ← specialReadln

Re: [Haskell-cafe] Parsec (Zero or One of)

2008-03-25 Thread Albert Y. C. Lai
Paul Keir wrote: I’m having some difficulty using the Parsec library, perhaps you could help. I’ve reduced my problem as shown below. I would like the ‘only_prod’ parser to require the reserved string “only”, _optionally_ followed by an identifier. As part of ‘mytest’, this should then be

Re: [Haskell-cafe] getChar

2008-03-25 Thread Albert Y. C. Lai
Cetin Sert wrote: is there a version of getChar that doesn't buffer keyboard input until enter is pressed? Look into hSetBuffering (module System.IO or IO). As a quick start: hSetBuffering stdin NoBuffering ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] separate input calculation output

2008-03-25 Thread Claude Heiland-Allen
Thomas Engel wrote: inputvalues :: IO Input -- add a return (ve,de,...) to the end compute :: Input - Output How can I combine several function (calculations) in this function? compute1 :: Input - Output1 compute2 :: Input - Output2 combine :: Output1 - Output2 - Output compute input =

Re: [Haskell-cafe] True parallelism missing :-(

2008-03-25 Thread Dusan Kolar
I did use that option. :-) Dusan Bulat Ziganshin wrote: Hello Dusan, Tuesday, March 25, 2008, 3:47:50 PM, you wrote: (smp). The truth is that only the first one exploits multicore CPU. Why? +RTS -N2 ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Parsec (Zero or One of)

2008-03-25 Thread Derek Elkins
On Tue, 2008-03-25 at 11:47 -0400, Albert Y. C. Lai wrote: Paul Keir wrote: I’m having some difficulty using the Parsec library, perhaps you could help. I’ve reduced my problem as shown below. I would like the ‘only_prod’ parser to require the reserved string “only”, _optionally_

Re: [Haskell-cafe] True parallelism missing :-(

2008-03-25 Thread Dusan Kolar
Yes, that's is. Thanks. My fault - missing wood seeing trees. ;-) Best regards, Dusan Roberto Zunino wrote: Dusan Kolar wrote: Dear all, I've thought the following three (dummy) programs would run some of their parts in parallel (on dual core) if compiled with option threaded (smp). The

RE: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread Simon Peyton-Jones
| | However, I think I now understand what you are worried about. It is the | | interaction of type families and GHC's generalised type synonyms (i.e., | | type synonyms that may be partially applied). I agree that it does lead | | to an odd interaction, because the outcome may depend on the

RE: [Haskell-cafe] Parsec (Zero or One of)

2008-03-25 Thread Paul Keir
Thanks. I can't find optionMaybe in my version 2.1 of Parsec, but in any case, defining my only_prod as only_prod = do { reserved only; option [] identifier } or only_prod = do { reserved only; identifier | return [] } gives the same error responses as before. I will anyway look closer at

[Haskell-cafe] Re: Libraries need a new owner

2008-03-25 Thread Adrian Hey
Don Stewart wrote: ahey: Hello Folks, As some of you will be aware, I have been working on various Map implementations that currently live here.. http://code.haskell.org/collections/collections-ghc6.8 The libs in question being Data.Tree.AVL, Data.Trie.General and a few other bits like

RE: [Haskell-cafe] Terminating GLUT/GLFW programs

2008-03-25 Thread Peter Verswyvelen
Indeed, the sample from the website does not close correctly when the window is closed; you must press the escape key. This problem has nothing to do with GLFW or the Haskell wrapper, but with the demo, which does not check if the window gets closed. I modified the example code on the wiki so it

Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread Dan Doel
On Tuesday 11 March 2008, Tom Schrijvers wrote: I think you've uncovered a bug in the type checker. We made the design choice that type functions with a higher-kinded result type must be injective with respect to the additional paramters. I.e. in your case: F x y ~ F u v = F x ~

Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread David Menendez
On Mon, Mar 24, 2008 at 12:14 AM, Manuel M T Chakravarty [EMAIL PROTECTED] wrote: One difference between type families and (value-level) functions is that not all parameters of a type family are treated the same. A type family has a fixed number of type indicies. We call the number of

[Haskell-cafe] ANNOUNCE: Haskell Server Pages v 0.4

2008-03-25 Thread Niklas Broberg
Greetings fellow Haskelleers, I am very pleased to announce a new chapter in the Haskell Server Pages saga. After a two-year long hiatus, while we in the team have been busy with Other Stuff, we have resumed work on Project HSP, and this release marks the first milestone. = ===

Re: [Haskell-cafe] Terminating GLUT/GLFW programs

2008-03-25 Thread Paul L
Peter is right at saying it's the sample GLFW program that didn't handle Window Close event. I didn't double check his modification because I run Linux/X11 with xmonad where there is no CLOSE button for any window, but I trust his modification works fine :-) As for the alternatives, I don't think

Re: [Haskell-cafe] Parsec (Zero or One of)

2008-03-25 Thread Brandon S. Allbery KF8NH
On Mar 25, 2008, at 12:43 , Paul Keir wrote: Thanks. I can't find optionMaybe in my version 2.1 of Parsec, but in any case, defining my only_prod as only_prod = do { reserved only; option [] identifier } or only_prod = do { reserved only; identifier | return [] } gives the same error

RE: [Haskell-cafe] Parsec (Zero or One of)

2008-03-25 Thread Paul Keir
Thankyou. Yes, I'd also noticed that only end could result in the end part being taken as an identifier. The language I'm parsing actually doesn't have reserved words though; so end and only are both possible valid identifiers. I should then probably replace my use of say, reserved only, with

Re: [Haskell-cafe] Parsec (Zero or One of)

2008-03-25 Thread Brandon S. Allbery KF8NH
On Mar 25, 2008, at 16:26 , Paul Keir wrote: Thankyou. Yes, I'd also noticed that only end could result in the end part being taken as an identifier. The language I'm parsing actually doesn't have reserved words though; so end and only are both possible valid identifiers. I should then

Re: [Haskell-cafe] True parallelism missing :-(

2008-03-25 Thread Don Stewart
To avoid this in future, you can use the strict-concurrency package on hackage, which has some stricter container types, with their strategies. MVars and Chans are the main examples of where a stricter strategy is sometimes useful. kolar: Yes, that's is. Thanks. My fault - missing wood seeing

Re: [Haskell-cafe] Monad instance for Data.Set

2008-03-25 Thread Ryan Ingram
I was experimenting with Prompt today and found that you can get a restricted monad style of behavior out of a regular monad using Prompt: {-# LANGUAGE GADTs #-} module SetTest where import qualified Data.Set as S Prompt is available from

[Haskell-cafe] Re: Libraries need a new owner

2008-03-25 Thread Don Stewart
ahey: Don Stewart wrote: ahey: Hello Folks, As some of you will be aware, I have been working on various Map implementations that currently live here.. http://code.haskell.org/collections/collections-ghc6.8 The libs in question being Data.Tree.AVL, Data.Trie.General and a few other

Re: [Haskell-cafe] Monad instance for Data.Set

2008-03-25 Thread Ganesh Sittampalam
On Tue, 25 Mar 2008, Ryan Ingram wrote: I was experimenting with Prompt today and found that you can get a restricted monad style of behavior out of a regular monad using Prompt: I recently developed a similar trick: http://hsenag.livejournal.com/11803.html It uses the regular MonadPlus

Re: [Haskell-cafe] Terminating GLUT/GLFW programs

2008-03-25 Thread Luke Palmer
On Tue, Mar 25, 2008 at 7:37 PM, Paul L [EMAIL PROTECTED] wrote: Peter is right at saying it's the sample GLFW program that didn't handle Window Close event. I didn't double check his modification because I run Linux/X11 with xmonad where there is no CLOSE button for any window, but I trust

Re: [Haskell-cafe] Terminating GLUT/GLFW programs

2008-03-25 Thread Luke Palmer
Er, not Ctrl, of course... Mod-Shift-C. /me goes to punish his hand for compusive send presses. On Tue, Mar 25, 2008 at 10:40 PM, Luke Palmer [EMAIL PROTECTED] wrote: On Tue, Mar 25, 2008 at 7:37 PM, Paul L [EMAIL PROTECTED] wrote: Peter is right at saying it's the sample GLFW program that

RE: [Haskell-cafe] Parsec (Zero or One of)

2008-03-25 Thread Paul Keir
Many thanks. -Original Message- From: Brandon S. Allbery KF8NH [mailto:[EMAIL PROTECTED] Sent: Tue 25/03/2008 20:29 To: Paul Keir; haskell-cafe@haskell.org Cafe Subject: Re: [Haskell-cafe] Parsec (Zero or One of) On Mar 25, 2008, at 16:26 , Paul Keir wrote: Thankyou. Yes, I'd also

Re: [Haskell-cafe] Gtk2hs on GHC6.8.2?

2008-03-25 Thread Ryan Ingram
Thanks, works like a charm! -- ryan On 3/24/08, Duncan Coutts [EMAIL PROTECTED] wrote: You are in luck however, I did a build with ghc-6.8.2 just the other day but hadn't announced it yet: http://haskell.org/~duncan/gtk2hs/gtk2hs-0.9.12.1.exe ___

Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread Manuel M T Chakravarty
Simon Peyton-Jones: | | However, I think I now understand what you are worried about. It is the | | interaction of type families and GHC's generalised type synonyms (i.e., | | type synonyms that may be partially applied). I agree that it does lead | | to an odd interaction, because the

Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread Manuel M T Chakravarty
Claus Reinke: one might say that the central point of example two were two partially applied type synonym families in the same position (rhs of a type synonym family instance definition). usually, when reduction meets typing, there is a subject reduction theorem, stating that types do not

Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread Manuel M T Chakravarty
Claus Reinke wrote, given that type families are never meant to be partially applied, perhaps a different notation, avoiding confusion with type constructor applications in favour of something resembling products, could make that clearer? something simple, like braces to group families and

Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread Hugo Pacheco
The extra syntax has its advantages (more local information) and disadvantages (more clutter). We weren't convinced that we need the extra syntax, so left it out for the moment. However, this is something that can always be changed if experience shows that programs are easier to understand

Re: [Haskell-cafe] Equality constraints in type families

2008-03-25 Thread Manuel M T Chakravarty
Dan Doel: On Tuesday 11 March 2008, Tom Schrijvers wrote: I think you've uncovered a bug in the type checker. We made the design choice that type functions with a higher-kinded result type must be injective with respect to the additional paramters. I.e. in your case: F x y

[Haskell-cafe] Haskell in Web Browser: draft tutorial

2008-03-25 Thread Dimitry Golubovsky
Hi, I have written a draft of the tutorial on Haskell programming for client side of Web applications (related to Yhc/Javascript backend): http://www.haskell.org/haskellwiki/Haskell_in_web_browser Any feedback, suggestions, and additions (like your own code examples) are welcome. Thanks. PS