[Haskell-cafe] haskell.cs.yale.edu error

2013-01-09 Thread Greg Fitzgerald
I was hoping to check on the status of Yampa, but: http://haskell.cs.yale.edu/ [an error occurred while processing this directive] You don't have permission to access the requested directory. There is either no index document or the directory is read-protected. [an error occurred while

Re: [Haskell-cafe] ANNOUNCE: tie-knot library

2012-12-14 Thread Greg Fitzgerald
GHC's reliance on the LGPLed GMP library ... use integer-simple in your GHC I think this can still use some attention. GHC requires an integer library internally, so to switch to integer-simple, you need to build GHC from source. Has anyone reviewed of the performance implications of this

[Haskell-cafe] fixed-length bit-vectors

2012-11-21 Thread Greg Fitzgerald
Hi all, My goal, eliminate the failure case in 'byte': https://gist.github.com/4128503 I don't want my 'byte' function to fail at runtime or return $ Left vector not 8 bits. I want it to return a Word8 for an 8-bit bit-vector or not compile. Is there an existing library that offers

Re: [Haskell-cafe] Cabal failures...

2012-11-19 Thread Greg Fitzgerald
cabal install -v cabal-install Not sure if you're running into this one, but a configuration that wasn't working for me: 1) Install Haskell Platform 2) Install GHC 7.6.1 3) cabal install cabal-install As I recall, the error had something to do with a Cabal-generated 'Paths' file assuming the

Re: [Haskell-cafe] hackageDB haddock errors

2012-11-13 Thread Greg Fitzgerald
Any reason haddock isn't run at the time the package is uploaded? Or could the docs be included in the tarball? Folks oftentimes want to announce their new packages right after uploading them, but usually there are no docs yet. A little awkward. Thanks, Greg On Tue, Nov 13, 2012 at 7:41 AM,

[Haskell-cafe] Safe lens?

2012-10-29 Thread Greg Fitzgerald
Why are getters from the 'lens' package unsafe? Is there a subset like Data.Label.Pure from 'fclabels' that can be imported safely? $ cat a.hs {-# LANGUAGE Safe #-} import Control.Lens.Getter main = print 123 $ runghc a.hs a.hs:3:1: Control.Lens.Getter: Can't be safely imported! The

Re: [Haskell-cafe] Safe lens?

2012-10-29 Thread Greg Fitzgerald
AM, Petr P petr@gmail.com wrote: Hi I believe the reason is that it uses TemplateHaskell for automatic derivation of labels. And TemplateHaskell is of course unsafe, since it could convert your code into something entirely different. Best regards, Petr Pudlak 2012/10/29 Greg

Re: [Haskell-cafe] Safe lens?

2012-10-29 Thread Greg Fitzgerald
for automatic derivation of labels. And TemplateHaskell is of course unsafe, since it could convert your code into something entirely different. Best regards, Petr Pudlak 2012/10/29 Greg Fitzgerald gari...@gmail.com: Why are getters from the 'lens' package unsafe? Is there a subset

Re: [Haskell-cafe] foldr (.) id

2012-10-27 Thread Greg Fitzgerald
:: (F.Foldable t, C.Category cat) = t (cat b b) - cat b b {- Sneaky type-specialization -} Prelude F C :t F.foldr C.id F.foldr C.id :: F.Foldable t = b - t (b - b) - b On Sat, Oct 27, 2012 at 3:09 AM, Ross Paterson r...@soi.city.ac.uk wrote: On Fri, Oct 26, 2012 at 07:41:18PM +0100, Greg Fitzgerald

[Haskell-cafe] Overload function application? (was: foldr (.) id)

2012-10-27 Thread Greg Fitzgerald
libraries, and effectively none of the runtime, by implementing instances for literals and function application? Say, for example, to generate a call graph, or make the language strict, or target LLVM more directly. Anyone tried this? Thanks, Greg On Sat, Oct 27, 2012 at 11:39 AM, Greg Fitzgerald

[Haskell-cafe] foldr (.) id

2012-10-26 Thread Greg Fitzgerald
Hi Haskellers, I've recently found myself using the expression: foldr (.) id to compose a list (or Foldable) of functions. It's especially useful when I need to map a function over the list before composing. Does this function, or the more general foldr fmap id, defined in a library anywhere?

Re: [Haskell-cafe] foldr (.) id

2012-10-26 Thread Greg Fitzgerald
parseOrIgnore p = either (const s) id . parse p s parseAllOrIgnore = compose . map parseOrIgnore [p1, p2, p3] Naming: (.)/compose is consistent with (+)/sum, (*)/product, ()/and, etc. Thoughts? -Greg On Fri, Oct 26, 2012 at 12:31 PM, John Wiegley jwieg...@gmail.com wrote: Greg Fitzgerald gari

Re: [Haskell-cafe] foldr (.) id

2012-10-26 Thread Greg Fitzgerald
sorry for the buggy code let parseOrIgnore p s = either (const s) id $ parse p s let parseAllOrIgnore = compose . map parseOrIgnore [p1, p2, p3] parseAllOrIgnore abbbcccbbba On Fri, Oct 26, 2012 at 2:11 PM, Greg Fitzgerald gari...@gmail.com wrote: Hmm, neato. but didn't make life any

[Haskell-cafe] a parallel mapM?

2012-09-28 Thread Greg Fitzgerald
I'm new to concurrent programming in Haskell. I'm looking for a drop-in replacement for 'mapM' to parallelize a set of independent IO operations. I hoped 'mapConcurrently' might be it, but I need something that will only spawn as many threads as I have CPUs available [1]. I also tried

Re: [Haskell-cafe] a parallel mapM?

2012-09-28 Thread Greg Fitzgerald
-io/0.3.2/doc/html/Control-Concurrent-ParallelIO-Global.html On Fri, Sep 28, 2012 at 1:01 PM, Greg Fitzgerald gari...@gmail.com wrote: I'm new to concurrent programming in Haskell. I'm looking for a drop-in replacement for 'mapM' to parallelize a set of independent IO operations. I hoped

Re: [Haskell-cafe] JavaScript (SpiderMonkey, V8, etc) embedded in GHC?

2012-09-09 Thread Greg Fitzgerald
Hi Bob, All I really need is to allow users to write some JavaScript that accepts a single JSON 'file/string' from my Haskell program and produces another JSON 'file/string' that my Haskell program will accept. One option is to make your Haskell program an HTTP server, and then use Node.js

Re: [Haskell-cafe] [Haskell-beginners] Why is the the transpose function in Data.List more complicated?

2012-08-03 Thread Greg Fitzgerald
Hi KC, transp :: [[b]] - [[b]] transp ([]:_) = [] transp rows = map head rows : transp (map tail rows) Why is the the transpose function in Data.List more complicated? In the Data.List version, the list comprehension syntax quietly filters out items that fail to pattern-match (empty

[Haskell-cafe] (+1) vs let inc=(+1)

2012-05-22 Thread Greg Fitzgerald
In ghci 7.4.1: Prelude :t (+1) (+1) :: Num a = a - a Prelude let inc=(+1) Prelude :t inc inc :: Integer - Integer Why the difference? Thanks, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] (+1) vs let inc=(+1)

2012-05-22 Thread Greg Fitzgerald
Thanks! $ ghci -XNoMonomorphismRestriction Prelude :t (+1) (+1) :: Num a = a - a Prelude let inc=(+1) Prelude :t inc inc :: Num a = a - a Cool. -Greg On Tue, May 22, 2012 at 12:34 PM, Artyom Kazak artyom.ka...@gmail.comwrote:

Re: [Haskell-cafe] anyone else driven mad by trying to setup a gmp free version of haskell platform?

2012-05-08 Thread Greg Fitzgerald
can we build a version of the compiler that loads [GMP] via dlopen on demand? An explanation from well-typed: http://www.well-typed.com/blog/32 But that was ~3 years ago. Anybody still looking at possible solutions? Maintaining the INTEGER_SIMPLE branch of GHC, minor as it is, is still a

[Haskell-cafe] LLVM M.D. source code?

2012-05-08 Thread Greg Fitzgerald
A paper, LLVM M.D.: A Denotational Translation Validator, mentions the source code for LLVM M.D is available here: http://llvm-md.seas.harvard.edu/ I can't seem to spot it there or on Hackage. Anyone seen it? Thanks, Greg ___ Haskell-Cafe mailing

[Haskell-cafe] ping haskell.org timeout

2011-08-25 Thread Greg Fitzgerald
cabal update hangs. ping haskell.org times out. But haskell.org and hackage webpages are loading just fine. What's going on? Thanks, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] ANN: spec2code

2010-04-01 Thread Greg Fitzgerald
After 5 years of RD, I’m proud to announce the spec2code compiler. With spec2code, developers no longer need to acknowledge the mundane details of programming, such as memory allocation, bounds-checking, byte ordering, inheritance models or performance tuning. spec2code uses the latest techniques

Re: [Haskell-cafe] Token parsers in parsec consume trailing whitespace

2009-12-14 Thread Greg Fitzgerald
Hi Edward, 1. Is there a more elegant way of doing number parsing? In particular, are there token parsers that don't consume trailing whitespace, or is there a better way to do this with the primitives. Parsec defines a combinator it calls 'lexeme' which the tokenizer wraps each of its

Re: [Haskell-cafe] Implicit newtype unwrapping

2009-12-03 Thread Greg Fitzgerald
On Thu, Dec 3, 2009 at 5:34 AM, Conor McBride wrote: http://www.haskell.org/pipermail/libraries/2008-January/008917.html On Tue, Jan 15, 2008 at 3:31 PM, Conor McBride wrote: Haskell's classes are the best damn rhythm section in the industry: you hum it, they play it. On Fri, Dec 10, 2004 at

Re: [Haskell-cafe] Implicit newtype unwrapping

2009-12-02 Thread Greg Fitzgerald
Gregory Crosswhite gcr...@phys.washington.edu wrote: Out of curiosity, why would one want a newtype that were unwrapped implicitly, rather than just using type? One reason might be because you only switched from 'type' to 'newtype' so that you could write more refined Arbitrary instances for

Re: [Haskell-cafe] Implicit newtype unwrapping

2009-12-02 Thread Greg Fitzgerald
That suggests that the feature we'd really like is a way to declare that we want a type in a context to act as if it had a different instance declaration for a given typeclass, without having to go through newtype. I'd want implicit type coercion from subtypes, so that you wouldn't need an

Re: [Haskell-cafe] cabal haddock hpc, exposed modules?

2009-10-28 Thread Greg Fitzgerald
Duncan wrote: By default hpc markup will generate pages for every module in the program. Am I missing something? Nope, user error. I started using --include to avoid running coverage over my test framework files, and was looking for something like haddock's internal flag before thinking to

[Haskell-cafe] cabal haddock hpc, exposed modules?

2009-10-27 Thread Greg Fitzgerald
I have a cabal package that defines a few dozen modules, and I'm hoping to generate documentation and code coverage for all modules without listing each module explicitly. currently my .cabal includes: library exposed-modules: Language.Idl.Data, Language.Idl.Merge,

[Haskell-cafe] Re: cabal haddock hpc, exposed modules?

2009-10-27 Thread Greg Fitzgerald
not . doesDirectoryExist) (flatten tree) childPaths :: FilePath - IO (FilePath, [String]) childPaths dir = do b - doesDirectoryExist dir fs - if b then getDirectoryContents dir else return [] return (dir, [dir ++ / ++ p | p - fs, head p /= '.']) -Greg On Tue, Oct 27, 2009 at 2:33 PM, Greg

Re: [Haskell-cafe] Re: a boring parser

2009-10-01 Thread Greg Fitzgerald
Cool, I like how this parser can model the Look, an Eagle scenario. For reference: http://www.youtube.com/watch?v=pjh3e198pUQ The parser can change focus (that is, change traversal strategy) in response to a successful parse. In the Look, an Eagle scenario, the bear is able to interpret and

Re: [Haskell-cafe] the problem of design by negation

2009-05-20 Thread Greg Fitzgerald
On Wed, May 20, 2009 at 3:54 PM, Michael Mossey m...@alumni.caltech.edu wrote: I want to aspire to positive design. I want to list the goals, and think of design as making clever choices that meet all the goals. Design by Thomas the Tank Engine? ___

[Haskell-cafe] Parsec and (then?) type-check

2008-12-12 Thread Greg Fitzgerald
Parser gurus, When you write a parser with a library like Parsec, do you typically type-check while parsing, or afterward in a separate pass? The latter is more modular, but it means labeling every element in the AST with the parser position so that you can give good error messages. Do you find

Re: [Haskell-cafe] Re: [Haskell] GHC 6.10 and OpenGL

2008-11-22 Thread Greg Fitzgerald
$ cabal install OpenGL HOpenGL installs easily with cabal-install, but most HOpenGL examples and tutorials also use GLUT, which is not so painless on Windows. Luckily Conal Elliot just recently posted detailed instructions of how to do it:

Re: [Haskell-cafe] Re: OOPer?

2008-11-17 Thread Greg Fitzgerald
Jonathan Cast wrote: [Functional and object-oriented programming] have points of similarity, but on net the best plan is to simply never reason analogically from one to the other. Coming from the OO world, I found it very useful to see how the same solution is modeled using different

Re: [Haskell-cafe] Re: OOPer?

2008-11-17 Thread Greg Fitzgerald
! -Greg On Mon, Nov 17, 2008 at 11:00 AM, Greg Fitzgerald [EMAIL PROTECTED] wrote: Jonathan Cast wrote: [Functional and object-oriented programming] have points of similarity, but on net the best plan is to simply never reason analogically from one to the other. Coming from the OO world, I

[Haskell-cafe] Linker errors to OpenGL with GHC 6.10.1

2008-11-12 Thread Greg Fitzgerald
Do you know how I can fix these linker errors? C:\projects\funcat HelloWorld.hs import Graphics.Rendering.OpenGL import Graphics.UI.GLUT main = do (progname, _) - getArgsAndInitialize createWindow Hello World displayCallback $= clear [ColorBuffer] mainLoop C:\projects\funls lib

Re: [Haskell-cafe] lines of code metrics

2008-08-20 Thread Greg Fitzgerald
On Aug 19, 2008, at 9:12 AM, Greg Fitzgerald wrote: Does anyone know of a good case study comparing a project written in C versus one written in Haskell? I'm mostly looking for a comparison of lines of code, but any other metric, such as time to market and code quality metrics could also

Re: [Haskell-cafe] lines of code metrics

2008-08-20 Thread Greg Fitzgerald
Greg wrote: Thank you all for your help! These references are a great help for pushing Haskell at work. Don wrote: I've also set up the Who's using Haskell section on haskell.org's front page -- let me know what you think Great, thanks! I added Qualcomm. -Greg

[Haskell-cafe] lines of code metrics

2008-08-19 Thread Greg Fitzgerald
Does anyone know of a good case study comparing a project written in C versus one written in Haskell? I'm mostly looking for a comparison of lines of code, but any other metric, such as time to market and code quality metrics could also be ___

[Haskell-cafe] GHC ARM Hackathon (Re: Haskell on ARM )

2008-07-02 Thread Greg Fitzgerald
It may not be long before most of the computing world has gone mobile. CNET suggests the major players will be Qualcomm and Intel, where QC is more power-efficient, but Intel conveniently targets x86. June 29, 2008 7:30 PM PDT Qualcomm vs Intel: You

[Haskell-cafe] Re: GHC ARM Hackathon (Re: Haskell on ARM )

2008-07-02 Thread Greg Fitzgerald
...try that hyperlink again... Qualcomm vs Intel: You decide http://news.cnet.com/8301-13924_3-9979989-64.html On Wed, Jul 2, 2008 at 11:16 AM, Greg Fitzgerald [EMAIL PROTECTED] wrote: It may not be long before most of the computing world has gone mobile. CNET suggests the major players

[Haskell-cafe] derive Pretty?

2008-01-31 Thread Greg Fitzgerald
Is it possible to automatically derive instances of Prettyhttp://haskell.org/ghc/docs/latest/html/libraries/haskell-src/Language-Haskell-Pretty.html? If no, what do most do when it comes to pretty-printing large data types? Thanks, Greg ___ Haskell-Cafe

[Haskell-cafe] shootout using 6.6?

2008-01-17 Thread Greg Fitzgerald
http://shootout.alioth.debian.org/gp4/haskell.php Anyone know if the Language Shootout is actually using GHC 6.6 or is that a typo? Thanks, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] cabal and hpc?

2008-01-14 Thread Greg Fitzgerald
Has the Haskell Program Coverage tool been integrated into Cabal? That is, is there anything like runhaskell Setup.hs coverage to generate a coverage report? Thanks, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: Exposed module still hidden, why?

2007-11-20 Thread Greg Fitzgerald
Why does GHC still think the package is hidden? You need to add directory to the Build-Depends instruction in the cabal file Thanks Olivier. Haddock now builds with this list for 'build-depends': base=1.0, haskell98=1.0, directory=1.0, process=1.0, containers=0.1, array=0.1, pretty=1.0 The

[Haskell-cafe] Re: Composing trading strategies (was: Should I step into a minefield? / Writing a trading studio in Haskell)

2007-11-08 Thread Greg Fitzgerald
Hi Joel, Can you post a couple of examples of what the trading strategies look like? Here are some very simple strategies, which are written in the context of just one stock. If these aren't very convincing, could you post some more complex strategies that you'd like to see built using this

[Haskell-cafe] Composing trading strategies (was: Should I step into a minefield? / Writing a trading studio in Haskell)

2007-11-08 Thread Greg Fitzgerald
My idea is to write something like TradeStation [1] or NinjaTrader, only for the Mac. It would be quite nifty to use SPJ's financial combinator approach I was experimenting with a Haskell EDSL for financial trading not too long ago. My favorite strategy so far is the parallel parser combinator

[Haskell-cafe] ARM back end?

2007-11-02 Thread Greg Fitzgerald
Anybody know of an ARM back end for any of the Haskell compilers? Thanks, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Why can't Haskell be faster?

2007-11-02 Thread Greg Fitzgerald
while LOC is not perfect, gzip is worse. the gzip change didn't significantly alter the rankings Currently the gzip ratio of C++ to Python is 2.0, which at a glance, wouldn't sell me on a less code argument. Although the rank stayed the same, did the change reduce the magnitude of the victory?

Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-04 Thread Greg Fitzgerald
Paul, This page (http://www.npdbd.umn.edu/deliver/elevator.html) has a template for an elevator pitch. I thought I'd try instantiating it for Haskell. For software developers who need to produce highly reliable software at minimum cost... Looks like a good pitch for developers. Here's my

Re: [Haskell-cafe] directory tree?

2007-06-22 Thread Greg Fitzgerald
Chad, I can't seem to find anything representing a directory tree Here's my shot. http://hpaste.org/370 Not much different than Tom Moertel's, but grabs the fileSize along the way. -Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] embedded build language?

2007-06-15 Thread Greg Fitzgerald
Tomek, If you want to see the code I will try to release it I'm very interested. Thanks, Greg On 6/15/07, Tomasz Zielonka [EMAIL PROTECTED] wrote: On Thu, Jun 14, 2007 at 05:55:46PM -0700, Greg Fitzgerald wrote: Has anyone embedded a build language in Haskell? Something like Rakehttp

[Haskell-cafe] embedded build language?

2007-06-14 Thread Greg Fitzgerald
Has anyone embedded a build language in Haskell? Something like Rakehttp://rake.rubyforge.org/is to Ruby, but in Haskell or any statically-typed functional language. Thanks, Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Re: [Haskell] Who pays for *.haskell.org machines?

2007-06-13 Thread Greg Fitzgerald
is its funding will be reliable? for example, if we don't get money from Google in 2008 year? Some hosting companies, like http://turtol.com/ offer pay once, keep forever. Would that be an option? Thanks, Greg ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Idiomatically using lists

2007-06-05 Thread Greg Fitzgerald
) | i == length xs - 1 = (0, last xs : init (tail xs) ++ [head xs]) | otherwise = (i + 1, start ++ [right,left] ++ end) where (start, left:right:end) = splitAt i xs -Greg On 6/4/07, kevin birch [EMAIL PROTECTED] wrote: On 火, 2007-6月-05, at 02:54, Greg Fitzgerald wrote

Re: [Haskell-cafe] Lazy IO and closing of file handles

2007-03-14 Thread Greg Fitzgerald
Pete, mapM fileContentsOfDirectory = mapM_ print . threadEmails . map parseEmail . concat By using the IO monad you've /scheduled/ your first 'print' to occur after your last 'readFile', so every file is opened before the first file is read. I've come across the same problem and

[Haskell-cafe] How to build a generic spreadsheet?

2007-02-23 Thread Greg Fitzgerald
I want to write a program where a user would update a bunch of variables, and everything that depends on those variables (and nothing else) are recalculated. Basically, a spreadsheet, but generalized for any computation. Could someone recommend an elegant way to do it or some good reading

Re: [Haskell-cafe] pythags

2007-02-12 Thread Greg Fitzgerald
Check out Hoogle: http://haskell.org/hoogle/?q=guard import Control.Monad -Greg On 2/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, the Advanced Monads page in the Haskell Wikibook (http://en.wikibooks.org/wiki/Haskell/Advanced_monads) contains the following example of a List

Re: [Haskell-cafe] OT: any haskell-friendly / functional programming friendly comp sci programs? (for a 30s guy who did his undergrad in liberal arts)

2007-02-05 Thread Greg Fitzgerald
Thomas, Here's a good place to start, although I'm not sure how up to date it is: http://haskell.org/haskellwiki/Haskell_in_education I too am interested in an FP-related, higher education in California. Could you please send another post with whatever information you find? Thanks, Greg On

Re: [Haskell-cafe] Suggestions for a hReadUntilStr implementation

2007-02-04 Thread Greg Fitzgerald
, thanks for the link. Cheers, Matt On 2/3/07, Greg Fitzgerald [EMAIL PROTECTED] wrote: Hi Matt, hReadUntilStr - that is, a function that takes a Handle as an input source, a String to match, and a Num a as the number of seconds to wait before returning a (String, Bool) where the String

Re: [Haskell-cafe] Suggestions for a hReadUntilStr implementation

2007-02-03 Thread Greg Fitzgerald
Hi Matt, hReadUntilStr - that is, a function that takes a Handle as an input source, a String to match, and a Num a as the number of seconds to wait before returning a (String, Bool) where the String is all the text read from the Handle until either matching or timing out and the Bool is true

Re: [Haskell-cafe] Simple HTTP lib for Windows?

2007-01-19 Thread Greg Fitzgerald
Alistair, Neil, Brad, Yitzchak, Bjorn, Thanks all for your help. -Greg On 1/19/07, Björn Bringert [EMAIL PROTECTED] wrote: Greg Fitzgerald wrote: I'd like to write a very simple Haskell script that when given a URL, looks up the page, and returns a string of HTML. I don't see an HTTP

[Haskell-cafe] Simple HTTP lib for Windows?

2007-01-17 Thread Greg Fitzgerald
I'd like to write a very simple Haskell script that when given a URL, looks up the page, and returns a string of HTML. I don't see an HTTP library in the standard libs, and the one in Hackage requires Windows machines have GHC and MinGW to be installed and in the PATH. Is there a simple way to

Re: [Haskell-cafe] Shrinking the Prelude: The categorical approach

2006-12-20 Thread Greg Fitzgerald
Wouldn't this raise the same problems monad comprehensions raise? The do-notation isn't specific to IO, yet it is the only thing beginners use it for. Do beginners have noticeably more trouble with the do-notation errors than list comprehension errors? As someone who learned Haskell fairly

Re: [Haskell-cafe] Showing the 1 element tuple

2006-12-19 Thread Greg Fitzgerald
Neil, On Tue, Dec 19, 2006 at 10:41:56PM +, Neil Mitchell wrote: A weird question, what does the 1 element tuple look like? Could tuples be implemented as an HList? singleton = (`hCons` hNil) -Greg ___ Haskell-Cafe mailing list

[Haskell-cafe] Refactoring recklessly

2006-12-12 Thread Greg Fitzgerald
I'd like to be able to reorganize my code and then verify that I didn't change any functionality. That is, the old and new code have precisely the same meaning. Also, I'd like to be able to change a function and verify that efficiency was the only thing affected. Are either of these possible

Re: [Haskell-cafe] Reversing a string of words: C# v Perl V Ruby v Haskell

2006-12-11 Thread Greg Fitzgerald
Hi Steve, On 12/11/06, Steve Downey [EMAIL PROTECTED] wrote: transforming one two three four into four three two one, how could this be done? This is a good problem for Parsechttp://www.cs.uu.nl/%7Edaan/download/parsec/parsec.html : import Text.ParserCombinators.Parsec

[Haskell-cafe] '+++' and 'interleave'

2006-12-04 Thread Greg Fitzgerald
Could ReadP's '+++' (symmetric choice) operator be implemented for all Monads with the 'interleave' function mentioned in Backtracking, Interleaving, and Terminating Monad Transformershttp://portal.acm.org/ft_gateway.cfm?id=1086390type=pdfcoll=GUIDEdl=GUIDECFID=5430836CFTOKEN=76321932? This paper

[Haskell-cafe] Parsec: Where's +++?

2006-12-01 Thread Greg Fitzgerald
Koen Claessen's Parallel Parsing Processes, suggests their parsing combinators have been integrated into Parsec. If so, where is the +++ operator hiding? If not, does anyone know of a parsing library with a choice operator that does breadth-first search? Also, how do I determine what instances

Re: [Haskell-cafe] Parsec: Where's +++?

2006-12-01 Thread Greg Fitzgerald
Text.ParserCombinators.ReadP.(+++) :: ReadP a - ReadP a - ReadP a Wow, fast and complete, Thanks Don!:) Would it make sense to derive instances of Applicable and Alternative for ReadP? Something like this maybe: instance Applicative ReadP where pure = return (*) = ap

Re: [Haskell-cafe] Re: Strictness, order of IO operations: NewCGI HDBC

2006-10-20 Thread Greg Fitzgerald
Does DB.getTables use 'unsafeInterleaveIO'?I would think that if an unsafe operation was *not* used, DB.disconnect could *not* execute before DB.getTables has returned every row.Either way, by the Principle of Least Surprise, I think Tim's original code ought to be made to work, despite not

Re: [Haskell-cafe] Re: Strictness, order of IO operations: NewCGI HDBC

2006-10-20 Thread Greg Fitzgerald
An ugly solution is to explicitly keep a pointer to the next unevaluated entry, advancing it in the interleaved IO operation. A leaky solution is to keep a reference to the list, and force it all. Another way to attack this is asking: Why doesn't the simple solution work? That is, not using

Re: [Haskell-cafe] flip dot

2006-09-28 Thread Greg Fitzgerald
You mean apply the function on the right to the result of the left?Yes.(.) :: a - (a - b) - bx.f == f xPrefix usage:given: (f :: Integer - Char) and (g :: Double - Double - Integer) (foo = .f) == \x - f x(bar = .g) == \x y = g x yfoo :: Double - Double - Charfoo = .g.f How about making . reverse

[Haskell-cafe] flip dot

2006-09-27 Thread Greg Fitzgerald
Since there's talk of removal of the composition operator in Haskell-prime, how about this: Instead of:foo = f . gyou write:foo = .g.fA leading dot would mean, apply all unnamed parameters to the function on the right. A trailing dot would mean, apply the result of the left to the function on the

Re: [Haskell-cafe] automatic instance derivation

2006-08-19 Thread Greg Fitzgerald
well, the best practical way i know is to use Template Haskell / DrIFTThat's too bad. I was hoping we could trivially solve Tim Newsham's XML problem by importing HaXml, automatically deriving Data and Typeable for HaXml's 'Content' data type, and then use 'everywhereM' from

[Haskell-cafe] automatic instance derivation

2006-08-18 Thread Greg Fitzgerald
How do you automatically derive an instance for a data type defined in an imported module?-- automatic instance derivation directly after type declarationdata Val1 = V1 Int deriving Show-- manual instance derivation can be in separate file data Val2 = V2 Intinstance Show Val2 where show (V2 i) =

[Haskell-cafe] ghc hackathon start time?

2006-07-25 Thread Greg Fitzgerald
What time on September 14th will the GHC Hackathon begin? I don't need a precise answer, just a quick one. Plus or minus an hour will do.Thanks,Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: XML transformation difficulties

2006-07-14 Thread Greg Fitzgerald
is a string, can I get access to that string without using 'runX': getAttrValue :: String - a XmlTree StringAre Arrows the wrong tool for this job?Thanks,GregOn 7/14/06, Greg Fitzgerald [EMAIL PROTECTED] wrote: I'm trying to think of a way to translate this input, to the output below: Input: testfoo

[Haskell-cafe] Arrows and 'do' syntax

2006-07-11 Thread Greg Fitzgerald
I'm trying to translate this HXT code to use the Arrow 'do' syntax:readWriteDoc :: String - IOSLA (XIOState s) b IntreadWriteDoc path = readDocument [(a_validate, 0)] path writeDocument [(a_output_encoding, isoLatin1)] - getErrStatusThis attempt fails to compile: readWriteDoc :: String -

Re: [Haskell-cafe] Haskell performance in heavy numerical computations

2006-07-06 Thread Greg Fitzgerald
I have tried. Using just normal lists, I found it difficult to avoid huge space leaks, but once things are working, the end result is easy to reason about.I'm considering giving it another try using Stream Processors or some form of Arrows instead of lists. I think this strategy might allow me to

[Haskell-cafe] cabal-get and HXT?

2006-06-19 Thread Greg Fitzgerald
I'd like to use a tool to automatically install Haskell XML Toolkit and its dependencies. What are my options? How's cabal-get coming?Thanks,Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Parsec memory behavior

2006-05-17 Thread Greg Fitzgerald
big memory leak ... two parsers in sequenceA related question, are these two equivalents?foldl2 f g y z lst = (foldl f y lst, foldl g z lst)foldl2' f g y z lst = foldl (\(i, j) x - (f i x, g j x)) (y, z) lst If no, is there some strictness that can be added to make them equivalent? And if so,

Re: [Haskell-cafe] Advice needed on best way to simulate an STL vector

2006-04-19 Thread Greg Fitzgerald
Brian, implementing the text buffer for an edit controlJust a few weeks ago I was thinking about a functional way to implement an edit control. I ended up with the code below. The function 'text' takes a stream of user input and returns the text to be displayed. Rather than using a mutable buffer,

Re: [Haskell-cafe] multiple computations, same input

2006-03-28 Thread Greg Fitzgerald
...Anyway, I can't help but think that there might be a happy mediumbetween eager and lazy evaluation. What I'd love to see is the compiler continue to be call-by-need, but be smart enough to recognize when multiple expressions will all eventually need to be evaluated. A simple example: show (a +

[Haskell-cafe] multiple computations, same input

2006-03-27 Thread Greg Fitzgerald
How do I perform multiple computations on a long lazy list without introducing a space leak?Doing a single computation like this works great: f = show . filter ( 1)But if I do something like this: f lst = show (filter ( 1) lst, filter ( 2) lst)then it looks like GHC won't garbage collect list

Re: [Haskell-cafe] multiple computations, same input

2006-03-27 Thread Greg Fitzgerald
hold a part of the data in memory while you show the first one,Here would be a better example then. f lst = show (sum (filter ( 1) lst), sum (filter ( 2) lst))It ought to be *possible* to compute both operations without holding onto any of the list elements. In the imperative world, you'd say:

Re: [Haskell-cafe] multiple computations, same input

2006-03-27 Thread Greg Fitzgerald
Thanks Neil. How do I add in another ~10 computations, or map a list of a 100 computations to the same input?Isn't there a way to do this without one computation having to be aware of the other? This feels like a situation Parsec users would find themselves in all the time. When you have a bunch