[Haskell-cafe] Physical equality

2010-06-28 Thread José Romildo Malaquias
Is there in Haskell a non monadic function of type a - a - Bool which test for physical equality of two values? It would return True if only if both values are the same object in memory. For instance: value1 = good value2 = good eq value1 value2 = False value1 = good value2 = value1

Re: [Haskell-cafe] Physical equality

2010-06-28 Thread Vo Minh Thu
2010/6/28 José Romildo Malaquias j.romi...@gmail.com: Is there in Haskell a non monadic function of type a - a - Bool which test for physical equality of two values? It would return True if only if both values are the same object in memory. For instance:  value1 = good  value2 = good  eq

Re: [Haskell-cafe] Physical equality

2010-06-28 Thread Thomas Davie
On 28 Jun 2010, at 09:38, José Romildo Malaquias wrote: Is there in Haskell a non monadic function of type a - a - Bool which test for physical equality of two values? It would return True if only if both values are the same object in memory. For instance: value1 = good value2 = good

Re: [Haskell-cafe] Why this doesn't type checked

2010-06-28 Thread Brent Yorgey
On Mon, Jun 28, 2010 at 08:51:45AM +0400, Victor Nazarov wrote: What we get with this instances is following code. main =   do print (sizeof :: Sizeof Word16) Let's try it. $ runhaskell this.lhs this.lhs:78:14:     Couldn't match expected type `Int'            against

Re: [Haskell-cafe] Re: building a patched ghc

2010-06-28 Thread Brent Yorgey
I don't know the answer to your questions, but just wanted to note that you will probably get a better response on the glasgow-haskell-users mailing list. http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/mailing-lists-GHC.html -Brent On Fri, Jun 25, 2010 at 08:56:09PM -0700, braver

Re: [Haskell-cafe] Type-Level Programming

2010-06-28 Thread Brent Yorgey
On Fri, Jun 25, 2010 at 02:26:54PM -0700, Walt Rorie-Baety wrote: I've noticed over the - okay, over the months - that some folks enjoy the puzzle-like qualities of programming in the type system (poor Oleg, he's become #haskell's answer to the Chuck Norris meme commonly encountered in

[Haskell-cafe] ANNOUNCE: HaRe, the Haskell Refactorer 0.6

2010-06-28 Thread Chris BROWN
Dear Haskellers, As part of our project on Refactoring Functional Programs http://www.cs.kent.ac.uk/projects/refactor-fp/ we are pleased to announce the availability of HaRe 0.6 (also known as HaRe 28/06/2010), a snapshot of our Haskell Refactorer prototype. Apart from bug-fixes, there are

Re: [Haskell-cafe] Construction of short vectors

2010-06-28 Thread Jake McArthur
On Sun, Jun 27, 2010 at 4:44 PM, Alexey Khudyakov alexey.sklad...@gmail.com wrote: Dependent types would be nice but there isn't anything usable out there. Newtype wrapper parametrized by type level number works fine so far. If you interested sources are available here:

Re: [Haskell-cafe] GHCi and State

2010-06-28 Thread Martin Hilbig
hi, On 25.06.2010 11:07, corentin.dup...@ext.mpsa.com wrote: Another couple of reflexions (sorry for monopolizing): 1. Since i am making a Nomic game, players will have to submit rules. These rules will be written in a sub-set of haskell. Instead of writing my own reader/interpreter, i'd

Re: [Haskell-cafe] Construction of short vectors

2010-06-28 Thread Alexey Khudyakov
On Mon, Jun 28, 2010 at 7:02 PM, Jake McArthur jake.mcart...@gmail.com wrote: On Sun, Jun 27, 2010 at 4:44 PM, Alexey Khudyakov alexey.sklad...@gmail.com wrote: Dependent types would be nice but there isn't anything usable out there. Newtype wrapper parametrized by type level number works fine

[Haskell-cafe] MonadCatchIO and bracket.

2010-06-28 Thread Carl Howells
While working this weekend on the Snap web framework, I ran into a problem. Snap implements MonadCatchIO, so I thought I could just use bracket to handle resource acquisition/release in a safe manner. Imagine my surprise when bracket simply failed to run the release action sometimes. I quickly

Re: [Haskell-cafe] Type-Level Programming

2010-06-28 Thread Andrew Coppin
So is there a specific reason why Haskell isn't dependently typed then? Or you could ask, So is there a specific reason why C isn't a functional language? More to the point, Haskell was a bit too frozen in stone when dependent type theory reached the point of being implementable.

Re: [Haskell-cafe] Type-Level Programming

2010-06-28 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 6/28/10 15:04 , Andrew Coppin wrote: More to the point, Haskell was a bit too frozen in stone when dependent type theory reached the point of being implementable. Right. So, in summary, the answer is historical circumstance? (I was

Re: [Haskell-cafe] Type-Level Programming

2010-06-28 Thread Andrew Coppin
wren ng thornton wrote: Andrew Coppin wrote: I think I looked at Coq (or was it Epigram?) and found it utterly incomprehensible. Whoever wrote the document I was reading was obviously very comfortable with advanced mathematical abstractions which I've never even heard of. One of the things

Re: [Haskell-cafe] Re: Mining Twitter data in Haskell and Clojure

2010-06-28 Thread Claus Reinke
Claus -- cafe5 is pretty much where it's at. You're right, the proggy was used as the bug finder, actually at cafe3, still using ByteString. It would be useful to have a really tiny data source - no more than 100 entries per Map should be sufficient to confirm or reject hunches about

Re: [Haskell-cafe] Re: Mining Twitter data in Haskell and Clojure

2010-06-28 Thread Don Stewart
claus.reinke: To binary package users/authors: is there a typed version of binary (that is, one that records and checks a representation of the serialized type before actual (de-)serialization)? It would be nice to have such a type check, even though it wouldn't protect against missing

Re: [Haskell-cafe] Type-Level Programming

2010-06-28 Thread Andrew Coppin
Brent Yorgey wrote: As several people have pointed out, type-level programming in Haskell resembles logic programming a la Prolog -- however, this actually only applies to type-level programming using multi-parameter type classes with functional dependencies [1] (which was until recently the

[Haskell-cafe] whine and solution about programmers not respecting documentations

2010-06-28 Thread Albert Y . C . Lai
Some docs are in a miserable state of being incomplete. And then some programmers are in a miserable state of not respecting docs when the docs are complete. Why should anyone expect deleteBy (=) 5 [0..10] to accomplish anything meaningful, if he/she respects the written docs? Today someone

Re: [Haskell-cafe] MonadCatchIO and bracket.

2010-06-28 Thread Neil Brown
On 28/06/2010 20:02, Carl Howells wrote: While working this weekend on the Snap web framework, I ran into a problem. Snap implements MonadCatchIO, so I thought I could just use bracket to handle resource acquisition/release in a safe manner. Imagine my surprise when bracket simply failed to run

Re: [Haskell-cafe] MonadCatchIO and bracket.

2010-06-28 Thread Michael Snoyman
On Mon, Jun 28, 2010 at 10:02 PM, Carl Howells chowell...@gmail.com wrote: While working this weekend on the Snap web framework, I ran into a problem. Snap implements MonadCatchIO, so I thought I could just use bracket to handle resource acquisition/release in a safe manner. Imagine my

Re: [Haskell-cafe] Space leak with unsafePerformIO

2010-06-28 Thread Henning Thielemann
On Sun, 27 Jun 2010, Henning Thielemann wrote: Maybe I can combine splitAtLazy and (++) to a function like splitAtAndAppend :: [x] - ([a] - [b]) - ([a] - [b]) - [a] - [b] but I'm afraid I will need pairs temporarily and then I run into the same problems. I have now implemented a solution

Re: [Haskell-cafe] whine and solution about programmers not respecting documentations

2010-06-28 Thread Luke Palmer
On Mon, Jun 28, 2010 at 1:44 PM, Albert Y.C.Lai tre...@vex.net wrote: Why should anyone expect  deleteBy (=) 5 [0..10] to accomplish anything meaningful, if he/she respects the written docs? I proposed the following solution: http://lukepalmer.wordpress.com/2009/07/01/on-the-by-functions/

Re: [Haskell-cafe] Physical equality

2010-06-28 Thread Sönke Hahn
On Monday, June 28, 2010 10:38:33 am José Romildo Malaquias wrote: Is there in Haskell a non monadic function of type a - a - Bool which test for physical equality of two values? It would return True if only if both values are the same object in memory. IIRC observable sharing does similar

Re: [Haskell-cafe] Physical equality

2010-06-28 Thread Edward Kmett
reallyUnsafePointerEquality :: a - a - Int# but don't use as it can give both false negatives (i.e. GC in the middle of evaluation) and false positives (that GC just finished and put one object right where the other was.) The better model to obtain what you want to use StableNames and seq and,

[Haskell-cafe] Call for comments: neither package

2010-06-28 Thread Michael Snoyman
Hi all, I'll admit, the original idea for this package was something to place in ACME ;). However, it's goal is to solve a real problem: the lack of good instances on the Either type. As a brief summary, Either has no Applicative or Monad instances in the base library, has 2 reasonable

Re: [Haskell-cafe] MonadCatchIO and bracket.

2010-06-28 Thread Sterling Clover
There’s a history of rich debate and discussion on these issues coming from the scheme world, where it takes the guise of implementing unwind-protect in the presence of call/cc. Kent Pitman’s take is presented here: http://www.nhplace.com/kent/PFAQ/unwind-protect-vs-continuations-overview.html

Re: [Haskell-cafe] Call for comments: neither package

2010-06-28 Thread Antoine Latter
It looks like good work, but I would be hesitent about depending on a package which pulled in both mtl and tranformers. Maybe that's just superstition - I haven't tried it. Antoine On Jun 28, 2010 5:51 PM, Michael Snoyman mich...@snoyman.com wrote: Hi all, I'll admit, the original idea for

[Haskell-cafe] specifying package name in ghci import?

2010-06-28 Thread Michael Vanier
Hi, Quick question about ghci: when I do this at the prompt: ghci :m +Control.Monad.Cont I get Ambiguous module name `Control.Monad.Cont': it was found in multiple packages: mtl-1.1.0.2 monads-fd-0.0.0.1 Is there any way to fix this from within ghci (i.e. not involving mucking

Re: [Haskell-cafe] Re: Mining Twitter data in Haskell and Clojure

2010-06-28 Thread Antoine Latter
On Mon, Jun 28, 2010 at 2:32 PM, Don Stewart d...@galois.com wrote: claus.reinke: To binary package users/authors: is there a typed version of binary (that is, one that records and checks a representation of the serialized type before actual (de-)serialization)? It would be nice to have such

Re: [Haskell-cafe] whine and solution about programmers not respecting documentations

2010-06-28 Thread Roman Beslik
In the case of 'deleteBy' we can improve an API. deleteBy eq x xs == deletePred (eq x) xs @deletePred pred xs@ removes the first element of @xs@ which satisfies a predicate @p...@. Your solution is more general. :) On 28.06.10 22:44, Albert Y.C.Lai wrote: And then some programmers are in a

Re: [Haskell-cafe] Haskell Bangalore

2010-06-28 Thread Lakshmi Narasimhan
Wow! great to see Haskellers from B'lore. I'll be interested too. On Mon, Jun 21, 2010 at 10:00 AM, C K Kashyap ckkash...@gmail.com wrote: Hi, I was wondering if it would be a good idea for the folks interested in Haskell in Bangalore to get together. Especially if there are folks at EGL,

Re: [Haskell-cafe] whine and solution about programmers not respecting documentations

2010-06-28 Thread Mark Lentczner
On Jun 28, 2010, at 2:29 PM, Luke Palmer wrote: I proposed the following solution: http://lukepalmer.wordpress.com/2009/07/01/on-the-by-functions/ Seconded! I always want xxxOn and I almost never (perhaps never*) want xxxBy for xxx in sort, maximum, group and nub. - Mark (*) A

Re: [Haskell-cafe] Call for comments: neither package

2010-06-28 Thread Michael Snoyman
As far as I know, the only issue with depending on both is the conflicting orphan Monad instance for Either. Can anyone either confirm or deny this? On Tue, Jun 29, 2010 at 5:11 AM, Antoine Latter aslat...@gmail.com wrote: It looks like good work, but I would be hesitent about depending on a

Re: [Haskell-cafe] Call for comments: neither package

2010-06-28 Thread Ivan Miljenovic
On 29 June 2010 15:20, Michael Snoyman mich...@snoyman.com wrote: As far as I know, the only issue with depending on both is the conflicting orphan Monad instance for Either. Can anyone either confirm or deny this? Since you're being naughty and using package-qualified imports, it should be OK

Re: [Haskell-cafe] whine and solution about programmers not respecting documentations

2010-06-28 Thread Ketil Malde
Albert Y.C.Lai tre...@vex.net writes: The doc of deleteBy states: The deleteBy function behaves like delete, but takes a user-supplied equality predicate. A precondition is that the user-supplied predicate is an equality predicate. (=) is not an equality predicate, be it in the layperson

Re: [Haskell-cafe] Call for comments: neither package

2010-06-28 Thread Michael Snoyman
On Tue, Jun 29, 2010 at 8:24 AM, Ivan Miljenovic ivan.miljeno...@gmail.comwrote: On 29 June 2010 15:20, Michael Snoyman mich...@snoyman.com wrote: As far as I know, the only issue with depending on both is the conflicting orphan Monad instance for Either. Can anyone either confirm or deny

Re: [Haskell-cafe] Call for comments: neither package

2010-06-28 Thread Ivan Miljenovic
On 29 June 2010 15:38, Michael Snoyman mich...@snoyman.com wrote: On Tue, Jun 29, 2010 at 8:24 AM, Ivan Miljenovic ivan.miljeno...@gmail.com wrote: On 29 June 2010 15:20, Michael Snoyman mich...@snoyman.com wrote: As far as I know, the only issue with depending on both is the conflicting