Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Raphael Gaschignard
I think it might be impossible with type families. I don't think it's possible to differentiate with type families something like T a a, and T a b, with b different from a. I think that you would need overlap to write this.

[Haskell-cafe] Running out of space while concatinating a list of bytestring

2013-02-27 Thread C K Kashyap
Hi, I have the following code - It looks like things go okay until concatination is attempted. I get the following output There are 2258 ByteStrings *** Exception: stdout: hPutBuf: resource exhausted (Not enough space) I am thinking that I should do strict concatination at each point in the

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Aleksey Khudyakov
On 27 February 2013 12:01, Raphael Gaschignard dasur...@gmail.com wrote: I think it might be impossible with type families. I don't think it's possible to differentiate with type families something like T a a, and T a b, with b different from a. It's indeed impossible to write such type

[Haskell-cafe] Help to write type-level function

2013-02-27 Thread oleg
Dmitry Kulagin wrote: I try to implement typed C-like structures in my little dsl. HList essentially had those http://code.haskell.org/HList/ I was unable to implement required type function: type family Find (s :: Symbol) (xs :: [(Symbol,Ty)]) :: Ty Which just finds a type in a

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Tom Murphy
There's another one... http://3.bp.blogspot.com/-0-NT1rzFpik/Tpe4sb18gOI/AuM/j2BHO_TgLi4/s1600/calvinball.jpg Tom On Tue, Feb 26, 2013 at 7:07 PM, Ben Lippmeier b...@ouroborus.net wrote: On 27/02/2013, at 10:28 , Corentin Dupont corentin.dup...@gmail.com wrote: Hello everybody! I am

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Dmitry Kulagin
That seems to be very relevant to my problem (especially HList.Record). Am I right that UndecidableInstances is required mostly because of eq on types, like in this instances: class HRLabelSet (ps :: [*]) instance HRLabelSet '[] instance HRLabelSet '[x] instance ( HEq l1 l2 leq ,

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Dmitry Kulagin
Very clear solution, I will try to adopt it. Thank you! On Wed, Feb 27, 2013 at 12:17 PM, Aleksey Khudyakov alexey.sklad...@gmail.com wrote: On 27 February 2013 12:01, Raphael Gaschignard dasur...@gmail.com wrote: I think it might be impossible with type families. I don't think it's

Re: [Haskell-cafe] Running out of space while concatinating a list of bytestring

2013-02-27 Thread C K Kashyap
Oops, false alarm. Please ignore - and sorry about it. Regards, Kashyap On Wed, Feb 27, 2013 at 1:32 PM, C K Kashyap ckkash...@gmail.com wrote: Hi, I have the following code - It looks like things go okay until concatination is attempted. I get the following output There are 2258

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Corentin Dupont
I think it would be harder to implement a computer version of 1KBWC and Calvin ball!! Have to think of it ;) On Wed, Feb 27, 2013 at 9:48 AM, Tom Murphy amin...@gmail.com wrote: There's another one...

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Dmitry Kulagin
Hi Aleksey, Unfortunately, your solution does not work for me (ghc 7.6.2). I reduced the problem to: -- | Type class for type equality. class TypeEq (a :: α) (b :: α) (eq :: Bool) | a b - eq instance TypeEq a a True -- instance TypeEq a b False instance eq ~ False = TypeEq a b eq

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Corentin Dupont
Thank you very much, that's very nice! That was a great journey, I started Nomyx 2-3 years ago as a personal project and learned Haskell on the way. I went through many refactorings as my comprehension of Haskell and Nomic progressed. Out of the top of my head, the points that gave me some

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Corentin Dupont
Hi Chris, Thanks! That's true for the user number. What should I do? Encrypt it? On Wed, Feb 27, 2013 at 5:02 AM, Chris Wong chrisyco+haskell-c...@gmail.com wrote: Hello everybody! I am very happy to announce the beta release [1] of Nomyx, the only game where You can change the rules. I

Re: [Haskell-cafe] Conflicting bindings legal?!

2013-02-27 Thread Andreas Abel
Hi Tillmann, no, I am not against shadowing. It's a two-edged sword, but I find it very useful. Shadowing is very intuitive if one can proceed in a left-to-right, top-to-bottom order, just as one reads. Then it is clear that the later occurrence of a binding shadows the earlier one. No

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Mats Rauhala
The user id is not necessarily the problem, but rather that you can impose as another user. For this, one solution is to keep track of a unique (changing) user token in the cookies and use that for verifying the user. -- Mats Rauhala MasseR signature.asc Description: Digital signature

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Corentin Dupont
Yes, having a cookie to keep track of the session if something I plan to do. On Wed, Feb 27, 2013 at 3:16 PM, Mats Rauhala mats.rauh...@gmail.comwrote: The user id is not necessarily the problem, but rather that you can impose as another user. For this, one solution is to keep track of a

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Erik Hesselink
Note that cookies are not the solution here. Cookies are just as user controlled as the url, just less visible. What you need is a session id: a mapping from a non-consecutive, non-guessable, secret token to the user id (which is sequential and thus guessable, and often exposed in urls etc.). It

Re: [Haskell-cafe] The state of binary (de)serialization

2013-02-27 Thread Johan Tibell
On Tue, Feb 26, 2013 at 11:17 PM, Vincent Hanquez t...@snarc.org wrote: On Mon, Feb 25, 2013 at 11:59:42AM -0800, Johan Tibell wrote: - cereal can output a strict bytestring (runPut) or a lazy one (runPutLazy), whilst binary only outputs lazy ones (runPut) The lazy one is more

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Aleksey Khudyakov
On 27.02.2013 17:35, Dmitry Kulagin wrote: Hi Aleksey, Unfortunately, your solution does not work for me (ghc 7.6.2). I reduced the problem to: -- | Type class for type equality. class TypeEq (a :: α) (b :: α) (eq :: Bool) | a b - eq instance TypeEq a a True -- instance TypeEq a

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Corentin Dupont
So I need to encrypt the user ID in some way? What I need is to associate the user ID to a random number and store the association is a table? On Wed, Feb 27, 2013 at 3:52 PM, Erik Hesselink hessel...@gmail.com wrote: Note that cookies are not the solution here. Cookies are just as user

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Clark Gaebel
You could just hash it. - Clark On Wed, Feb 27, 2013 at 2:08 PM, Corentin Dupont corentin.dup...@gmail.comwrote: So I need to encrypt the user ID in some way? What I need is to associate the user ID to a random number and store the association is a table? On Wed, Feb 27, 2013 at 3:52

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Corentin Dupont
hash is reversible or not? On Wed, Feb 27, 2013 at 8:18 PM, Clark Gaebel cgae...@uwaterloo.ca wrote: You could just hash it. - Clark On Wed, Feb 27, 2013 at 2:08 PM, Corentin Dupont corentin.dup...@gmail.com wrote: So I need to encrypt the user ID in some way? What I need is to

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Dmitry Kulagin
Oh, that is my fault - I was sure that I specified the extension and it didn't help. It really works with OverlappingUndecidable. Thank you! On Wed, Feb 27, 2013 at 10:36 PM, Aleksey Khudyakov alexey.sklad...@gmail.com wrote: On 27.02.2013 17:35, Dmitry Kulagin wrote: Hi Aleksey,

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread David Thomas
hash(id:secret) should not be reversible, if you use a cryptographic hash. hash(id) can be brute-forced, on something with so small a range. On Wed, Feb 27, 2013 at 11:20 AM, Corentin Dupont corentin.dup...@gmail.com wrote: hash is reversible or not? On Wed, Feb 27, 2013 at 8:18 PM, Clark

[Haskell-cafe] How does one create an input handle bound to a string instead of a file?

2013-02-27 Thread John D. Ramsdell
How does one create a value of type System.IO.Handle for reading that takes its input from a string instead of a file? I'm looking for the equivalent of java.io.StringReader in Java. Thanks in advance. John ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Corentin Dupont
Hi all, there is quite a lot of players! Fantastic! I proposed a rule to lower the vote quorum from unanimity to a quorum of only 4, for the experimentation. But still, to have this rule accepted, everybody needs to vote! Could you please cast your vote? If you don't plan on playing, it's better

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Corentin Dupont
NB: being unsubscribed, you can still watch the game. It's just that you are not anymore considered as a citizen of that game, thus not counted in the votes. On Wed, Feb 27, 2013 at 10:12 PM, Corentin Dupont corentin.dup...@gmail.com wrote: Hi all, there is quite a lot of players! Fantastic!

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Ozgun Ataman
I would encourage you to take a look at the snap (the web framework) package, where this concern is handled for you as part of the session snaplet. The Snap.Snaplet.Sessionhttp://hackage.haskell.org/packages/archive/snap/0.11.2/doc/html/Snap-Snaplet-Session.html module and the

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Corentin Dupont
Thanks Ozgun, but I'm using Happstack: this will be compatible? On Wed, Feb 27, 2013 at 10:30 PM, Ozgun Ataman ozata...@gmail.com wrote: I would encourage you to take a look at the snap (the web framework) package, where this concern is handled for you as part of the session snaplet. The

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Ozgun Ataman
You probably can't use it directly but it should at least show you how we did it. In particular, the Snap.Snaplet.Session.SecureCookie module (internal, I think, so look at source) may be of interest to you as it implements the self-contained idea of encrypted cookies. - Oz On Wednesday,

Re: [Haskell-cafe] How does one create an input handle bound to a string instead of a file?

2013-02-27 Thread Gregory Collins
On Wed, Feb 27, 2013 at 9:38 PM, John D. Ramsdell ramsde...@gmail.comwrote: How does one create a value of type System.IO.Handle for reading that takes its input from a string instead of a file? I'm looking for the equivalent of java.io.StringReader in Java. Thanks in advance. You can't.

Re: [Haskell-cafe] How does one create an input handle bound to a string instead of a file?

2013-02-27 Thread Don Stewart
I don't think that's right - Simon's buffer class rewrite should have made this possible, I think. http://hackage.haskell.org/packages/archive/base/4.2.0.1/doc/html/GHC-IO-BufferedIO.html On Feb 27, 2013 10:52 PM, Gregory Collins g...@gregorycollins.net wrote: On Wed, Feb 27, 2013 at 9:38 PM,

Re: [Haskell-cafe] How does one create an input handle bound to a string instead of a file?

2013-02-27 Thread Gregory Collins
Hm, perhaps I stand corrected. Then how exactly do you make the bytestring Handle? On Thu, Feb 28, 2013 at 12:15 AM, Don Stewart don...@gmail.com wrote: I don't think that's right - Simon's buffer class rewrite should have made this possible, I think.

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Brandon Allbery
On Wed, Feb 27, 2013 at 8:37 AM, Corentin Dupont corentin.dup...@gmail.comwrote: Hi Chris, Thanks! That's true for the user number. What should I do? Encrypt it? It's not that you have a user number, or even that it's accessible: it's that it's the entirety of access control, meaning that if

[Haskell-cafe] ANN: cabal-dev 0.9.2 - sandboxed haskell builds

2013-02-27 Thread Rogan Creswick
The (ever growing) cabal-dev team is happy to announce v. 0.9.2! Cabal-dev is a tool to test development libraries by creating a sandboxed package and dependency build environment. Executing `cabal-dev install` will create a sandbox, named cabal-dev in the current directory, and populate it with

Re: [Haskell-cafe] How does one create an input handle bound to a string instead of a file?

2013-02-27 Thread Bob Ippolito
I haven't had time to make an example yet but it looks like if you go down to GHC.IO.Handle.Internals there's a mkHandle function that takes a BufferedIO and some other stuff and gives you an IO Handle. On Wed, Feb 27, 2013 at 3:23 PM, Gregory Collins g...@gregorycollins.netwrote: Hm, perhaps

[Haskell-cafe] How to return a network connection to C

2013-02-27 Thread C K Kashyap
Hi, I am using Network.Connection to connect to gmail in my Haskell module - that's compiled to DLL and invoked from C. I need a mechanism to return the connection handle to C so that it can pass it in the subsequent calls. How can I achieve this? Regards, Kashyap