Re: [Haskell-cafe] Problem on overlapping instances

2011-01-07 Thread Magicloud Magiclouds
I agree, but with a slight difference. Since I am so lazy, if Binary fits, like 80% of my requirements, for example this case, only [String] is not OK. I'd like to reuse it with a little modification made by myself, rather than re-write almost the whole of it. But for Data.Binary, I think this

[Haskell-cafe] HDBC, postgresql, bytestrings and embedded NULLs

2011-01-07 Thread Iustin Pop
Hi all, It seems that (at least) the postgresql bindings do not allow pure binary data. I have a simple table: debug=# create table test (name bytea); byteas seems to be the backing type on the DB side for bytestrings. and then I run this: import Database.HDBC.PostgreSQL import

Re: [Haskell-cafe] HDBC, postgresql, bytestrings and embedded NULLs

2011-01-07 Thread Michael Snoyman
On Fri, Jan 7, 2011 at 11:44 AM, Iustin Pop ius...@google.com wrote: Hi all, It seems that (at least) the postgresql bindings do not allow pure binary data. I have a simple table:  debug=# create table test (name bytea); byteas seems to be the backing type on the DB side for bytestrings.

Re: [Haskell-cafe] UTF-8 BOM

2011-01-07 Thread Simon Marlow
On 06/01/2011 05:44, Mark Lentczner wrote: On Jan 4, 2011, at 5:41 PM, Antoine Latter wrote: Are you thinking that the BOM should be automatically stripped from UTF8 text at some low level, if present? It should not. Wether or not a U+FFEF can be stripped depends on context in which it is

[Haskell-cafe] Exportable and importable instances

2011-01-07 Thread Marco Túlio Gontijo e Silva
Hi. I'm planning to propose a language extension for Haskell to make it possible to control the visibility of type class instances in module export and import lists as a research project. I'm planning to implement this in GHC. I've already mentioned it in #...@irc.freenode.net and got

Re: [Haskell-cafe] Exportable and importable instances

2011-01-07 Thread Gábor Lehel
The objection to this I recall hearing is that it would make it possible for different parts of the program to see different instances for a given type (local instances, effectively), which would have interesting results. I don't know if there's a way to implement the feature which avoids this, or

Re: [Haskell-cafe] Type System vs Test Driven Development

2011-01-07 Thread Felipe Almeida Lessa
Seeing all the good discussion on this thread, I think we are missing a TDD page on our Haskell.org wiki. =) Cheers, -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] HDBC, postgresql, bytestrings and embedded NULLs

2011-01-07 Thread John Goerzen
On 01/07/2011 05:24 AM, Michael Snoyman wrote: On Fri, Jan 7, 2011 at 11:44 AM, Iustin Popius...@google.com wrote: Yes, I had a bug reported in persistent-postgresql that I traced back to this bug. I reported the bug, but never heard a response. Frankly, if I had time, I would write a low-level

Re: [Haskell-cafe] HDBC, postgresql, bytestrings and embedded NULLs

2011-01-07 Thread Iustin Pop
On Fri, Jan 07, 2011 at 09:49:35AM -0600, John Goerzen wrote: On 01/07/2011 05:24 AM, Michael Snoyman wrote: On Fri, Jan 7, 2011 at 11:44 AM, Iustin Popius...@google.com wrote: Yes, I had a bug reported in persistent-postgresql that I traced back to this bug. I reported the bug, but never

Re: [Haskell-cafe] HDBC, postgresql, bytestrings and embedded NULLs

2011-01-07 Thread John Goerzen
On 01/07/2011 09:49 AM, John Goerzen wrote: On 01/07/2011 05:24 AM, Michael Snoyman wrote: On Fri, Jan 7, 2011 at 11:44 AM, Iustin Popius...@google.com wrote: Yes, I had a bug reported in persistent-postgresql that I traced back to this bug. I reported the bug, but never heard a response.

[Haskell-cafe] Newbie type question for wxHaskell learner

2011-01-07 Thread b1g3ar5
I've tried to solve this but I am failing. I can do this: p0-panel nb [] e0-textCtrl p [text:=my_list!!0] but I want to do this on all of my_list, so I tried: let es = map (\x- textCtrl (panel nb []) [text:=x]) my_list Now, this won't work because the panel nb [] is IO (Panel()) and the

Re: [Haskell-cafe] Building lambdabot

2011-01-07 Thread Max Bolingbroke
On 7 January 2011 06:20, Joe Bruce bruce.jo...@gmail.com wrote: Thanks Max.  That makes a lot of sense.  That change got me to the point of linking lambdabot. Well, I tried to see if I could reproduce your problem but didn't get to this stage. It looks like v4.2.2.1 from Hackage hasn't been

Re: [Haskell-cafe] Building lambdabot

2011-01-07 Thread Gwern Branwen
On Fri, Jan 7, 2011 at 11:00 AM, Max Bolingbroke batterseapo...@hotmail.com wrote: Well, I tried to see if I could reproduce your problem but didn't get to this stage. It looks like v4.2.2.1 from Hackage hasn't been updated for donkeys years and breaks massively because of at least the new

Re: [Haskell-cafe] Newbie type question for wxHaskell learner

2011-01-07 Thread Daniel Fischer
On Friday 07 January 2011 17:09:11, b1g3ar5 wrote: I've tried to solve this but I am failing. I can do this: p0-panel nb [] e0-textCtrl p [text:=my_list!!0] but I want to do this on all of my_list, so I tried: let es = map (\x- textCtrl (panel nb []) [text:=x]) my_list Now, this won't

Re: [Haskell-cafe] Newbie type question for wxHaskell learner

2011-01-07 Thread b1g3ar5
Thanks for your reply but it doesn't quite solve the problem. This: plist - mapM (\x- (panel nb [])) my_list returns [Panel()] and works as you say, but: elist - mapM (\x- (textCtrl (panel nb []) [text := contents x])) my_list still won't work because the function panel returns a IO (Panel())

Re: [Haskell-cafe] Newbie type question for wxHaskell learner

2011-01-07 Thread Daniel Fischer
On Friday 07 January 2011 19:01:43, b1g3ar5 wrote: Thanks for your reply but it doesn't quite solve the problem. This: plist - mapM (\x- (panel nb [])) my_list returns [Panel()] and works as you say, but: elist - mapM (\x- (textCtrl (panel nb []) [text := contents x])) my_list still

Re: [Haskell-cafe] Newbie type question for wxHaskell learner

2011-01-07 Thread b1g3ar5
Nearly - the first suggestion doesn't work because each es needs a new panel I can't use the same one each time. The second suggestion doesn't quite work because the x in [text := contents x] is not in scope of the \p function. Thanks. N On Jan 7, 6:29 pm, Daniel Fischer

[Haskell-cafe] Ur vs Haskell

2011-01-07 Thread Alexander Kjeldaas
I've briefly gone through the Ur demo at http://impredicative.com/ur/demo/ Ur looks very impressive, so the natural question I'm asking myself is: How does it stack up against haskell frameworks, and why can't Ur be implemented in Haskell? I'm thinking mainly of the safety guarantees, not

Re: [Haskell-cafe] Newbie type question for wxHaskell learner

2011-01-07 Thread Daniel Fischer
On Friday 07 January 2011 19:45:26, b1g3ar5 wrote: Nearly - the first suggestion doesn't work because each es needs a new panel I can't use the same one each time. The second suggestion doesn't quite work because the x in [text := contents x] is not in scope of the \p function. Hmm, Prelude

Re: [Haskell-cafe] Type System vs Test Driven Development

2011-01-07 Thread Florian Weimer
* Jonathan Geddes: When I write Haskell code, I write functions (and monadic actions) that are either a) so trivial that writing any kind of unit/property test seems silly, or are b) composed of other trivial functions using equally-trivial combinators. You can write in this style in any

Re: [Haskell-cafe] Newbie type question for wxHaskell learner

2011-01-07 Thread b1g3ar5
Yes you're right I had brackets wrong (and the 'where' version is easier to read), thanks. I think the where style works best - or maybe flip and a dangling \x- . I maybe slow but I'm learning. N On Jan 7, 7:21 pm, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Friday 07 January

Re: [Haskell-cafe] Freeglut

2011-01-07 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/3/11 18:21 , Eric wrote: I would like to use freeglut instead of GLUT for my Haskell OpenGL program, but when I place the freeglut dll in the program's directory and try to run the program on Windows XP, I get the following error message:

Re: [Haskell-cafe] Building lambdabot

2011-01-07 Thread Joe Bruce
On Fri, Jan 7, 2011 at 8:00 AM, Max Bolingbroke batterseapo...@hotmail.comwrote: I don't think readline links against iconv. What that error says to me is that GHC is failing to link against *any* iconv. I bet that it's because you have iconv installed via Macports without +universal. Try: $

Re: [Haskell-cafe] Building lambdabot

2011-01-07 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/6/11 02:27 , Joe Bruce wrote: Now I'm stuck on readline again [lambdabot build step 28 of 81]: /Users/joe/.cabal/lib/readline-1.0.1.0/ghc-6.12.3/HSreadline-1.0.1.0.o: unknown symbol `_rl_basic_quote_characters' This sounds like the cabal

Re: [Haskell-cafe] Ur vs Haskell

2011-01-07 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/7/11 14:14 , Alexander Kjeldaas wrote: Ur looks very impressive, so the natural question I'm asking myself is: How does it stack up against haskell frameworks, and why can't Ur be implemented in Haskell? I'm thinking mainly of the safety

[Haskell-cafe] Generalizing catMaybes

2011-01-07 Thread Tony Morris
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I am wondering if it possible to generalise catMaybes: (Something f, SomethingElse t) = t (f a) - t a I have being doing some gymnastics with Traversable and Foldable and a couple of other things from category-extras to no avail. Perhaps someone

[Haskell-cafe] Is this the right way to do polymorphism?

2011-01-07 Thread Daryoush Mehrtash
I am trying to evaluate the polymorphism technique used in Hackage library. I like to know if the approach taken is right or not. The code in question is in the Hoaut package http://hackage.haskell.org/package/hoauth/ As far as I can understand the code wants to have polymorphism on HTTP client

Re: [Haskell-cafe] Generalizing catMaybes

2011-01-07 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/7/11 21:56 , Tony Morris wrote: I am wondering if it possible to generalise catMaybes: (Something f, SomethingElse t) = t (f a) - t a I have being doing some gymnastics with Traversable and Foldable and a couple of other things from

Re: [Haskell-cafe] Type System vs Test Driven Development

2011-01-07 Thread Evan Laforge
On Wed, Jan 5, 2011 at 7:31 PM, Chung-chieh Shan ccs...@post.harvard.edu wrote: Besides those example inputs and expected outputs, what about: If two signals are (in)compatible then after applying some simple transformations to both they remain (in)compatible?  A certain family of signals is

Re: [Haskell-cafe] Generalizing catMaybes

2011-01-07 Thread David Menendez
On Fri, Jan 7, 2011 at 9:56 PM, Tony Morris tonymor...@gmail.com wrote:  I am wondering if it possible to generalise catMaybes: (Something f, SomethingElse t) = t (f a) - t a I have being doing some gymnastics with Traversable and Foldable and a couple of other things from category-extras

Re: [Haskell-cafe] Is this the right way to do polymorphism?

2011-01-07 Thread Luke Palmer
If you always expect to be passing c as a parameter and never returned, it is probably better off as a data type. Eg. HTTPClient might look like a traditional OO class: class HTTPClient c where foo :: c - stuff bar :: c - stuff I've found that it is easier to work with if

Re: [Haskell-cafe] Type System vs Test Driven Development

2011-01-07 Thread Evan Laforge
I should say that this reimplementation would be good. If you can compare two implementations (one in plain Haskell and second in declarative QuickCheck rules) you will be better that with only one. This presumes I know how to write a simple but slow version. Clearly, that's an excellent

[Haskell-cafe] Review request for my encoding function

2011-01-07 Thread C K Kashyap
Hi, I've written a function to encode a color value of type (Int,Int,Int) into 8,16 or 32 byte ByteString depending on the value of bits per pixel. This is for my VNC server implementation. I'd appreciate some feedback on the Haskellism of the implementation. import Data.Bits import

Re: [Haskell-cafe] Review request for my encoding function

2011-01-07 Thread Ivan Lazar Miljenovic
On 8 January 2011 16:27, C K Kashyap ckkash...@gmail.com wrote: Hi, I've written a function to encode a color value of type (Int,Int,Int) into 8,16 or 32 byte ByteString depending on the value of bits per pixel. This is for my VNC server implementation. I'd appreciate some feedback on the