Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Levent Erkok
On Jul 19, 2011, at 11:34 PM, Levent Erkok wrote: > import System.Mem.StableName > > areEqual :: Eq a => a -> a -> IO Bool > areEqual x y = do > sx <- hashStableName `fmap` (x `seq` makeStableName x) > sy <- hashStableName `fmap` (y `seq` makeStableName y) > return $ (sx == sy) || x == y On

[Haskell-cafe] NetSNMP; FreeBSD 8.1

2011-07-20 Thread Комар Максим
I want to install package NetSNMP: > cabal install NetSNMP Resolving dependencies... Configuring NetSNMP-0.1.6... cabal: Missing dependency on a foreign library: * Missing C library: netsnmp This problem can usually be solved by installing the system package that provides this library (you may nee

Re: [Haskell-cafe] NetSNMP; FreeBSD 8.1

2011-07-20 Thread Henning Thielemann
On Wed, 20 Jul 2011, Комар Максим wrote: I want to install package NetSNMP: cabal install NetSNMP Resolving dependencies... Configuring NetSNMP-0.1.6... cabal: Missing dependency on a foreign library: * Missing C library: netsnmp This problem can usually be solved by installing the system pac

Re: [Haskell-cafe] Haskell fgl example

2011-07-20 Thread Mark Wright
On Tue, 19 Jul 2011 21:04:58 +0530, Rohit Agrawalla wrote: Non-text part: multipart/mixed Non-text part: multipart/alternative > I am new to haskell and the haskell fgl (functional graph library). l am > looking for some examples of the haskell fgl. Would appreciate any pointers > regarding the s

[Haskell-cafe] haskell zlip read position

2011-07-20 Thread rahul
Hi Guys, I am trying to parse a binary stream with the format for one entry [headers, zlib compressed content] , with multiple entries. I can use the Zlib library to get the content for the first entry after the headers, but I cannot find a way to get the offset to start parsing for the second

Re: [Haskell-cafe] haskell zlip read position

2011-07-20 Thread Henning Thielemann
On Wed, 20 Jul 2011, rahul wrote: Hi Guys, I am trying to parse a binary stream with the format for one entry [headers, zlib compressed content] , with multiple entries. I can use the Zlib library to get the content for the first entry after the headers, but I cannot find a way to get the of

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Bertram Felgenhauer
Carl Howells wrote: > On Tue, Jul 19, 2011 at 11:14 PM, yi huang wrote: > > 2011/7/20 Eugene Kirpichov > >> > >> reallyUnsafePointerEq#, and it really is as unsafe as it sounds :) > >> > > Why is it so unsafe? i can't find any documentation on it. > > I think always compare pointer first is a goo

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Thiago Negri
Hello all, I'm a newbie at Haskell and I was not aware of this problem. So, equality comparison can run into an infinite-loop? My current knowledge of the language tells me that everything is Haskell is a thunk until it's value is really needed. Is it possible to implement (==) that first check th

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread quick
Quoting Thiago Negri : > Hello all, > I'm a newbie at Haskell and I was not aware of this problem. > So, equality comparison can run into an infinite-loop? Yes, comparing infinite lists is a non-terminating computation. > My current knowledge of the language tells me that everything is > Haskel

Re: [Haskell-cafe] NetSNMP; FreeBSD 8.1

2011-07-20 Thread Brandon Allbery
2011/7/20 Henning Thielemann > On Wed, 20 Jul 2011, Комар Максим wrote: > >> I want to install package NetSNMP: >> >>> cabal install NetSNMP >>> >> Resolving dependencies... >> Configuring NetSNMP-0.1.6... >> cabal: Missing dependency on a foreign library: >> * Missing C library: netsnmp >> >> Pa

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Antoine Latter
On Wed, Jul 20, 2011 at 10:48 AM, Thiago Negri wrote: > Hello all, > I'm a newbie at Haskell and I was not aware of this problem. > So, equality comparison can run into an infinite-loop? > > My current knowledge of the language tells me that everything is > Haskell is a thunk until it's value is r

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Chris Smith
On Tue, 2011-07-19 at 23:33 -0700, Carl Howells wrote: > False positives and false negatives are both possible, depending on GC > timing. Don't use it, unless you know why it can result in both false > positives and false negatives, and you know why neither of those are > bad for your use case. C

Re: [Haskell-cafe] NetSNMP; FreeBSD 8.1

2011-07-20 Thread Henning Thielemann
On Wed, 20 Jul 2011, Brandon Allbery wrote: Ports is build-from-source, so every package is what Linux calls a -dev package. The OP might need to make sure that cabal knows to look in /usr/local for libraries. I see. If net-snmp supports pkg-config then all such problems should be solvable

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Brandon Allbery
On Wed, Jul 20, 2011 at 13:22, Chris Smith wrote: > On Tue, 2011-07-19 at 23:33 -0700, Carl Howells wrote: > > False positives and false negatives are both possible, depending on GC > > timing. Don't use it, unless you know why it can result in both false > > positives and false negatives, and y

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Chris Smith
On Wed, 2011-07-20 at 13:32 -0400, Brandon Allbery wrote: > I think it's more correct to say that the compiler is free to do > things that would lead to false positives if it knows that it's safe > to do so (and purity means it can find more of those cases, and more > of them *will* be safe) — but

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread David Barbour
On Wed, Jul 20, 2011 at 10:40 AM, Chris Smith wrote: > I have looked up crowbar in a number of dictionaries of slang and > informal usage... and still have no idea what you just said. Can you > reword it? > Crowbars offer 'leverage'. > > The point, I think, is that if pointer equality testing

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Niklas Larsson
> have not updated the first pointer yet.  But if that's the case, and > it's executing arbitrary user code that may refer to that memory, then > the garbage collector contains race conditions! Not necessarily, if the garbage collection and the move happened between taking the pointers of the two

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Brandon Allbery
On Wed, Jul 20, 2011 at 13:40, Chris Smith wrote: > On Wed, 2011-07-20 at 13:32 -0400, Brandon Allbery wrote: > > of them *will* be safe) — but there is no way for it to crowbar > > pointer equality tests in that case. > > I have looked up crowbar in a number of dictionaries of slang and > inform

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Bertram Felgenhauer
David Barbour wrote: > On Wed, Jul 20, 2011 at 10:40 AM, Chris Smith wrote: > > The point, I think, is that if pointer equality testing really does what > > it says, then there shouldn't *be* any correct implementation in which > > false positives are possible. It seems the claim is that the garb

Re: [Haskell-cafe] haskell zlip read position

2011-07-20 Thread rahul
Hi, | > I am trying to parse a binary stream with the format for one entry | >[headers, zlib compressed content] , with multiple entries. | >I can use the Zlib library to get the content for the first entry after | >the headers, but I cannot find a way to get the offset to start parsing | >for th

[Haskell-cafe] ghc on arm status

2011-07-20 Thread Sergey Mironov
Hi. I was searching for info about building ghc on ARM arch. I already know about [1] approach, and also saw debian binaries [2], but I am afraid I have to compile ghc by myself this time, since our system uses incompatible libc, so my question is addressed to gentoo users and sympathetic :) Did an

Re: [Haskell-cafe] ghc on arm status

2011-07-20 Thread Vo Minh Thu
2011/7/20 Sergey Mironov : > Hi. I was searching for info about building ghc on ARM arch. I already > know about [1] approach, and also saw debian binaries [2], but I am > afraid I have to compile ghc by myself this time, since our system > uses incompatible libc, so my question is addressed to gen

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Paul Johnson
I would have thought that the compiler, as a matter of optimisation, could insert a check to see if (==) is comparing an object with itself. The only way I can see this breaking is with perverse instances of Eq that would return False for "f == f". Paul. On 07/20/2011 04:51 AM, Nikhil A. Pat

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread wren ng thornton
On 7/20/11 5:08 PM, Paul Johnson wrote: > I would have thought that the compiler, as a matter of optimisation, > could insert a check to see if (==) is comparing an object with itself. > The only way I can see this breaking is with perverse instances of Eq > that would return False for "f == f". L

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread wren ng thornton
On 7/20/11 1:22 PM, Chris Smith wrote: > If the latter, then it seems this would be a > pretty serious garbage collector bug, and that it would be impossible > that such a bug wouldn't also break other code that doesn't use pointer > equality at all. After all, we've got a running user thread, whi

Re: [Haskell-cafe] haskell zlip read position

2011-07-20 Thread Nathan Howell
On Wed, Jul 20, 2011 at 11:50 AM, rahul wrote: > Unfortunately the binary protocol itself is external, so can't use a > different > type of compression > Perhaps something like this would work: https://gist.github.com/1096039 I didn't test to make sure it works, but you could probably hack toget

[Haskell-cafe] Network.CGI and SQL Queries

2011-07-20 Thread william murphy
Hello there, There's an odd error every time I try to run this code: import Network.CGI import Text.XHtml import qualified Text.Html as H import Database.HDBC import Database.HDBC.Sqlite3 import System.Random ... sqlReaderIO = do handle <- connectSqlite3 "table2.db" scoresSql <- quickQu

Re: [Haskell-cafe] Network.CGI and SQL Queries

2011-07-20 Thread Arlen Cuss
> When I remove the "scoresPassed <- sqlReaderIO" line, the code run > smoothly. Nothing else references "scoresPassed". The ghc, however, > gives me this error when the line is included: I'm not 100% sure, but what if you put a liftM or liftIO in somewhere? > (liftM output) . renderHtml $ ...

Re: [Haskell-cafe] Network.CGI and SQL Queries

2011-07-20 Thread Alistair Bayley
> There's an odd error every time I try to run this code: > > > sqlReaderIO = do >     handle <- connectSqlite3 "table2.db" >     scoresSql <- quickQuery' handle "SELECT * FROM pachinkoScores ORDER BY > score, name" [] >     let scores = map (map (\x -> fromSql x :: String)) scoresSql >     return

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Richard O'Keefe
On 21/07/2011, at 9:08 AM, Paul Johnson wrote: > I would have thought that the compiler, as a matter of optimisation, could > insert a check to see if (==) is comparing an object with itself. The only > way I can see this breaking is with perverse instances of Eq that would > return False for

Re: [Haskell-cafe] haskell zlip read position

2011-07-20 Thread rahul
Hi Nathan, Thank you very for the solution, since I am somewhat new to haskell, I am taking some time to digest it :). But it seems that you are using header -> streamLength to find the length of a single entry. However this info is not present in the protocol I am parsing (git server pack file

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Brandon Allbery
On Wed, Jul 20, 2011 at 23:53, Richard O'Keefe wrote: > On 21/07/2011, at 9:08 AM, Paul Johnson wrote: > > I would have thought that the compiler, as a matter of optimisation, > could insert a check to see if (==) is comparing an object with itself. The > only way I can see this breaking is with

Re: [Haskell-cafe] haskell zlip read position

2011-07-20 Thread Nathan Howell
It was purely just for demonstration. I did update the code with a few more comments, but the enumerator package may not be the easiest thing to grok. You might try putting up your current code and someone might be able to recommend a better or easier approach. If the git pack headers have lengths

Re: [Haskell-cafe] haskell zlip read position

2011-07-20 Thread rahul
Hi Nathan, | It was purely just for demonstration. I did update the code with a few more | comments, but the enumerator package may not be the easiest thing to grok. | You might try putting up your current code and someone might be able to | recommend a better or easier approach. Thank you very m

Re: [Haskell-cafe] pointer equality

2011-07-20 Thread Dean Herington
For the following expression, I would consider a True result a false positive: let x = x :: Int in x == x Dean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe