[Haskell-cafe] How to use IndentParser. Any example/tutorial?
Hi, I need to construct a parser that parse a language that use indentation to define blocks as Python does. I ran into Text.ParserCombinators.Parsec.IndentParser module but have no idea how to use it. Can anyone point me out to how to use this module? Any short example, tutorial, or whatever would be highly appreciated. Thanks, Ed ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Announcement: SiteBridge version 1.0
Dear all, I am proudly announcing SiteBridge version 1.0. Briefly about it, SiteBridge is a site bridging system that allows developers to connect his/her locally developed app to an externally accessible site. It's aimed to get rid of the pain of the fact that you are still internally developing an app but want to test how it looks and feels when externally accessible. An obvious example of this is a web app for mobile devices. Usually these devices are on a different network than that used in development. So you won't be able to test it with real devices unless you have a test site, or you have control over everything including providing WIFI network that you mobile devices can get on. However, so many people do not have this luxury especially those working in enterprise environment. This is a pain and even you have a test site it's often still very awkward to incorporate it into the rapid development cycle. Sometimes you just want a quick test to see how things go such as troubleshooting. See this short introduction video. http://www.youtube.com/watch?v=UxhLthKSr_E For more information, check out http://code.google.com/p/sitebridgeserver/ Enjoy! Ed ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Any comments about Clojure language?
Hi all, I start reading about Closure language (http://clojure.org) and it seems an interesting language. I don't know much about this language especially in comparison to Haskell feature by feature. Could it perhaps be what Haskell on JVM would have been with the dressing of Lisp syntax? Any one would like to chime in your comments about the language, in comparison to Haskell? Thanks, Ed ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell and C++ program
Hi all, I was looking around Stroustrup's website and found a simple program that he showed how standard library can be used to make the program succinct and safe. See http://www.research.att.com/~bs/bs_faq2.html#simple-program. I wondered how a Haskell program equivalent to it looks like and I came up with the code below. import qualified Control.Exception as E main = E.catch (interact reverseDouble) (\_ -> print "format error") reverseDouble = unlines . doIt . words where doIt = intro . toStrings . reverse . toDoubles . input toDoubles = map (read::String->Double) toStrings = map show input = takeWhile (/= "end") intro l = ("read " ++ (show $ length l) ++ " elements") : "elements in reversed order" : I'm not a Haskell expert and I am pretty sure that this is not the optimal form a Haskell program that's equivalent to the C++ one. So I would like to see, from the Haskell experts in this group, how else (of course better form) such a program can be written. Thanks, Ed ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Language.Haskell and strings
I'm not a Haskell expert but here the solution to your problem that I can think of. import Data.List prettyStr :: Int -> String -> IO () prettyStr maxlen str = do putStr ("\"" ++ head brokenStr) mapM_ (\str -> putStr ("\\\n\\" ++ str)) (tail brokenStr) putStr "\"\n" where brokenStr = map (snd.unzip) $ groupBy (\_ (i,_) -> i `mod` maxlen /= 0) $ zip [0..] str Ed On Sat, Sep 20, 2008 at 4:14 PM, Maurício <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using Language.Haskell.* and would > like to know if it's possible to > pretty-print big strings like this: > > "" > > into something like this: > > "\ > \\ > \\ > \\ > \\ > \\ > \" > > to respect the limit on number of > columns. Can you help me? Is it > possible to do that? > > Thanks, > Maurício > > ___ > Haskell-Cafe mailing list > 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
Re: [Haskell-cafe] Currying function using values from array
Thanks so much for the response so far. To Lemming's question, this is just a theoretical question. I try comparing what I can do in Groovy with Haskell. So far I could come up with solutions but not this one. I'm not an expert on this but I'm not sure if template haskell or type class would come to rescue this situation. And if so, I wonder how it looks like. Ed On Fri, Aug 8, 2008 at 2:39 PM, Lemming <[EMAIL PROTECTED]>wrote: > Sukit Tretriluxana schrieb: > >> Thanks Tom and Henning for your response. Let me put the question in >> another way by generalizing and tweaking it a little bit. >> >> How in Haskell that I can create a function that curries *any *other >> function, which receives multiple parameters, by using a the input from a >> list (same data type) or a tuple (mixed data type) such that it either >> returns another closure (if not all parameters are curried) or the final >> value of the computation (when all parameters are known)? >> > > Is this a theoretical question or do you actually need this? If yes, I > wonder what application it may be. > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Currying function using values from array
Thanks Tom and Henning for your response. Let me put the question in another way by generalizing and tweaking it a little bit. How in Haskell that I can create a function that curries *any *other function, which receives multiple parameters, by using a the input from a list (same data type) or a tuple (mixed data type) such that it either returns another closure (if not all parameters are curried) or the final value of the computation (when all parameters are known)? Ed On Thu, Aug 7, 2008 at 12:49 PM, Tom Nielsen <[EMAIL PROTECTED]> wrote: > Maybe you want something like > > curryWithList :: ([a]->b)->[a]->([a]->b) > curryWithList f lst1= \lst2 ->f (lst1++lst2) > > addThemUp = sum > curried = curryWithList addThemUp [1,2,3,4] > curried [5] =15 > > On Thu, Aug 7, 2008 at 8:35 PM, Henning Thielemann > <[EMAIL PROTECTED]> wrote: > > > > On Thu, 7 Aug 2008, Sukit Tretriluxana wrote: > > > >> Dear Haskell experts, > >> > >> I am currently studying Groovy language. An experiment I did with its > >> closure is to perform closure/function "curry" using an array containing > the > >> values for the parameter binding. See the sample below. > >> > >> int addThemUp(a,b,c,d,e) { a+b+c+d+e } > >> def arrayCurry(arr, cls) { arr.inject(cls) { c, v -> c.curry(v) } } > >> println addThemUp(1,2,3,4,5) > >> println arrayCurry([1,2,3,4,5], this.&addThemUp)() > >> println arrayCurry([1,2,3,4], this.&addThemUp)(5) > >> > >> The printouts from the above code are the same, verifying that the code > >> works fine. Then I come to ask myself how I can do the same in Haskell. > I'm > >> not a Haskell expert so I couldn't figure it. I wonder if you guys could > >> shed some light on this. > > > > I do not know Groovy, but maybe you want something like > > > > addThemUp :: Num a => (a,a,a,a,a) -> a > > addThemUp (a,b,c,d,e) = a+b+c+d+e > > > > -- should be better named list5Curry or so > > arrayCurry :: ((a,a,a,a,a) -> a) -> [a] -> a > > arrayCurry cls [a,b,c,d,e] = cls (a,b,c,d,e) > > > > print (addThemUp(1,2,3,4,5::Int)) > > print (arrayCurry addThemUp [1,2,3,4,5::Int]) > > > > However, it's hardly of any use, since you won't use a list if the number > > of elements is fixed (and small) or if the elements even must have > > distinct types. > > ___ > > Haskell-Cafe mailing list > > 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
[Haskell-cafe] Currying function using values from array
Dear Haskell experts, I am currently studying Groovy language. An experiment I did with its closure is to perform closure/function "curry" using an array containing the values for the parameter binding. See the sample below. int addThemUp(a,b,c,d,e) { a+b+c+d+e } def arrayCurry(arr, cls) { arr.inject(cls) { c, v -> c.curry(v) } } println addThemUp(1,2,3,4,5) println arrayCurry([1,2,3,4,5], this.&addThemUp)() println arrayCurry([1,2,3,4], this.&addThemUp)(5) The printouts from the above code are the same, verifying that the code works fine. Then I come to ask myself how I can do the same in Haskell. I'm not a Haskell expert so I couldn't figure it. I wonder if you guys could shed some light on this. Thanks, Ed ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] One-line haskell program with GHC
Thanks all. This really helps me a lot! On Jan 18, 2008 6:24 PM, Jonathan Cast <[EMAIL PROTECTED]> wrote: > On 18 Jan 2008, at 2:00 PM, Clifford Beshers wrote: > > 2008/1/18 Sukit Tretriluxana <[EMAIL PROTECTED]>: > > > Hi, > > > > I don't know if it's been asked before. I just wonder if GHC supports > > some sort of one-liner program that can be specify right as the argument to > > either ghci or runghc program. In perl, they have something like > > > > perl *-e* 'print "Hello"' > > > > Do we have similar thing with GHC? > > > > ghc -e 'putStrLn "Yes, we do."' > > > Although, unlike perl, you don't have to say print explicitly if you don't > need it: > > ghc -e '"This works great!"' > > jcc > > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] One-line haskell program with GHC
Thanks a lot! I thought that option resided in ghci or runghc apps. On Jan 18, 2008 2:00 PM, Clifford Beshers <[EMAIL PROTECTED]> wrote: > 2008/1/18 Sukit Tretriluxana <[EMAIL PROTECTED]>: > > > Hi, > > > > I don't know if it's been asked before. I just wonder if GHC supports > > some sort of one-liner program that can be specify right as the argument to > > either ghci or runghc program. In perl, they have something like > > > > perl *-e* 'print "Hello"' > > > > Do we have similar thing with GHC? > > > > ghc -e 'putStrLn "Yes, we do."' > > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] One-line haskell program with GHC
Hi, I don't know if it's been asked before. I just wonder if GHC supports some sort of one-liner program that can be specify right as the argument to either ghci or runghc program. In perl, they have something like perl *-e* 'print "Hello"' Do we have similar thing with GHC? Thanks, Ed ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC 6.6.1 binary package for Ubuntu available?
Thanks! On 8/31/07, Thomas Hartman <[EMAIL PROTECTED]> wrote: > > > you may find this helpful. (with link) > > http://www.haskell.org/pipermail/haskell-cafe/2007-April/024137.html > > > > *"Sukit Tretriluxana" <[EMAIL PROTECTED]>* > Sent by: [EMAIL PROTECTED] > > 08/31/2007 12:19 PM > To > haskell-cafe@haskell.org cc > > Subject > [Haskell-cafe] GHC 6.6.1 binary package for Ubuntu available? > > > > > > > Hi, > > I am wondering if there is the binary package for GHC 6.6.1 for Ubuntu. I > searched in the package manager and I only see the version 6.6. > > Thanks, > Ed___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > --- > > This e-mail may contain confidential and/or privileged information. If you > > are not the intended recipient (or have received this e-mail in error) > please notify the sender immediately and destroy this e-mail. Any > unauthorized copying, disclosure or distribution of the material in this > e-mail is strictly forbidden. > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] GHC 6.6.1 binary package for Ubuntu available?
Hi, I am wondering if there is the binary package for GHC 6.6.1 for Ubuntu. I searched in the package manager and I only see the version 6.6. Thanks, Ed ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] darcs behind firewall
Thank you so much. That works nicely!! Ed On 8/30/07, Thomas Hartman <[EMAIL PROTECTED]> wrote: > > > If you are on linux (I'm on ubuntu) you should be able to set > > export http_proxy=http://proxyserver.com:1234 > export https_proxy=http://proxyserver.com:123 > > vars, per what your sysadmin says. In my case, these are set to the same > var that permits me to use firefox via the proxy, in firefox -> edit-> > preferences -> network tab -> connection settings, http proxy. > > and darcs should "just work" > > thomas. > > > > > *"Sukit Tretriluxana" <[EMAIL PROTECTED]>* > Sent by: [EMAIL PROTECTED] > > 08/30/2007 03:54 PM > To > haskell-cafe@haskell.org cc > > Subject > [Haskell-cafe] darcs behind firewall > > > > > > > Hi all, > > Does anyone know how to specify proxy server and port for darcs to use > when it connects to servers? I am behind firewall most of the time and all > requests have to go through a proxy. > > Thanks, > Ed___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > --- > > This e-mail may contain confidential and/or privileged information. If you > > are not the intended recipient (or have received this e-mail in error) > please notify the sender immediately and destroy this e-mail. Any > unauthorized copying, disclosure or distribution of the material in this > e-mail is strictly forbidden. > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] darcs behind firewall
Hi all, Does anyone know how to specify proxy server and port for darcs to use when it connects to servers? I am behind firewall most of the time and all requests have to go through a proxy. Thanks, Ed ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe