Re: [Haskell-cafe] One-element tuple

2013-08-19 Thread Chris Wong
://www.haskell.org/mailman/listinfo/haskell-cafe -- Chris Wong, fixpoint conjurer e: lambda.fa...@gmail.com w: http://lfairy.github.io/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] memoization

2013-07-22 Thread Chris Wong
+ y If you remove the right-hand side of memoized_fib, you get: memoized_fib = ... This looks like a constant. So the value (map fib [0..] !!) is memoized. If you change that line to memoized_fib x = map fib [0..] !! x GHC no longer memoizes it, and it runs much more slowly. -- Chris

Re: [Haskell-cafe] List Monads and non-determinism

2013-07-19 Thread Chris Wong
Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Chris Wong, fixpoint conjurer e: lambda.fa...@gmail.com

Re: [Haskell-cafe] How to write a pure String to String function in Haskell FFI to C++

2013-06-02 Thread Chris Wong
___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Chris Wong, fixpoint conjurer e: lambda.fa...@gmail.com w: http://lfairy.github.io

Re: [Haskell-cafe] question about GADT and deriving automatically a Show instance

2013-05-17 Thread Chris Wong
types A which have the kind Gender, I can give you a Person with that type. The Alive declaration and deriving clause can be fixed in a similar way. Also, to enable the forall syntax, you need to add {-# LANGUAGE ExplicitForAll #-} at the top of the file. Chris -- Chris Wong, fixpoint

Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-13 Thread Chris Wong
wrote: Can you show me the code that triggers that behavior? It is basically Just connection - connect forever $ do (x,y) - getGyroMovement runRobotWithConnection (moveBy x y) connection -- Chris Wong, fixpoint conjurer e: lambda.fa...@gmail.com w: http://lfairy.github.io

Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-13 Thread Chris Wong
, Niklas Hambüchen m...@nh2.me wrote: Awesome, that works very well, and it even made my program run faster / with less CPU. The reset functionality is useful, but I think optional is better. Did you remove it entirely or is it still available? On Tue 14 May 2013 08:25:04 SGT, Chris Wong wrote

Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-12 Thread Chris Wong
On Thu, May 9, 2013 at 1:36 PM, Chris Wong chrisyco+haskell-c...@gmail.com wrote: On Thu, May 9, 2013 at 4:47 AM, Niklas Hambüchen m...@nh2.me wrote: Hi, I just started using your library to move my cursor. Is it possible that it ignores negative values in moveBy? In other words, I can

Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-12 Thread Chris Wong
impossible for me to Ctrl-C my program: Only c is sent all the time, me pressing Ctrl seems to be reset with the next robot event. Can you show me the code that triggers that behavior? -- Chris Wong, fixpoint conjurer e: lambda.fa...@gmail.com w: http://lfairy.github.io

Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-08 Thread Chris Wong
at some point? Not sure -- I have no idea how screen capturing works in X11. Calling gnome-screenshot should probably cover most use cases. Chris -- Chris Wong, fixpoint conjurer e: lambda.fa...@gmail.com w: http://lfairy.github.io/ ___ Haskell-Cafe

[Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-04-22 Thread Chris Wong
://github.com/lfairy/robot/tree/master/examples Happy hacking! Chris -- Chris Wong, fixpoint conjurer e: lambda.fa...@gmail.com w: http://lfairy.github.io/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell-cafe] Fwd: [Haskell-beginners] Monad instances and type synonyms

2013-04-14 Thread Chris Wong
either, because then I have to give it a constructor, which doesn't fit with what I want the type to do. -- frigidcode.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Chris Wong

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

2013-02-28 Thread Chris Wong
On Thu, Feb 28, 2013 at 1:26 PM, Brandon Allbery allber...@gmail.com wrote: On Wed, Feb 27, 2013 at 8:37 AM, Corentin Dupont corentin.dup...@gmail.com wrote: 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

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

2013-02-26 Thread Chris Wong
Hello everybody! I am very happy to announce the beta release [1] of Nomyx, the only game where You can change the rules. I just gave it a go -- it looks fun :) However, I've spotted a security hole. The current user number is stored in the URL -- if I change that number, I can masquerade as

Re: [Haskell-cafe] catamorphisms and attribute grammars

2013-01-26 Thread Chris Wong
Hi Petr, Congratulations -- you've just implemented a Moore machine! [1] I posted something very much like this just last year [2]. It's a very common pattern in Haskell, forming the basis of coroutines and iteratees and many other things. Edward Kmett includes it in his machines package [3].

Re: [Haskell-cafe] mtl: Why there is Monoid w constraint in the definition of class MonadWriter?

2012-12-10 Thread Chris Wong
Hi Petr, On Sun, Dec 9, 2012 at 7:59 AM, Petr P petr@gmail.com wrote: The class is defined as class (Monoid w, Monad m) = MonadWriter w m | m - w where ... What is the reason for the Monoid constrait? It seems superfluous to me. I recompiled the whole package without it, with no

Re: [Haskell-cafe] Parsing different types, same typeclass

2012-11-17 Thread Chris Wong
Hello José, So, I have a typeclass Action which defines method run: class Action a where run :: a - Int (snipped) Now, I want to parse either A or B from a String. I was thinking about something like this... parseAction :: (Action a, Read a) = String - a parseAction str | (A

Re: [Haskell-cafe] generalizing the writer monad

2012-10-17 Thread Chris Wong
Hello! On Thu, Oct 18, 2012 at 6:59 AM, Petr P petr@gmail.com wrote: Hi, (this is a literate Haskell post.) lately I was playing with the Writer monad and it seems to me that it is too tightly coupled with monoids. Currently, MonadWriter makes the following assumptions: (1) The

Re: [Haskell-cafe] ANNOUNCE: Sylvia, a lambda calculus visualizer

2012-10-01 Thread Chris Wong
On Tue, Oct 2, 2012 at 3:23 PM, Conrad Parker con...@metadecks.org wrote: Nice, it builds and runs fine for me. Perhaps you could include a few more example commandlines to get started? Running without arguments (as the README.mkd suggests) just prints the help text. Thanks for pointing that

[Haskell-cafe] ANNOUNCE: Sylvia, a lambda calculus visualizer

2012-09-27 Thread Chris Wong
Hello all Some of you in the audience may have read Dave Keenan's paper, [To Dissect a Mockingbird][]. A subset of that may have wondered if it was possible to generate those pretty pictures programmatically. For that subset, I can answer to you -- yes, yes you can. [To Dissect a Mockingbird]:

Re: [Haskell-cafe] hellno - a somewhat different approach to tackling cabal hell

2012-09-02 Thread Chris Wong
On Mon, Sep 3, 2012 at 3:15 PM, Richard Wallace rwall...@thewallacepack.net wrote: I like the approach so far. But hellno itself seems to have several dependencies itself. So installing with cabal pulls these in as fixed libraries (text, mtl, transformers, and parsec). Any plans to make

Re: [Haskell-cafe] How to implement instance of MonadBaseControl IO

2012-08-22 Thread Chris Wong
On Wed, Aug 22, 2012 at 7:16 PM, yi huang yi.codepla...@gmail.com wrote: I have a `newtype Yun a = Yun { unYun :: ReaderT YunEnv (ResourceT IO) a }` , and i need to define an instance of `MonadBaseControl IO` for it. Newtype instance deriving don't work here. I guess the answer is simple, i

Re: [Haskell-cafe] Announce: Haskell Platform 2012.2.0.0

2012-06-03 Thread Chris Wong
On Mon, Jun 4, 2012 at 1:16 PM, Jens Petersen j...@community.haskell.org wrote: Congratulations on the release! Equally surprising to me is that the number of slashes also seems to affect the CSS presentation of the website in Chrome. // seems to give the Summer theme, whereas / gives the

Re: [Haskell-cafe] Announce: Haskell Platform 2012.2.0.0

2012-06-03 Thread Chris Wong
On Mon, Jun 4, 2012 at 1:16 PM, Jens Petersen j...@community.haskell.org wrote: Congratulations on the release! Equally surprising to me is that the number of slashes also seems to affect the CSS presentation of the website in Chrome. // seems to give the Summer theme, whereas / gives the

Re: [Haskell-cafe] Need inputs for a Haskell awareness presentation

2012-05-31 Thread Chris Wong
On Fri, Jun 1, 2012 at 6:23 AM, C K Kashyap ckkash...@gmail.com wrote: Hi folks, I have the opportunity to make a presentation to folks (developers and managers) in my organization about Haskell - and why it's important - and why it's the only way forward. I request you to share your

Re: [Haskell-cafe] Finding the average in constant space

2012-05-30 Thread Chris Wong
Sorry for the delayed response -- I've had exams the past few days. On Sun, May 27, 2012 at 8:21 PM, Eugene Kirpichov ekirpic...@gmail.com wrote: A lot of people have done this :) eg from me: google up a fairly recent thread from me about processing streams and perhaps the keyword timeplot

[Haskell-cafe] Finding the average in constant space

2012-05-27 Thread Chris Wong
Hello all I just came up with a way of executing multiple folds in a single pass. In short, we can write code like this: average = foldLeft $ (/) $ sumF * lengthF and it will only traverse the input list once. The code is at: https://gist.github.com/2802644 My question is: has anyone done

Re: [Haskell-cafe] Correspondence between libraries and modules

2012-05-25 Thread Chris Wong
Rustom: O well... If the noob trap is one error playing it safe is probably another so here goes with me saying things that I (probably) know nothing about: 1. cabal was a beautiful system 10 years ago.  Now its being forcibly scaled up 2 (3?) orders of magnitude and is creaking at the seams

Re: [Haskell-cafe] Can Haskell outperform C++?

2012-05-11 Thread Chris Wong
On Sat, May 12, 2012 at 12:41 AM, Gregg Lebovitz glebov...@gmail.com wrote: I would find it useful to pull all this information together into a single document that discusses all the performance issues in one place and shares the real life experience is dealing with each issue. I see this as a

Re: [Haskell-cafe] Installing REPA

2012-04-06 Thread Chris Wong
On Sat, Apr 7, 2012 at 2:02 AM, Dominic Steinitz idontgetoutm...@googlemail.com wrote: Hi, I'm trying to install REPA but getting the following. Do I just install base? Or is it more complicated than that? Thanks, Dominic. I think the easiest solution is to just use an older version of

Re: [Haskell-cafe] Is there a generic way to detect mzero?

2012-03-26 Thread Chris Wong
On Tue, Mar 27, 2012 at 11:03 AM, Antoine Latter aslat...@gmail.com wrote: On Mon, Mar 26, 2012 at 4:25 PM, Ting Lei tin...@hotmail.com wrote: Hi Antoine and Tobias (and everyone else), Thanks a lot for your answers. They are really helpful Can you please show me how to use the (Eq m)

Re: [Haskell-cafe] Empty Input list

2012-03-12 Thread Chris Wong
On Tue, Mar 13, 2012 at 12:24 PM, Chris Smith cdsm...@gmail.com wrote: On Mon, Mar 12, 2012 at 3:14 PM, Kevin Clees k.cl...@web.de wrote: Now my function looks like this: tmp:: [(Int, Int)] - Int - (Int, Int) tmp [] y = (0,0) tmp xs y = xs !! (y-1) Just a warning that this will still crash

Re: [Haskell-cafe] Need Help.

2012-02-21 Thread Chris Wong
Hello On Tue, Feb 21, 2012 at 8:32 PM, Manoj Chaudhari manoj...@gmail.com wrote: Hi, We are looking for senior technical resources with skills in Haskell/Functional programming. Experience : 6 to 20 years, Job Location : Pune (India). Out of curiosity, what will the job involve? Also, it

Re: [Haskell-cafe] network-2.3.0.10 compiled for ghc 7.4.1 windows

2012-02-21 Thread Chris Wong
Hello Matias On Wed, Feb 22, 2012 at 4:02 PM, Matias Hernandez mhern...@gmail.com wrote: Hi Alberto. Do we need cygwin to install your compiled package? I don't believe you do. If memory doesn't fail me, the Haskell Platform includes a compiler (MinGW), but not a shell (MSYS). This page

[Haskell-cafe] Fwd: Contributing to http-conduit

2012-02-02 Thread Chris Wong
Sorry, accidentally clicked Reply rather than Reply to all. Here's the message I sent: -- Forwarded message -- From: Chris Wong chrisyco+haskell-c...@gmail.com Date: Fri, Feb 3, 2012 at 7:44 PM Subject: Re: [Haskell-cafe] Contributing to http-conduit To: Myles C. Maxfield

Re: [Haskell-cafe] strict version of Haskell - does it exist?

2012-01-29 Thread Chris Wong
On Mon, Jan 30, 2012 at 10:13 AM, Marc Weber marco-owe...@gmx.de wrote: A lot of work has been gone into GHC and its libraries. However for some use cases C is still preferred, for obvious speed reasons - because optimizing an Haskell application can take much time. As much as any other

Re: [Haskell-cafe] where to put general-purpose utility functions

2012-01-24 Thread Chris Wong
I like  let (hd, _ : tl) = break prd lst in... Oh, wait.  That won't always work. :( second (drop 1) . break prd list? :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Level of Win32 GUI support in the Haskell platform

2011-12-29 Thread Chris Wong
On Fri, Dec 30, 2011 at 2:53 PM, Steve Horne sh006d3...@blueyonder.co.uk wrote: I've been for functions like GetMessage, TranslateMessage and DispatchMessage in the Haskell Platform Win32 library - the usual message loop stuff - and not finding them. Hoogle says no results found. Is this

Re: [Haskell-cafe] IO typeclasses

2011-12-29 Thread Chris Wong
On Fri, Dec 30, 2011 at 4:47 PM, David Thomas davidleotho...@gmail.com wrote: Is there any particular reason IO functions in the standard libraries aren't grouped into type-classes? I'm guessing it's to stop the report from getting too complicated. If you want an IO abstraction, you can try

Re: [Haskell-cafe] Text.Regex.Base throws exceptions with makeRegexOptsM

2011-12-29 Thread Chris Wong
On Fri, Dec 30, 2011 at 1:24 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Thursday 29 December 2011, 23:52:46, Omari Norman wrote: [...] 'fail' doesn't properly belong in the Monad class, it was added for the purpose of dealing with pattern-match failures, but most monads

Re: [Haskell-cafe] Windows: openFile gives permission denied when file in use

2011-12-28 Thread Chris Wong
On Thu, Dec 29, 2011 at 2:45 PM, Antoine Latter aslat...@gmail.com wrote: [...] When GHC opens files for reading, it asks windows to disallow write access to the file. I'm guessing that Framemaker has the file open for writing, so GHC can't get that permission. In fact, this is required

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-20 Thread Chris Wong
One thing that concerns me is the use of capital letters to distinguish type and class names and constructors from values.  If I was doing it over I would use a typographical distinction like italics for types, bold for classes.  That way we could have a constructor named ∅, a function named 

Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

2011-12-20 Thread Chris Wong
On Wed, Dec 21, 2011 at 10:53 AM, Matthew Farkas-Dyck strake...@gmail.com wrote: With GHC 7.0.3: $ cat test.hs class ℝ a where {  test :: a; }; (∈) :: Eq a = a - [a] - Bool; x ∈ (y:ys) = x == y || x ∈ ys; main = putStrLn Two of three ain't bad (^_~); $ runhaskell test.hs Two of three

Re: [Haskell-cafe] I've just heard of a neat security measure that when you compile the code it generates different object code...

2011-12-16 Thread Chris Wong
On Sat, Dec 17, 2011 at 12:27 PM, KC kc1...@gmail.com wrote: ... with the same functionality. Thus, your program would be a moving target to hackers. Would this be challenging with ghc? Although it's possible, I doubt this would do anything. Most exploits are just programmer mistakes;

Re: [Haskell-cafe] [Alternative] summary of my understanding so far

2011-12-15 Thread Chris Wong
On Thu, Dec 15, 2011 at 9:13 PM, Gregory Crosswhite gcrosswh...@gmail.com wrote: First of all, it sounds like we all agree that the documentation for Alternative needs to be improved;  that alone would clear a lot of the confusion up. I wonder if fully documenting the Haskell base library is a

Re: [Haskell-cafe] [Alternative] some/many narrative

2011-12-14 Thread Chris Wong
Okay, so how about the following as a user narrative for some and many? ... I was in the middle of writing my own version of Applicative when I stumbled on this intense debate. Here's what I wrote for the documentation: class (Applicative f, Monoid f) = Alternative f where -- | Keep