[Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Vasili I. Galchin
Hello, I am currently using ghc 6.8.2. With the following, swishParse :: String - String - SwishStateIO (Maybe RDFGraph) swishParse fnam inp = do { fmt - gets $ format ; case fmt of N3- swishParseN3 fnam inp otherwise - do {

Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Janis Voigtlaender
Vasili I. Galchin wrote: It seems to me that in the code base somewhere that there is a redefine of the keywordotherwise. I haven't read the Haskell 98 Report but I thought that it was not possible to redefine keywords. ?? otherwise is not a keyword. It is just defined as a normal function

Re: [Haskell-cafe] A Reader Monad Tutorial

2009-06-28 Thread Lee Duhem
On Sun, Jun 28, 2009 at 12:41 AM, Henry Laxennadine.and.he...@pobox.com wrote: Dear Group, If any of you are struggling with understanding monads, I've tried to put together a pretty through explanation of what is behind the Reader monad.  If you're interested, have a look at:

Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Janis Voigtlaender
Vasili I. Galchin wrote: so Janis I have to look where the original author overrode otherwise? If so, just great .. a ton of code. ;^( No, you don't have to look for this. It is in the code snippet you sent: swishParse :: String - String - SwishStateIO (Maybe RDFGraph) swishParse fnam inp =

Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Kim-Ee Yeoh
Hi Vasili, This isn't really a shadowing/redefinition issue. Here's a perfectly legitimate snippet that compiles fine: f 0 = 0 f otherwise = 1+otherwise Redefinition is when you have: g = let otherwise = not in x -- Kim-Ee VasiliIGalchin wrote: swishParse :: String - String -

Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Kim-Ee Yeoh
I meant, of course, g = let otherwise = not in otherwise Sorry for the noise. -- Kim-Ee Kim-Ee Yeoh wrote: Hi Vasili, This isn't really a shadowing/redefinition issue. Here's a perfectly legitimate snippet that compiles fine: f 0 = 0 f otherwise = 1+otherwise Redefinition is

Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Bulat Ziganshin
Hello Vasili, Sunday, June 28, 2009, 10:39:37 AM, you wrote:     ; case fmt of     N3    - swishParseN3 fnam inp     otherwise -     do  { swishError (Unsupported file format: ++(show fmt)) 4     ; return Nothing     }  

Re: [Haskell-cafe] Rigid type variable error

2009-06-28 Thread Jason Dagit
On Sat, Jun 27, 2009 at 10:45 PM, Darryn djr...@aapt.net.au wrote: Thanks for the help previously received, but I still cannot seem to get on top of this. The types for the constructor K will not resolve and I'm at a loss to work out what to do with it. If anyone can offer a further

Re: [Haskell-cafe] Rigid type variable error

2009-06-28 Thread Daniel Fischer
Am Sonntag 28 Juni 2009 07:45:33 schrieb Darryn: Thanks for the help previously received, but I still cannot seem to get on top of this. The types for the constructor K will not resolve and I'm at a loss to work out what to do with it. If anyone can offer a further explanation and help I would

[Haskell-cafe] Re: test-framework success

2009-06-28 Thread Max Bolingbroke
2009/6/28 Simon Michael si...@joyful.com: But, I can now add -j8 and get the same results output in.. 0.13s. This quite surprised me, and now I want to say: thank you very much! :) Awesome! I'm really glad to hear you are having success with the package! For anyone else on the list who wants

[Haskell-cafe] Re: FFI and heap memory usage limit

2009-06-28 Thread Marcin Kosiba
On Friday 26 June 2009, Simon Marlow wrote: Maybe bzlib allocates using malloc()? That would not be tracked by GHC's memory management, but could cause OOM. probably, because it's a binding to a C library. I'm really busy right now, but I'll try and create a small program to repro this error.

Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Felipe Lessa
On Sun, Jun 28, 2009 at 12:49:12AM -0700, Kim-Ee Yeoh wrote: This isn't really a shadowing/redefinition issue. Here's a perfectly legitimate snippet that compiles fine: f 0 = 0 f otherwise = 1+otherwise What? It is a redefinition issue *as well*, but this kind of warning isn't active by

[Haskell-cafe] Half-integer

2009-06-28 Thread Andrew Coppin
I just wrote a small module for dealing with half-integers. (That is, any number I/2 where I is an integer. Note that the set of integers is a subset of this; Wikipedia seems to reserve half-integer for such numbers that are *not* integers.) module HalfInteger where data HalfInteger i

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Felipe Lessa
On Sun, Jun 28, 2009 at 02:24:30PM +0100, Andrew Coppin wrote: Now, the question is... Is this useful enough to be worth putting on Hackage? Why not? :) -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Magnus Therning
Felipe Lessa wrote: On Sun, Jun 28, 2009 at 02:24:30PM +0100, Andrew Coppin wrote: Now, the question is... Is this useful enough to be worth putting on Hackage? Why not? :) Just upload it! I mean, at any point in time most package on hackage will be useless _to_me_. That doesn't mean

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Thomas ten Cate
On Sun, Jun 28, 2009 at 15:24, Andrew Coppinandrewcop...@btinternet.com wrote: I just wrote a small module for dealing with half-integers. (That is, any number I/2 where I is an integer. Note that the set of integers is a subset of this; Wikipedia seems to reserve half-integer for such numbers

[Haskell-cafe] Re: A Reader Monad Tutorial

2009-06-28 Thread Henry Laxen
Lee Duhem lee.duhem at gmail.com writes: Nice post. I didn't find how to add comments on your blog, so I post them here: ... Dear Lee, Thank you for your comments and corrections. I have included all of them in the new version of the article. Best wishes, Henry Laxen

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Andrew Coppin
Thomas ten Cate wrote: Out of curiosity, what are *you* using it for? Centering things. In you have an odd number of items, the middle one will be at position 0, with the others at integer positions on either side. However, if you have an even number, the middle two will be at 0 +- 1/2,

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Andrew Coppin
Felipe Lessa wrote: On Sun, Jun 28, 2009 at 02:24:30PM +0100, Andrew Coppin wrote: Now, the question is... Is this useful enough to be worth putting on Hackage? Why not? :) Well, it *does* mean I'll have to figure out how Cabal actually works...

[Haskell-cafe] What is an expected type ...

2009-06-28 Thread michael rice
as opposed to an inferred type? Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] What is an expected type ...

2009-06-28 Thread Martijn van Steenbergen
Hi Michael, michael rice wrote: as opposed to an inferred type? Can you deduce from the following example? Prelude let foo = () :: Int interactive:1:10: Couldn't match expected type `Int' against inferred type `()' In the expression: () :: Int In the definition of `foo': foo =

Re: [Haskell-cafe] What is an expected type ...

2009-06-28 Thread Joe Fredette
When Haskell runs it's type checker, it tries to guess the type of each function. Thats why you can write: map (+1) and it knows that you're talking about a function of type: Num a = [a] - [a] Another thing, called 'defaulting' resolves this, but you didn't ask about that, so I won't

Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Brandon S. Allbery KF8NH
On Jun 28, 2009, at 02:39 , Vasili I. Galchin wrote: ; case fmt of N3- swishParseN3 fnam inp otherwise - do { swishError (Unsupported file format: ++(show fmt)) 4 ; return Nothing } } I

Re: [Haskell-cafe] What is an expected type ...

2009-06-28 Thread Brandon S. Allbery KF8NH
On Jun 28, 2009, at 12:02 , michael rice wrote: dec2bin :: Integer - [Integer] dec2bin n = dec2bin' n [] where dec2bin' n acc | n == 0 = acc | otherwise = let r = rem n 2 m = div (n - r) 2

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Deniz Dogan
2009/6/28 Andrew Coppin andrewcop...@btinternet.com: Felipe Lessa wrote: On Sun, Jun 28, 2009 at 02:24:30PM +0100, Andrew Coppin wrote: Now, the question is... Is this useful enough to be worth putting on Hackage? Why not?  :) Well, it *does* mean I'll have to figure out how Cabal

Re: [Haskell-cafe] What is an expected type ...

2009-06-28 Thread michael rice
Hey Joe, all, Got it. Thanks! An associated question: In programming a local helper or auxilliary function such as dec2bin' in dec2bin :: Integer - [Integer] dec2bin n = dec2bin' n []     where dec2bin' n acc     | n == 0 = acc     | otherwise = let r =

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Andrew Coppin
Deniz Dogan wrote: 2009/6/28 Andrew Coppin andrewcop...@btinternet.com: Felipe Lessa wrote: On Sun, Jun 28, 2009 at 02:24:30PM +0100, Andrew Coppin wrote: Now, the question is... Is this useful enough to be worth putting on Hackage? Why not? :) Well, it

Re: [Haskell-cafe] What is an expected type ...

2009-06-28 Thread michael rice
How else? ;-) Thanks, Michael --- On Sun, 6/28/09, Brandon S. Allbery KF8NH allb...@ece.cmu.edu wrote: From: Brandon S. Allbery KF8NH allb...@ece.cmu.edu Subject: Re: [Haskell-cafe] What is an expected type ... To: michael rice nowg...@yahoo.com Cc: Brandon S. Allbery KF8NH

Re: [Haskell-cafe] What is an expected type ...

2009-06-28 Thread Daniel Fischer
Am Sonntag 28 Juni 2009 18:06:52 schrieb Brandon S. Allbery KF8NH: On Jun 28, 2009, at 12:02 , michael rice wrote: dec2bin :: Integer - [Integer] dec2bin n = dec2bin' n [] where dec2bin' n acc | n == 0 = acc | otherwise = let r = rem

Re: [Haskell-cafe] What is an expected type ...

2009-06-28 Thread Thomas ten Cate
On Sun, Jun 28, 2009 at 17:14, michael ricenowg...@yahoo.com wrote: as opposed to an inferred type? There was a thread on haskell-cafe about this a few weeks ago. Here it is in the archives: http://www.haskell.org/pipermail/haskell-cafe/2009-May/062012.html Maybe some post in there might help.

[Haskell-cafe] ANNOUNCE: X Haskell Bindings 0.3

2009-06-28 Thread Antoine Latter
I'd like to announce the 0.3.* series release of the X Haskell Bindings. This release, like the prior 0.2.* series focuses on making the API prettier. This release is based on the XCB protocol descriptions version 1.5 This does mean that there's a good chance this is a breaking release for any

[Haskell-cafe] Re: ANNOUNCE: X Haskell Bindings 0.3

2009-06-28 Thread Antoine Latter
On Sun, Jun 28, 2009 at 12:52 PM, Antoine Latteraslat...@gmail.com wrote: I'd like to announce the 0.3.* series release of the X Haskell Bindings.  This release, like the prior 0.2.* series focuses on making the API prettier. This release is based on the XCB protocol descriptions version 1.5

Re: [Haskell-cafe] What is an expected type ...

2009-06-28 Thread Dan Piponi
I really dislike this error message, and I think the terms are ambiguous. I think the words 'expected' and 'inferred' apply equally well to the term, and the context in which it has been found. Both of the incompatible types were 'inferred', and 'unexpected' is a property of the combination, not a

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Andrew Coppin
Andrew Coppin wrote: Deniz Dogan wrote: 2009/6/28 Andrew Coppin andrewcop...@btinternet.com: Well, it *does* mean I'll have to figure out how Cabal actually works... Usually, it's pretty straight-forward and most options are self-explanatory.

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Antoine Latter
On Sun, Jun 28, 2009 at 2:13 PM, Andrew Coppinandrewcop...@btinternet.com wrote: Oh, one last thing. I know I'm going to regret this for the rest of my life, but... which version of Base should it depend on? Which versions of base have you tested it with? :-) Antoine

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Andrew Coppin
Antoine Latter wrote: On Sun, Jun 28, 2009 at 2:13 PM, Andrew Coppinandrewcop...@btinternet.com wrote: Oh, one last thing. I know I'm going to regret this for the rest of my life, but... which version of Base should it depend on? Which versions of base have you tested it with? :-)

Re: [Haskell-cafe] Half-integer

2009-06-28 Thread Max Rabkin
On Sun, Jun 28, 2009 at 9:29 PM, Andrew Coppinandrewcop...@btinternet.com wrote: Which versions of base have you tested it with?  :-) Whichever one GHC 6.10.3 ships with... ghc-pkg list base will tell you which version you have installed. Frankly, I highly doubt it makes any difference

Re: [Haskell-cafe] shadowing keywords like otherwise

2009-06-28 Thread Kim-Ee Yeoh
Whoops, you're right. Interestingly, the shadowing warnings vary between the 2 examples I gave, i.e. shadowing within 'function definition' vs 'binding group'. Felipe Lessa wrote: On Sun, Jun 28, 2009 at 12:49:12AM -0700, Kim-Ee Yeoh wrote: This isn't really a shadowing/redefinition

Re: [Haskell-cafe] What is an expected type ...

2009-06-28 Thread Kim-Ee Yeoh
Could you suggest a better word pair to describe the dichotomy then? How about 'calculated' vs 'user-imposed' (or even, 'explicitly- signatured')? Dan Piponi-2 wrote: I really dislike this error message, and I think the terms are ambiguous. I think the words 'expected' and 'inferred' apply

Re[2]: [Haskell-cafe] What is an expected type ...

2009-06-28 Thread Bulat Ziganshin
Hello Kim-Ee, Sunday, June 28, 2009, 11:52:57 PM, you wrote: we already had a *long* discussion on this topic. afaik, it's dichotomy between type of term itself and type of position where it's used (f.e. argument of some function) Could you suggest a better word pair to describe the dichotomy

[Haskell-cafe] Cabal fun [Half-integer]

2009-06-28 Thread Andrew Coppin
Max Rabkin wrote: On Sun, Jun 28, 2009 at 9:29 PM, Andrew Coppinandrewcop...@btinternet.com wrote: Which versions of base have you tested it with? :-) Whichever one GHC 6.10.3 ships with... ghc-pkg list base will tell you which version you have installed. Which tells me

Re: [Haskell-cafe] What is an expected type ...

2009-06-28 Thread Arne Dehli Halvorsen
Bulat Ziganshin wrote: Hello Kim-Ee, Sunday, June 28, 2009, 11:52:57 PM, you wrote: we already had a *long* discussion on this topic. afaik, it's dichotomy between type of term itself and type of position where it's used (f.e. argument of some function) Could you suggest a better word

Re: [Haskell-cafe] Cabal fun [Half-integer]

2009-06-28 Thread Andrew Coppin
Andrew Coppin wrote: Alrighty then, so how I just do Setup configure, and now Setup sdist, and then I can upload the result to Ha-- oh, don't be silly. That would simply be too easy. ;-) E:\Haskell\AOC-HalfIntegerrunhaskell Setup sdist Building source dist for AOC-HalfInteger-1.0...

Re: [Haskell-cafe] Cabal fun [Half-integer]

2009-06-28 Thread Antoine Latter
On Sun, Jun 28, 2009 at 3:42 PM, Andrew Coppinandrewcop...@btinternet.com wrote: Andrew Coppin wrote: Alrighty then, so how I just do Setup configure, and now Setup sdist, and then I can upload the result to Ha-- oh, don't be silly. That would simply be too easy. ;-)

Re: [Haskell-cafe] Re: test-framework success

2009-06-28 Thread Felipe Lessa
On Sun, Jun 28, 2009 at 11:07:27AM +0100, Max Bolingbroke wrote: Awesome! I'm really glad to hear you are having success with the package! BTW, thanks for fixing the spacing issue with nested tests! :) -- Felipe. ___ Haskell-Cafe mailing list

[Haskell-cafe] C global vars local to threads

2009-06-28 Thread Maurí­cio
I would like to write a wrapper to C global variable, but that variable is unique to each thread. Is there some native support on that in Haskell FFI? (I imagine I probably should write a C function to get its pointer as an 'IO (Ptr ...)', but I would like to check if there's a more standard way

[Haskell-cafe] parallel haskell

2009-06-28 Thread Kevin Smith
I'm interested in doing some research with parallel programming using Haskell (both multi-core on one machine and clusters using multiple machines) but in going through the various resources on the web (looking at GPH and others), it is not clear to me what the current state is as many of the

Re: [Haskell-cafe] Cabal fun [Half-integer]

2009-06-28 Thread Derek Elkins
On Sun, Jun 28, 2009 at 4:11 PM, Antoine Latteraslat...@gmail.com wrote: On Sun, Jun 28, 2009 at 3:42 PM, Andrew Coppinandrewcop...@btinternet.com wrote: Andrew Coppin wrote: Alrighty then, so how I just do Setup configure, and now Setup sdist, and then I can upload the result to Ha-- oh,

[Haskell-cafe] List spine traversal

2009-06-28 Thread Tony Morris
Is there a canonical function for traversing the spine of a list? I could use e.g. (seq . length) but this feels dirty, so I have foldl' (const . const $ ()) () which still doesn't feel right. What's the typical means of doing this? -- Tony Morris http://tmorris.net/

Re: [Haskell-cafe] parallel haskell

2009-06-28 Thread Don Stewart
k2msmith: I'm interested in doing some research with parallel programming using Haskell (both multi-core on one machine and clusters using multiple machines) but in going through the various resources on the web (looking at GPH and others), it is not clear to me what the current state is as

[Haskell-cafe] Haskell Platform + gtk2hs

2009-06-28 Thread John Van Enk
List, Has any one managed to install gtk2hs on a Windows box running the Haskell Platform? I've had no luck; it seems the gtk2hs installer is unable to find the GHC installation. /jve ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] How to convert CPid to Word32?

2009-06-28 Thread Magicloud Magiclouds
Hi, I am trying to use Data.Binary with ProcessID. Well, how to convert between CPid and Word32? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] How to convert CPid to Word32?

2009-06-28 Thread Thomas DuBuisson
fromIntegral should do the trick. Thomas On Sun, Jun 28, 2009 at 7:48 PM, Magicloud Magicloudsmagicloud.magiclo...@gmail.com wrote: Hi, I am trying to use Data.Binary with ProcessID. Well, how to convert between CPid and Word32? Thanks. -- 竹密岂妨流水过 山高哪阻野云飞