Re: [Haskell-cafe] Same compiled program behaving differently when called from ghci and shell

2010-11-21 Thread Manlio Perillo
Il 21/11/2010 06:49, Bruno Damour ha scritto: Hello, I have a very strange (for me) problem that I manage to reduce to this : I have a small program that reads a file with 1 only character (è = e8) The program is ftest2.hs : [...] The only difference I can see is the codepage used. The

Re: [Haskell-cafe] Same compiled program behaving differently when called from ghci and shell

2010-11-21 Thread Manlio Perillo
Il 21/11/2010 19:06, Bruno Damour ha scritto: Le 21/11/10 17:21, Manlio Perillo a écrit : Il 21/11/2010 06:49, Bruno Damour ha scritto: Hello, I have a very strange (for me) problem that I manage to reduce to this : I have a small program that reads a file with 1 only character (è = e8

Re: [Haskell-cafe] Same compiled program behaving differently when called from ghci and shell

2010-11-21 Thread Manlio Perillo
Il 21/11/2010 19:28, Bruno Damour ha scritto: [...] Of course you're right but that was a surprise to me... G:\CODE\rlibchcp 1252 Page de codes active: 1252 G:\CODE\rlibftest3.exe è Just '1' G:\CODE\rlibchcp 850 Page de codes active : 850 G:\CODE\rlibftest3.exe è Just '2'

Re: [Haskell-cafe] Same compiled program behaving differently when called from ghci and shell

2010-11-21 Thread Manlio Perillo
Il 21/11/2010 21:51, Manlio Perillo ha scritto: [...] There are 3 solutions: 1) open the file in binary mode 2) set the console codepage to 1252. I do this by changing the Command Prompt shortcut destination to: `%SystemRoot%\system32\cmd.exe /k chcp 1252` 3) explicitly set

Re: [Haskell-cafe] Re: dynamic loading of code on windows

2010-11-12 Thread Manlio Perillo
Il 12/11/2010 19:01, Kevin Jardine ha scritto: This isn't about the plugin functionality, it's about compiling code. As the message says : This requires a Unix compatibility toolchain such as MinGW+MSYS or Cygwin. Is it really necessary to use autoconf? I have read the autoconf.ac file

[Haskell-cafe] back doors into the IO monad

2010-10-23 Thread Manlio Perillo
Hi. What are the available methods to execute IO actions from pure code? I know only unsafePerformIO and foreign import (to call a non pure foreign function). Assuming I want to execute external untrusted code using plugins (via the `plugins` package), is it possible to completely forbid

[Haskell-cafe] surrogate code points in a Char

2009-11-18 Thread Manlio Perillo
Hi. The Unicode Standard (version 4.0, section 3.9, D31 - pag 76) says: Because surrogate code points are not included in the set of Unicode scalar values, UTF-32 code units in the range D800 .. DFFF are ill-formed However GHC does not reject this code units: Prelude print '\xD800'

Re: [Haskell-cafe] attoparsec and parsec

2009-11-15 Thread Manlio Perillo
Jason Dusek ha scritto: To add to the confusion, I forked `bytestringparser` when I wrote the `json-b` package. The fork is here: http://hackage.haskell.org/package/bytestringparser-temporary/ I have added a number of things to original as well as fixing some problems with it.

[Haskell-cafe] Lexical Syntax and Unicode

2009-11-14 Thread Manlio Perillo
- PARAGRAPH SEPARATOR Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] attoparsec and parsec

2009-11-14 Thread Manlio Perillo
://hackage.haskell.org/package/bytestringparser what is the status of this package? It has the same API of attoparsec, but its older. However there is no indication that this package is deprecated in favor of attoparsec. Thanks Manlio Perillo ___ Haskell

Re: [Haskell-cafe] Converting IO [XmlTree] to [XmlTree]

2009-04-21 Thread Manlio Perillo
Luke Palmer ha scritto: [...] Note that it is not always possible to separate IO from pure code. As an example, consider an HTTP 1.1 server that read a request body containing a number for each line, and return a response body containing the sum of the numbers. What?

Re: [Haskell-cafe] Converting IO [XmlTree] to [XmlTree]

2009-04-19 Thread Manlio Perillo
from pure computation. And you can not use lazy IO, if you want your server to support HTTP 1.1 pipelining. Regards Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Maybe off-topic -- Writing contracts or software specifications

2009-04-08 Thread Manlio Perillo
Maurí­cio ha scritto: Hi, [...] I need, for instance, to write a contract with a programmer we are hiring for a task. [...] The question is: how much do you trust the programmer? And how much do the programmer trust you? Much of the complications of the contracts arise from the need to

[Haskell-cafe] advice on space efficient data structure with efficient snoc operation

2009-04-07 Thread Manlio Perillo
array. I don't know if this is easy/efficient to implement in Haskell. Any other suggestions? Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] advice on space efficient data structure with efficient snoc operation

2009-04-07 Thread Manlio Perillo
Edward Kmett ha scritto: I'm in the process of adding a Data.Sequence.Unboxed to unboxed-containers. I hope to have it in hackage today or tomorrow, should its performance work out as well as Data.Set.Unboxed. Looking at the data definition of Data.Sequence I suspect that it is not really

Re: [Haskell-cafe] binary package: memory problem decoding an IntMap

2009-04-05 Thread Manlio Perillo
Manlio Perillo ha scritto: Hi. I'm having memory problems decoding a big IntMap. The data structure is: IntMap (UArr (Word16 :*: Word8)) There are 480189 keys, and a total of 100480507 elements (Netflix Prize). The size of the encoded (and compressed) data is 184 MB. When I load data from

Re: [Haskell-cafe] binary package: memory problem decoding an IntMap

2009-04-05 Thread Manlio Perillo
Manlio Perillo ha scritto: [...] It seems there is a problem with tuples, too. I have a: [(Word16, UArr (Word32 :*:* Word8))] This eats more memory than it should, since tuples are decoded lazily. My bad, sorry. I simply solved by using a strict consumer (foldl' instead of foldl

[Haskell-cafe] about import alias

2009-04-04 Thread Manlio Perillo
Hi. Haskell 98 allows import alias: import qualified VeryLongModuleName as C however it does not allow aliasing for imported names import NormalModule (veryLongFunctionName as C) what is the rational? IMHO this can be very useful in some cases. Thanks Manlio

[Haskell-cafe] binary package: memory problem decoding an IntMap

2009-04-02 Thread Manlio Perillo
? Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] uvector package appendU: memory leak?

2009-04-01 Thread Manlio Perillo
wren ng thornton ha scritto: Manlio Perillo wrote: Since ratings for each customers are parsed at the same time, using a plain list would consume a lot of memory, since stream fusion can only be executed at the end of the parsing. On the other hand, when I want to group ratings by movies

Re: [Haskell-cafe] uvector package appendU: memory leak?

2009-03-31 Thread Manlio Perillo
Claus Reinke ha scritto: appendU is strict, insertWith just doesn't force it (follow the source link in the haddocks to see why). Ok, I see. But, IMHO, this should be clearly documented. There seems to be some agreement that strict variant operations should also be provided, but it needs

Re: [Haskell-cafe] uvector package appendU: memory leak?

2009-03-31 Thread Manlio Perillo
implementation of the the Netflix Prize in D language, I used a similar implementation, base on: http://mdounin.ru/hg/nginx-vendor-current/file/tip/src/core/ngx_list.h Unfortunately, D garbage collector is really bad when there are a lot of allocations, so I gave up. Manlio Perillo

Re: [Haskell-cafe] Haddock: inserting interactive sessions in the documentation

2009-03-31 Thread Manlio Perillo
Wouter Swierstra ha scritto: What is the suggested (if any) convention for inserting an interactive session in the documentation? You may want to look at: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/DocTest Ah, ok, thanks. So convention is to just use `-- `. Manlio

Re: [Haskell-cafe] uvector package appendU: memory leak?

2009-03-30 Thread Manlio Perillo
Claus Reinke ha scritto: But Claus was right, appendU is lazy; this seems to be the cause of the problem. appendU is strict, insertWith just doesn't force it (follow the source link in the haddocks to see why). Ok, I see. But, IMHO, this should be clearly documented. I have updated my test

Re: [Haskell-cafe] uvector package appendU: memory leak?

2009-03-30 Thread Manlio Perillo
Don Stewart ha scritto: Can I close this ticket as not being to do with uvector? Yes, thanks; and sorry for the noise. But it may be interesting to study this the example I have pasted: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3103 I find it a bit surprising that using appendU is

[Haskell-cafe] Haddock: inserting interactive sessions in the documentation

2009-03-30 Thread Manlio Perillo
Hi. What is the suggested (if any) convention for inserting an interactive session in the documentation? Right know I'm doing (in random-shuffle package): -- |Convert a sequence @(e1...en)@ to a complete binary tree. -- -- @ -- System.Random.Shuffle buildTree ['a','b','c','d','e'] -- Node

[Haskell-cafe] uvector package appendU: memory leak?

2009-03-29 Thread Manlio Perillo
Hi. As with a previous post, I think I have found a possible memory problem with the uvector package. I have this data structure (for, again, my Netflix Prize project): IntMap (UArr (Word16 :*: Word8)) I was adding elements to the map using something like: v = map singletonU (a :*:

Re: [Haskell-cafe] uvector package appendU: memory leak?

2009-03-29 Thread Manlio Perillo
Don Stewart ha scritto: [...] So the question is: why appending an array of only one element to an existing array causes memory problems? It must copy the entire array. Isn't it the same with snocU? And, since the final result is the same, what happens to the temporary memory used for

Re: [Haskell-cafe] uvector package appendU: memory leak?

2009-03-29 Thread Manlio Perillo
Manlio Perillo ha scritto: Hi. As with a previous post, I think I have found a possible memory problem with the uvector package. I have this data structure (for, again, my Netflix Prize project): IntMap (UArr (Word16 :*: Word8)) [...] Today I have rewritten my program to use `alter

Re: [Haskell-cafe] uvector package appendU: memory leak?

2009-03-29 Thread Manlio Perillo
Claus Reinke ha scritto: IntMap (UArr (Word16 :*: Word8)) I was adding elements to the map using something like: v = map singletonU (a :*: b) insertWith appendU k v m However doing this eats a *lot* of memory. Since 'insertWith' doesn't actually do the 'appendU', the appends

Re: [Haskell-cafe] uvector package appendU: memory leak?

2009-03-29 Thread Manlio Perillo
Don Stewart ha scritto: manlio_perillo: Don Stewart ha scritto: [...] So the question is: why appending an array of only one element to an existing array causes memory problems? It must copy the entire array. Isn't it the same with snocU? And, since the final result is the same, what

[Haskell-cafe] g++ std:map vs GHC IntMap

2009-03-26 Thread Manlio Perillo
/hpaste.fcgi/view?id=2902 but memory usage is 703 MB, and execution time is about 4.5 times slower! Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-26 Thread Manlio Perillo
Claus Reinke ha scritto: Continuing our adventures into stylistic and semantic differences:-) Can you write this analysis on the wiki? Thanks! Manlio ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] g++ std:map vs GHC IntMap

2009-03-26 Thread Manlio Perillo
Brandon S. Allbery KF8NH ha scritto: On 2009 Mar 26, at 11:39, Manlio Perillo wrote: The execution time and CPU usage is almost the same. However the C++ version requires 305 MB, the GHC version 617 MB. I wonder how much of that is due to lifting (i.e. laziness). http://hpaste.org/fastcgi

Re: [Haskell-cafe] g++ std:map vs GHC IntMap

2009-03-26 Thread Manlio Perillo
Bulat Ziganshin ha scritto: Hello Manlio, Thursday, March 26, 2009, 6:39:12 PM, you wrote: The test consists in adding 1000 elements to an empty map. +RTS -c -F1.1 then read about garbage collection It now requires 386 MB of memory, but is 4.7 times slower. So, now memory required

[Haskell-cafe] Re: generalized shuffle

2009-03-25 Thread Manlio Perillo
o...@okmij.org ha scritto: Hello! The reason is that in a project I need to extract random elements from a list (and I need to extract a lot of them), and using normal methods [1] seems to be rather inefficient. Note that I have used an incorrect term, sorry. What I need, in

Re: [Haskell-cafe] Re: about Haskell code written to be too smart

2009-03-25 Thread Manlio Perillo
Heinrich Apfelmus ha scritto: Manlio Perillo wrote: Conal Elliott ha scritto: Manlio, We live in the age of participation -- of co-education. Don't worry about text-books. Contribute to some wiki pages blogs today that share these smart techniques with others. When I started learning

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-25 Thread Manlio Perillo
wren ng thornton ha scritto: Manlio Perillo wrote: [...] Following directly from the Rule of Least Power, if you can get away with foreach then that's what you should use. Why? Because the less power the construct has, the fewer corner cases and generalizations a reader of the code needs

[Haskell-cafe] a cabal package with both a library and executable programs

2009-03-25 Thread Manlio Perillo
Hi. This example is taken from the Cabal documentation: Name:TestPackage ... Library Build-Depends: HUnit Exposed-Modules: A, B, C Executable program1 Main-Is: Main.hs Hs-Source-Dirs: prog1 Other-Modules: A, B Executable program2 Main-Is: Main.hs

[Haskell-cafe] Equations for `foo' have different numbers of arguments

2009-03-24 Thread Manlio Perillo
' have different numbers of arguments With HUGS: Equations give different arities for divide However the two equations really have the same number of arguments. What's the problem? Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe

[Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Hi. In these days I'm discussing with some friends, that mainly use Python as programming language, but know well other languages like Scheme, Prolog, C, and so. These friends are very interested in Haskell, but it seems that the main reason why they don't start to seriously learning it, is

Re: [Haskell-cafe] Equations for `foo' have different numbers of arguments

2009-03-24 Thread Manlio Perillo
Bulat Ziganshin ha scritto: Hello Manlio, Tuesday, March 24, 2009, 5:44:14 PM, you wrote: divide _ 0 = error division by 0 divide = (/) Equations for `divide' have different numbers of arguments you should write divide a b = a/b Right. But my question was: why can't I write the

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Tim Newsham ha scritto: These friends are very interested in Haskell, but it seems that the main reason why they don't start to seriously learning it, is that when they start reading some code, they feel the Perl syndrome. That is, code written to be too smart, and that end up being totally

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Jake McArthur ha scritto: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Manlio Perillo wrote: | These friends are very interested in Haskell, but it seems that the main | reason why they don't start to seriously learning it, is that when they | start reading some code, they feel the Perl

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Jake McArthur ha scritto: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Manlio Perillo wrote: | This is right. | The problem is that often (IMHO) a function definition can be rewritten | so that it is much more readable. | | As an example, with the takeList function I posted. I looked

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Yitzchak Gale ha scritto: [...] So the bottom line is that Manlio is right, really. It's just that Haskell is still very different than what most programmers are used to. So it does take a while to get a feeling for what is too smart. Right, you centered the problem! The problem is where to

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Jake McArthur ha scritto: [...] | With my function, instead, you only have to follow 1 operation: | | Prelude (head, tail) = splitAt n xs I think you are way oversimplifying your own code. ~takeList :: [Int] - [a] - [[a]] ~takeList [] _ = [] ~takeList _ [] = [] ~

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Conal Elliott ha scritto: Another helpful strategy for the reader is to get smarter, i.e. to invest effort in rising to the level of the writer. Or just choose a different book if s/he prefers. - Conal This strategy is doomed to failure, unfortunately. We live in the real world,

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Jonathan Cast ha scritto: [...] I think, in general, the best way to document the purpose of the function is -- | Split a function into a sequence of partitions of specified lenth takeList :: [Int] - [a] - [[a]] Note that I was not speaking about the best way to document a function.

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Zachary Turner ha scritto: [...] but I do understand that one of the primary uses cases and/or motivating factors for using Haskell is when you really just NEED that extra abstraction and power you get from being able to do these types of things. Someone once said that simple problems

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Erik de Castro Lopo ha scritto: Manlio Perillo wrote: I was speaking about the best way to write a function, so that it may help someone who is learning Haskell. I've been learning Haskell for about 3 months. I think its a mistake to write code so that its easy for someone learning Haskell

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Conal Elliott ha scritto: I'd love to help newbies get the hang of Haskell without having to jump in the deep (and smart-infested) end first. And I'd love for people to keep writing smart code for non-newbies to enjoy. Perhaps a practical suggestion would be some wiki pages devoted to

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Dan Piponi ha scritto: Miguel Mitrofanov wrote: takeList = evalState . mapM (State . splitAt) However, ironically, I stopped using them for pretty much the same reason that Manlio is saying. Are you saying there's a problem with this implementation? It's the only one I could just read

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Conal Elliott ha scritto: Manlio, We live in the age of participation -- of co-education. Don't worry about text-books. Contribute to some wiki pages blogs today that share these smart techniques with others. When I started learning Haskell (by my initiative), what I did was: 1) Quick

Re: [Haskell-cafe] about Haskell code written to be too smart

2009-03-24 Thread Manlio Perillo
Conal Elliott ha scritto: And advices to experienced Haskell programmers about how to document their code so that it may help less experienced programmers. Manlio -- You may be missing the point of my suggestion, Ah, sorry. which is to help people *find* code that suits them,

Re: [Haskell-cafe] System.Random.Shuffle fix

2009-03-23 Thread Manlio Perillo
friggin friggin ha scritto: I was looking for a shuffling algorithm to shuffle mp3-playlists so was very happy to see System.Random.Shuffle: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/random-shuffle-0.0.2 However I get errors,non-exhaustive patterns in function shufleTree or

[Haskell-cafe] generalized shuffle

2009-03-23 Thread Manlio Perillo
. And it is not very fast, even using arrays (unless you use non portable unsafeRead). Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Haskell syntax highlighting support for Trac

2009-03-22 Thread Manlio Perillo
Hi. I have noted that with Haskell projects that make use of Trac for issue tracking, it is not possible to have syntax highlighting for Haskell code. http://hackage.haskell.org/trac/hackage/wiki/WikiProcessors Is someone working on this? I can try to write a Trac plugin or patch to solve

Re: [Haskell-cafe] Haskell syntax highlighting support for Trac

2009-03-22 Thread Manlio Perillo
Patai Gergely ha scritto: I'm not sure what your problem is. Yes, haskell support is available in recent versions of Trac. I was trying with the Trac instance for Hackage/Cabal. [...] Manlio ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Cabal properties with conditionals

2009-03-21 Thread Manlio Perillo
Hi. Assuming this configuration fragment: library xxx cc-options: -Wall if flag(HAVE_URANDOM) cc-options:-DHAVE_URANDOM In case the HAVE_URANDOM flag is defined, what will be the value of the used cc-options? 1) -DHAHE_URANDOM 2) -Wall -DHAHE_URANDOM Thanks

[Haskell-cafe] [ANN] random-stream 0.1.1

2009-03-21 Thread Manlio Perillo
] It is possible to use OpenSSL, as a fallback. Just set the HAVE_SSL flag, during package configuration. The OpenSSL DLL should be placed where the linker can find it. I tried to test this, but without success (but I did not put much effort in it). Regards Manlio Perillo

Re: [Haskell-cafe] Re: [ANN] ansi-terminal, ansi-wl-pprint - ANSI terminal support for Haskell

2009-03-21 Thread Manlio Perillo
Achim Schneider ha scritto: Manlio Perillo manlio_peri...@libero.it wrote: Do you plan to extend the package to any terminal, using terminfo database? Are there any non-ansi terminals left? I assumed they were extinct... it'd come close to using EBCDIC. http://groups.google.com/group

Re: [Haskell-cafe] [ANN] ansi-terminal, ansi-wl-pprint - ANSI terminal support for Haskell

2009-03-21 Thread Manlio Perillo
Max Bolingbroke ha scritto: 2009/3/21 Manlio Perillo manlio_peri...@libero.it: Max Bolingbroke ha scritto: These two packages allow Haskell programs to produce much richer console output by allowing colorisation, emboldening and so on. Do you plan to extend the package to any terminal, using

Re: [Haskell-cafe] Cabal properties with conditionals

2009-03-21 Thread Manlio Perillo
Duncan Coutts ha scritto: On Sat, 2009-03-21 at 14:26 +0100, Manlio Perillo wrote: Hi. Assuming this configuration fragment: library xxx cc-options: -Wall if flag(HAVE_URANDOM) cc-options:-DHAVE_URANDOM In case the HAVE_URANDOM flag is defined, what

Re: [Haskell-cafe] Cabal properties with conditionals

2009-03-21 Thread Manlio Perillo
Duncan Coutts ha scritto: On Sat, 2009-03-21 at 23:05 +0100, Manlio Perillo wrote: P.S: I tried to send an email to cabal-devel some days ago, with a feature I would like to see in Cabal. But the mail was never posted to the mailing list. Is that list moderated? It's subscriber only, like

Re: [Haskell-cafe] random shuffle and random list partition

2009-03-20 Thread Manlio Perillo
Yitzchak Gale ha scritto: Hi Manlio, Manlio Perillo wrote: For my Netflix Prize project I have implemented two reusable modules. The first module implements a random shuffle on immutable lists... The second module implements a function used to partition a list into n sublists of random length

Re: [Haskell-cafe] Announce: language-python

2009-03-19 Thread Manlio Perillo
I would like to do some AST processing, and Haskell is IMHO a better choice. [...] Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] [ANN] random-stream package

2009-03-19 Thread Manlio Perillo
] l = randoms gen :: [Int] main = do print l Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] doubts about runGetState in the binary package

2009-03-19 Thread Manlio Perillo
Hi. I have some doubts about the runGetState function in the binary package. The signature is: runGetState :: Get a - LBS - Int64 - (a, LBS, Int64) however the Int64 input parameter is not documented. What value should I pass? How will be used? Thanks Manlio Perillo

Re: [Haskell-cafe] Re: doubts about runGetState in the binary package

2009-03-19 Thread Manlio Perillo
ChrisK ha scritto: Manlio Perillo wrote: Hi. I have some doubts about the runGetState function in the binary package. The signature is: runGetState :: Get a - LBS - Int64 - (a, LBS, Int64) however the Int64 input parameter is not documented. What value should I pass? How will be used

Re: [Haskell-cafe] [ANN] random-stream package

2009-03-19 Thread Manlio Perillo
Brent Yorgey ha scritto: On Thu, Mar 19, 2009 at 11:55:16AM +0100, Manlio Perillo wrote: Note that I have not uploaded it on Hackage, and I do not plan to upload it in the near future, at least until I will repute the package mature enough. I would encourage you to upload it to Hackage

Re: [Haskell-cafe] [ANN] random-stream package

2009-03-19 Thread Manlio Perillo
Gökhan San ha scritto: Manlio Perillo manlio_peri...@libero.it writes: The stream generator implements tha RandomGen interface. This is really cool, though I think 'split' is a must. Maybe all instances could share the same stream in the background, then it wouldn't cause resource issues

Re: [Haskell-cafe] [ANN] random-stream package

2009-03-19 Thread Manlio Perillo
Andrew Wagner ha scritto: Maybe the feature has been added, but not released, because somebody is strict about their code... We should first agree on the meaning of release some code... Manlio ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] [ANN] random-shuffle package

2009-03-19 Thread Manlio Perillo
Max Rabkin ha scritto: On Thu, Mar 19, 2009 at 4:41 PM, Manlio Perillo manlio_peri...@libero.it wrote: However, in this case, the package name should be changed. I'm not sure it is a good idea to release a package that implements only one function (but I may be wrong). Personally, I think

Re: [Haskell-cafe] random shuffle and random list partition

2009-03-17 Thread Manlio Perillo
Yitzchak Gale ha scritto: [...] While I think Oleg's tree method is beautiful, in practice it may be re-inventing the wheel. I haven't tested it, but I doubt that this implementation is much better than using the classical shuffle algorithm on an IntMap. Do you have a working implementation?

[Haskell-cafe] can GHC build an executable from a C source file?

2009-03-17 Thread Manlio Perillo
Hi. I'm checking if it possible to build an executable from C source files only. As an example: #include stdio.h int main () { printf(hello world\n); return 0; } $ghc --make foo.c However this only produces the object file, foo.o; it does not build the executable file. What is

Re: [Haskell-cafe] can GHC build an executable from a C source file?

2009-03-17 Thread Manlio Perillo
Anton Tayanovskyy ha scritto: Works for me without the --make, as `ghc foo.c` For me, too, thanks. Manlio ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] can GHC build an executable from a C source file?

2009-03-17 Thread Manlio Perillo
Joe Fredette ha scritto: You know, I hear theres this brilliant program for compiling C code -- gcd? ccg? gcc, yah gcc... Anyone tried it? In all seriousness though, why do you need to compile c with ghc? I'm curious, it seems a bit pointless... It's for a possible extension I'm planning

Re: [Haskell-cafe] Visualising the Hierarchical Namespace

2009-03-16 Thread Manlio Perillo
Don Stewart ha scritto: I've just finished a post (and quick tool) for graphing the complete module namespace of Haskell, taken from the core libraries and all of Hackage. It's quite large: http://donsbot.wordpress.com/2009/03/16/visualising-the-haskell-universe/ Just a note: isn't it

Re: [Haskell-cafe] Visualising the Hierarchical Namespace

2009-03-16 Thread Manlio Perillo
Don Stewart ha scritto: manlio_perillo: Don Stewart ha scritto: I've just finished a post (and quick tool) for graphing the complete module namespace of Haskell, taken from the core libraries and all of Hackage. It's quite large:

[Haskell-cafe] random shuffle and random list partition

2009-03-16 Thread Manlio Perillo
Hi. For my Netflix Prize project I have implemented two reusable modules. The first module implements a random shuffle on immutable lists. It uses http://okmij.org/ftp/Haskell/perfect-shuffle.txt, with an additional wrapper function, having a more friendly interface. The second module

Re: [Haskell-cafe] broken IO support in uvector package, when using non primitive types

2009-03-14 Thread Manlio Perillo
Daniel Peebles ha scritto: I have added UAProd-based Binary instances to my copy of the uvector repo at http://patch-tag.com/publicrepos/pumpkin-uvector . I have some extensive tests (added to the existing tests directory) of things in there and they seem to be mostly sane. Thanks for the

Re: [Haskell-cafe] Alternative to Data.Binary

2009-03-14 Thread Manlio Perillo
Svein Ove Aas ha scritto: On Sat, Mar 14, 2009 at 1:37 PM, Grzegorz Chrupala grzegorz.chrup...@computing.dcu.ie wrote: Hi all, Is there a serialization library other than the Data.Binary from hackage? I am using Data.Binary in a couple of projects, but I have found its stack and memory usage

Re: [Haskell-cafe] broken IO support in uvector package, when using non primitive types

2009-03-14 Thread Manlio Perillo
written a script in Python that parse the data, and it only takes 491 MB (using a list of a tuple with two compact arrays from numpy). So, GHC has memory problems here. Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe

Re: [Haskell-cafe] Alternative to Data.Binary

2009-03-14 Thread Manlio Perillo
Don Stewart ha scritto: grzegorz.chrupala: Hi all, Is there a serialization library other than the Data.Binary from hackage? I am using Data.Binary in a couple of projects, but I have found its stack and memory usage very hard to control. Its very common that decoding a map or list of

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Manlio Perillo
-Tuple.html In the description, there is: Same as regular Haskell pairs, but (x :*: _|_) = (_|_ :*: y) = _|_ but in the synopsis, the data constructor is :!:, not :*:. Regards Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Manlio Perillo
Don Stewart ha scritto: bulat.ziganshin: Hello Don, Wednesday, March 11, 2009, 12:12:07 AM, you wrote: Right, so my point stands: there's no difference now. If you can write a Storable instance, you can write a UA et al instance. yes, if there is some class provided for this and not just

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Manlio Perillo
Manlio Perillo ha scritto: [...] uvector package also suppors Complex and Rational, however the support for these type is hard written, using a UAProd class, and requires some boiler plate code (IMHO). Correction: UAProd is not a class, sorry. It is the UA constructor overloaded for a:*:b

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Manlio Perillo
Don Stewart ha scritto: [...] You also have to add instance for UIO: instance (RealFloat a, UIO a) = UIO (Complex a) where hPutU h (UAComplex arr) = hPutU h arr hGetU h = do arr - hGetU h return (UAComplex arr) With

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Manlio Perillo
Bryan O'Sullivan ha scritto: [...] text is not mature, and is based on the same modern fusion framework as uvector and vector. It uses unpinned arrays, but provides functions for dealing with foreign code. What is the reason why you have decided to use unpinned arrays (ByteArray#) instead

[Haskell-cafe] broken IO support in uvector package, when using non primitive types

2009-03-13 Thread Manlio Perillo
/code/uvector/ Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] broken IO support in uvector package, when using non primitive types

2009-03-13 Thread Manlio Perillo
Daniel Peebles ha scritto: As far as I know, the reason for this is that the UIO instance for productions writes the two rows out sequentially to file, but doesn't include any means to determine the length of the two halves when it's loading up again. When you try to read the production back in,

Re: [Haskell-cafe] broken IO support in uvector package, when using non primitive types

2009-03-13 Thread Manlio Perillo
Daniel Fischer ha scritto: [...] Worked with uvector-0.1.0.1: [...] But not with uvector-0.2 [...] The main difference is that in uvector 0.2, hPutBU does not write in the file the length of the array; hGetBU simply use the file size. let elemSize = sizeBU 1 (undefined :: e) n -

Re: [Haskell-cafe] broken IO support in uvector package, when using non primitive types

2009-03-13 Thread Manlio Perillo
Don Stewart ha scritto: [...] So, the patch is: just revert this change. Or... use your own UIO instance. That's why it's a type class! Why should I rewrite the UIO instance, if one already exists? Anyway, for the background on this: Tue Nov 18 08:44:46 PST 2008 Malcolm Wallace

[Haskell-cafe] advice on a parsing function

2009-03-11 Thread Manlio Perillo
version produces: [(3,[5000,4000,3000,2000,1000]),(2,[200,100]),(1,[30,20,10])] The foldr version produces: [(1,[]),(2,[10,20,30]),(3,[100,200]),(5000,[1000,2000,3000,4000])] Thanks Manlio Perillo ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] ByteString in patterns

2009-03-11 Thread Manlio Perillo
= C.getContents What is the reason why instance declarations for IsString class are not defined for available ByteStrings? I need to define it by myself. They're exported from Data.ByteString.Char8 Then there is something I'm missing. Your code does not compile. Thanks Manlio Perillo

Re: [Haskell-cafe] advice on a parsing function

2009-03-11 Thread Manlio Perillo
minh thu ha scritto: [...] I suggest you try an alternative strategy. That altenrative strategy is twofold, just like you have quiz' and quiz'. This alternate strategy avoid pattern matching on strings (which would be cumbersome for a bit more complex syntax). But for this specific case it is

Re: [Haskell-cafe] advice on a parsing function

2009-03-11 Thread Manlio Perillo
minh thu ha scritto: [...] The approach I suggested is a bit overkill. You can indeed use L.lines to split the input into lines then work on that. But still, avoid the pair (Int, Bytestring). Instead, you can basically map on each line the unsafeReadInt modified to : - return the id - return if

Re: [Haskell-cafe] ByteString in patterns

2009-03-11 Thread Manlio Perillo
Don Stewart ha scritto: [...] Then there is something I'm missing. Your code does not compile. Sure it does: As Daniel suggested, I'm using an old bytestring version that came with Debian Etch (GHC 6.8.2). Thanks Manlio ___ Haskell-Cafe

Re: [Haskell-cafe] advice on a parsing function

2009-03-11 Thread Manlio Perillo
Manlio Perillo ha scritto: minh thu ha scritto: [...] The approach I suggested is a bit overkill. You can indeed use L.lines to split the input into lines then work on that. But still, avoid the pair (Int, Bytestring). Instead, you can basically map on each line the unsafeReadInt modified

  1   2   3   >