Re: [Haskell-cafe] HughesPJ vs. Wadler-Leijen

2012-03-20 Thread Evan Laforge
On Tue, Mar 20, 2012 at 2:24 AM, Stephen Tetley stephen.tet...@gmail.com wrote: A quick suggestion - does setting the ribbon_frac to something like 0.8 improve things? Nope. The ribbon (IMO both an undescriptive name and underdocumented) only constraints the number of non-indent characters per

Re: [Haskell-cafe] HughesPJ vs. Wadler-Leijen

2012-03-20 Thread Evan Laforge
On Tue, Mar 20, 2012 at 6:52 AM, Stephen Tetley stephen.tet...@gmail.com wrote: Hi Ivan I haven't found any bugs in WL, however I do find the API somewhat confusing regarding line breaking (I would need to consult the manual to tell you the difference between linebreak, softline etc.). This

[Haskell-cafe] ANNOUNCE: fix-imports 1.0.0

2012-03-31 Thread Evan Laforge
I just uploaded a new version to hackage. This improves the heuristics for guessing the right module quite a bit, and adds a local config file where you can prioritize or de-prioritize packages or module prefixes. It's also a bit faster. From the hackage description: A small standalone program

[Haskell-cafe] ANNOUNCE: fast-tags-0.0.1

2012-03-31 Thread Evan Laforge
A while back I was complaining about the profusion of poorly documented tags generators. Well, there is still a profusion of poorly documented tags generators... I was able to find 5 of them. So, that said, here's my contribution to the problem: fast-tags, haskell tag generator #6. Why not use

Re: [Haskell-cafe] ANNOUNCE: fast-tags-0.0.1

2012-03-31 Thread Evan Laforge
On Sat, Mar 31, 2012 at 5:11 PM, dag.odenh...@gmail.com dag.odenh...@gmail.com wrote: On 1 April 2012 00:23, Evan Laforge qdun...@gmail.com wrote: So, that said, here's my contribution to the problem: fast-tags, haskell tag generator #6. I like that it doesn't give duplicate entries for type

Re: [Haskell-cafe] ANNOUNCE: fast-tags-0.0.1

2012-04-01 Thread Evan Laforge
* haskell-src-exts is not slow. It can parse a 769 module codebase racking up  to 100k lines of code in just over a second on my machine. That's  good. Also, I don't think speed of the individual file matters, for  reasons I state below. Wow, that's faster than my machine. * Broken source

Re: [Haskell-cafe] ANNOUNCE: fast-tags-0.0.1

2012-04-01 Thread Evan Laforge
On Sun, Apr 1, 2012 at 3:27 AM, Roman Cheplyaka r...@ro-che.info wrote: It's useful to mention the limitations of this package, so that people know what to expect and don't spend their time testing it to understand that it doesn't suit their needs. Good point, I'll put the limitations and TODO

Re: [Haskell-cafe] A Modest Records Proposal

2012-04-02 Thread Evan Laforge
On Mon, Apr 2, 2012 at 5:41 AM, Michael Snoyman mich...@snoyman.com wrote: On Mon, Apr 2, 2012 at 3:38 PM, Alp Mestanogullari alpmes...@gmail.com wrote: Lesson learned: for next year, write a Haskell program that tells if a given -cafe thread or reddit discussion is a April Fool's joke or

Re: [Haskell-cafe] ANNOUNCE: fast-tags-0.0.1

2012-04-03 Thread Evan Laforge
I recently uploaded fast-tags-0.0.3. The main thing is that all the performance problems I was able to find have been fixed---hopefully will no longer be mistaken as an April Fools joke! Here's copy and paste from the hackage description: Changes since 0.0.2: Lots of speed ups, especially when

Re: [Haskell-cafe] Haskell integration with C/C++ (GSOC)

2012-04-05 Thread Evan Laforge
I love the idea of easier to use FFI, but isn't the haskell FFI intentionally very low level, and intended to be used with tools? In that light, maybe it would be easier to extend hsc2hs with fancier macros and the ability to generate wrappers to directly call C++ methods and construct C++

Re: [Haskell-cafe] prettyprint with IO

2012-04-12 Thread Evan Laforge
On Thu, Apr 12, 2012 at 6:22 PM, Antoine Latter aslat...@gmail.com wrote: Hi Warren, On Thu, Apr 12, 2012 at 6:31 PM, Warren Harris warrensomeb...@gmail.com wrote: I wrote a parsec parser that does symbols lookups during the parsing process (ParsecT String Store IO a). Now I'd like to

Re: [Haskell-cafe] desactivate my Show instance implementations temporarily

2012-04-23 Thread Evan Laforge
I use a custom Pretty class along with HughesPJ, ala ghc's Outputable. It means I can omit data or print it out in a more readable form (even just rounding floats to %.03f can help a lot), and also get nice layout and wrapping. The downside is a certain amount of boilerplate to write output

Re: [Haskell-cafe] Printing call site for partial functions

2012-04-25 Thread Evan Laforge
And then have the compiler automatically include (optional) package name, module name, and line number where `headContext` was called. How about we borrow a bit from rewrite rules, and have a pragma such as:    {-# WITH_CONTEXT head headContext #-} This seems similar to the SRCLOC_ANNOTATE

Re: [Haskell-cafe] Printing call site for partial functions

2012-04-27 Thread Evan Laforge
On Thu, Apr 26, 2012 at 12:20 AM, Simon Peyton-Jones simo...@microsoft.com wrote: Tristan Allwood got quite a long way with this a couple of years ago. http://research.microsoft.com/en-us/um/people/simonpj/papers/stack-trace/DebugTraces.pdf While stack traces are undoubtably useful, I think

[Haskell-cafe] vector operations

2012-05-22 Thread Evan Laforge
So I wanted to find the first index in a vector whose running sum is greater than a given number. The straightforward way is to create the running sum and then search: Vector.findIndex (=target) (Vector.scanl' (+) 0 vector) But vectors are strict so it could do extra work, and what if I don't

Re: [Haskell-cafe] vector operations

2012-05-29 Thread Evan Laforge
, 2012 12:35 AM, Evan Laforge qdun...@gmail.com wrote: So I wanted to find the first index in a vector whose running sum is greater than a given number. The straightforward way is to create the running sum and then search: Vector.findIndex (=target) (Vector.scanl' (+) 0 vector) But vectors

Re: [Haskell-cafe] vector operations

2012-06-11 Thread Evan Laforge
On Tue, May 29, 2012 at 12:52 PM, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: On 29/05/2012, at 19:49, Evan Laforge wrote: Good question.. I copied both to a file and tried ghc-core, but it inlines big chunks of Data.Vector and I can't read it very well, but it looks like the answer

Re: [Haskell-cafe] vector operations

2012-06-11 Thread Evan Laforge
On Mon, Jun 11, 2012 at 1:29 PM, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: Hmm, which version of GHC and what compiler flags are you using? I'm not familiar with ghc-core, maybe that's doing something wrong. Just run ghc -O2 -ddump-simpl and look at the output. Below is the code I'm

[Haskell-cafe] lazy boxed array and builder?

2012-07-12 Thread Evan Laforge
he recent discussion of whether storablevector should be deprecated in favor of vector reminded me: vector supports storable arrays, but it doesn't support lazy arrays. While storablevector has lazy arrays and a builder, it doesn't support boxed types (it would be become misnamed if it did!). So

Re: [Haskell-cafe] stripSuffix

2012-07-18 Thread Evan Laforge
I can think of two cases where I'd want something like this. One is manipulating file extensions, where I'd want to use System.FilePath.splitExtension or something like that anyway. The other is suffix stripping for text processing, where I'd want to use a trie to match a whole lot of

Re: [Haskell-cafe] What Haskell Records Need

2012-08-02 Thread Evan Laforge
On Thu, Aug 2, 2012 at 9:00 AM, Jonathan Geddes geddes.jonat...@gmail.com wrote: Richard O'Keefe Said: Ouch! And that's not even very deeply nested. Imagine 4 or 5 levels deep. It really makes Haskell feel clunky next to `a.b.c.d = val` that you see in other languages. I was taught that

Re: [Haskell-cafe] createProcess running non-existent programs

2012-08-13 Thread Evan Laforge
On Sun, Aug 12, 2012 at 6:18 PM, Niklas Hambüchen m...@nh2.me wrote: I just came across the fact that running createProcess (proc asdfasdf []) with non-existing command asdfasdf returns perfectly fine handles. I would expect an exception. You can even hGetContents on stdout: You just

Re: [Haskell-cafe] Either Monad and Laziness

2012-09-11 Thread Evan Laforge
On Tue, Sep 11, 2012 at 9:36 AM, Eric Velten de Melo ericvm...@gmail.com wrote: Any thoughts? Hopefully I'm not saying anything really stupid. You can intersperse decoding errors in the output, e.g. output is [Either Error DecodedChunk]. Then all the processors have to deal with it, but if you

Re: [Haskell-cafe] Getting started with Shake

2012-09-24 Thread Evan Laforge
With shake I'm not sure exactly how to get started. Should I have a separate project where I create the build system for the webapp? Or can I setup something similar to sbt? Also, how do I handle dependencies with shake? cabal will pull in packages from hackage and do the needful, is

Re: [Haskell-cafe] Optimal line length for haskell

2012-10-30 Thread Evan Laforge
I wonder if people who like one giant window maybe don't use the REPL? I keep 3 windows open: one with the editor, one with ghci, and one with a shell. The shell I use for compiles, darcs records, diffs, grepping, moving files around, etc. I don't understand how people are able work with

[Haskell-cafe] debugging memory corruption

2012-12-01 Thread Evan Laforge
Ever since upgrading to 7.6.1 I regularly get panics like this: seq: internal error: evacuate: strange closure type -1958168540 (GHC version 7.6.1 for x86_64_apple_darwin) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug I've seen some variations, but basically I

Re: [Haskell-cafe] debugging memory corruption

2012-12-02 Thread Evan Laforge
Thanks for the response. On Sat, Dec 1, 2012 at 5:23 PM, Alexander Kjeldaas alexander.kjeld...@gmail.com wrote: What I've mostly done in similar circumstances (jni) 1. Create an interface (virtual functions or template) for the FFI in C++ that covers everything you use. Then create one test

Re: [Haskell-cafe] haskell-like scripting language

2012-12-17 Thread Evan Laforge
Shelly is cool, as I said, but I imagine it would be more valuable to have another language that is actually separate from Haskell, with an interpreter that is more lightweight and changes much less frequently (than GHC). Something that could be nearly as portable as Bash or Perl. Hugs? It

[Haskell-cafe] hsc2hs and Storable (especially) unsafe

2013-01-01 Thread Evan Laforge
It so happens that on 64 bit OS X, haskell's Int is 64 bits, while C's int is 32 bits. hsc2hs's #poke does no typechecking at all, so if you have (#poke Struct, int_field) structp int -- where int :: Int Then you probably are going to corrupt memory, and in a particularly pernicious way (since

Re: [Haskell-cafe] Example programs with ample use of deepseq?

2013-01-08 Thread Evan Laforge
surprisingly, deepseq is not used as much as I thought. http://packdeps.haskellers.com/reverse/deepseq lists a lot of packages, but (after grepping through some of the code) most just define NFData instances and/or use it in tests, but rarely in the „real“ code. For some reason I expected it

Re: [Haskell-cafe] Type classes, collections, sum types, closures, and a massive headache

2013-01-29 Thread Evan Laforge
Today I thought it was about time to simplify how new 'things' of a certain kind are added to the system. These things are some a cross between an event and an assertion of a fact in a rule based system. There are many different kinds of these things. I already have more than a dozen

Re: [Haskell-cafe] Text.PrettyPrint.HughesPJ is sloooow (and wl-pprint-text is fast)

2013-02-04 Thread Evan Laforge
I also get stack overflows from HughesPJ if I format something too big. LW is more efficient by construction than HughesPJ. The only reason I switched to HPJ from LW is that I could never get LW to behave as I wanted, but I'll probably wind up writing my own simpler formatter due to the HPJ

[Haskell-cafe] attoparsec and backtracking

2013-03-15 Thread Evan Laforge
I have a couple of problems with attoparsec which I think are related to its always backtrack nature, but maybe there's some other way to solve the same problems. The first is that it's hard to get the right error msg out. For instance, I have a parser that tries to parse a number with an

Re: [Haskell-cafe] attoparsec and backtracking

2013-03-16 Thread Evan Laforge
I think the mistake here is to parse something and then decide if its it valid. It should be the parser which decides whether its valid. So rather than: suffix - A.option ((:) $ A.letter_ascii) try: typ - A.choice [ {- list or valid suffix parsers -} ] return $

Re: [Haskell-cafe] attoparsec and backtracking

2013-03-16 Thread Evan Laforge
On Fri, Mar 15, 2013 at 8:49 PM, Niklas Hambüchen m...@nh2.me wrote: Is it not possible to add an alternative (no pun intended) to | that supports the semantics Evan wants? I assume it's the performance thing. Presumably it would need to pass an extra flag with to the failure continuation to

Re: [Haskell-cafe] A question about data declaration

2013-03-23 Thread Evan Laforge
Brent, my use case is not particularly complicated. I am trying to model the pdf spec - which says that pdf contains Objects that could of of types Number, String, Name, Array and Dictionary - while array is list of objects, the Disctionary is a list of tuples (Name, Object) not (Object,

Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-08 Thread Evan Laforge
Can't we just add some features to haddock? There are a lot of ways to improve haddock a lot, and no one is doing them, so my impression is that haddock doesn't really have active maintainers. Adding a whole new backend seems risky, unless it results in new maintainers joining. For my personal

Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-08 Thread Evan Laforge
On Mon, Apr 8, 2013 at 3:49 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 9 April 2013 05:08, MigMit miguelim...@yandex.ru wrote: Отправлено с iPad 08.04.2013, в 21:44, Evan Laforge qdun...@gmail.com написал(а): Can't we just add some features to haddock? No, we can't

[Haskell-cafe] customizing haskeline?

2013-04-14 Thread Evan Laforge
I tried to colorize a haskeline prompt by putting control characters in it, but line editing was hopelessly confused, presumably because haskeline doesn't understand control characters and thought the prompt was longer than it really was. From looking at Haskeline.promptedInput, it seems like

[Haskell-cafe] createProcess interferes with sockets?

2013-04-21 Thread Evan Laforge
I've had a strange bug that's baffled me for a long time. I finally got serious about tracking it down, and managed to reduce it to a small program that exhibits the unexpected behaviour, namely that a createProcess seems to block writing to and closing a socket. Here's the example program: ---

Re: [Haskell-cafe] createProcess interferes with sockets?

2013-04-22 Thread Evan Laforge
On Sun, Apr 21, 2013 at 9:25 PM, Donn Cave d...@avvanta.com wrote: Quoth Evan Laforge qdun...@gmail.com, sleep = Process.createProcess (Process.proc sleep [5]) sleep = Process.createProcess ((Process.proc sleep [5]) {Process.close_fds = True}) - Because the client uses buffered I

Re: [Haskell-cafe] createProcess interferes with sockets?

2013-04-22 Thread Evan Laforge
On Mon, Apr 22, 2013 at 7:39 PM, Donn Cave d...@avvanta.com wrote: quoth Evan Laforge qdun...@gmail.com, ... Oh I see, because the subprocess inherits the socket connection. That makes sense, though it's tricky. Tricky tricky unix. Why does fork() have to be so complicated? Well, it's

Re: [Haskell-cafe] Parallel ghc --make

2013-05-13 Thread Evan Laforge
I wrote a ghc-server that starts a persistent process for each cpu. Then a 'ghc' frontend wrapper sticks each job in a queue. It seemed to be working, but timing tests didn't reveal any speed-up. Then I got a faster computer and lost motivation. I didn't investigate very deeply why it didn't

[Haskell-cafe] hackage update brigade (was Re: ANNOUNCE: new bridge! (prelude-prime))

2013-05-27 Thread Evan Laforge
Yes, it would break code. Probably a lot of code. So of course I volunteer to fix my code, but that's not much help, since it's a small minority of the code on hackage. So that made me think, maybe we should organize a kind of hackage community service brigade, which, when the time is right,

Re: [Haskell-cafe] tangential request...

2013-06-22 Thread Evan Laforge
You're overthinking it. I just sent a whole screen. On Sat, Jun 22, 2013 at 7:25 PM, Brandon Allbery allber...@gmail.com wrote: On Sat, Jun 22, 2013 at 9:49 PM, Michael Orlitzky mich...@orlitzky.com wrote: On 06/22/2013 01:28 PM, Mark Lentczner wrote: 3) Do not resize the terminal window

Re: [Haskell-cafe] tangential request...

2013-06-24 Thread Evan Laforge
Inconsolata and Consolas? My bet: - Bitstream Vera Sans Mono - DejaVu Sans Mono - Inconsolata - Whatever the default terminal font is on OS X A bit of a tangent, but a while back I tried a bunch of those recommended programmer fonts, and I didn't like any of them better than the default

Re: [Haskell-cafe] ANNOUNCE: haskell-names-0.1

2013-06-24 Thread Evan Laforge
This is neat, it sounds like I could use this with fix-imports to find only modules that export the right function name, or even to add non-qualified imports. But since it's already 95% good enough for my use case, I probably won't get around to it any time soon. On Thu, Jun 20, 2013 at 8:13 AM,

Re: [Haskell-cafe] ANNOUNCE: haskell-names-0.1

2013-06-25 Thread Evan Laforge
/haskell-suite/halberd On Tue, Jun 25, 2013 at 6:30 AM, Evan Laforge qdun...@gmail.com wrote: This is neat, it sounds like I could use this with fix-imports to find only modules that export the right function name, or even to add non-qualified imports. But since it's already 95% good enough for my

[Haskell-cafe] getting haddock to cooperate with cpp

2013-07-12 Thread Evan Laforge
So haddock ignores {-# LANGUAGE CPP #-}, which makes it crash on any file that uses it. But if you pass --optghc=-cpp, it runs CPP on everything, which makes it crash on any file that uses string gaps, or happens to contain a /*. /* is rare and easily fixed, but not string gaps. It looks like a

Re: [Haskell-cafe] getting haddock to cooperate with cpp

2013-07-12 Thread Evan Laforge
` or calling haddock manually? Cheers, On Fri, Jul 12, 2013 at 3:25 PM, Evan Laforge qdun...@gmail.com wrote: So haddock ignores {-# LANGUAGE CPP #-}, which makes it crash on any file that uses it. But if you pass --optghc=-cpp, it runs CPP on everything, which makes it crash on any file that uses

Re: [Haskell-cafe] getting haddock to cooperate with cpp

2013-07-13 Thread Evan Laforge
If you have an .hs file with {-# LANGUAGE CPP #-}, it is a compiler's job to detect it and run the preprocessor. But haddock uses the GHC API (which knows how to do the above), so there shouldn't be issues with that. Hey, you're right! Haddock *does* understand LANGUAGE CPP. Ok, that makes

Re: [Haskell-cafe] Proposal: Non-recursive let

2013-07-20 Thread Evan Laforge
On Tue, Jul 16, 2013 at 5:20 PM, Richard A. O'Keefe o...@cs.otago.ac.nz wrote: Brian Marick sent me a couple of his stickers. The one I have on my door reads to be less wrong than yesterday. The other one I keep free to bring out and wave around: An example would be handy about now.

[Haskell-cafe] ScopedTypeVariables

2013-08-06 Thread Evan Laforge
Occasionally I have to explicitly add a type annotation, either for clarity or to help choose a typeclass instance. Usually top-level type annotations take care of this, but sometimes it's convenient to only annotate a certain value, e.g. one argument of a lambda. I've noticed that while vanilla

Re: [Haskell-cafe] abs minBound (0 :: Int) negate minBound == (minBound :: Int)

2013-08-21 Thread Evan Laforge
but Integer is actually (if you're using GMP with your ghc): Yes, that's tolerably well known. You only pay the space overhead when you need it (like Lisp or Smalltalk). But you always pay the time overhead. I thought Integers can't be unboxed, regardless of their magnitude?

reifying typeclasses (resend)

2013-09-15 Thread Evan Laforge
[ This is the second time I sent this, the first time it said it was awaiting moderation because I'm not subscribed to haskell-cafe, which is weird because I thought I was. Did a bunch of people get unsubscribed? ] I'm sure this is old-hat to typeclass wizards, but I've managed to get pretty far

Re: [Haskell-cafe] Proposal: Pragma EXPORT

2013-09-16 Thread Evan Laforge
On Mon, Sep 16, 2013 at 4:09 PM, Wvv vite...@rambler.ru wrote: I suggest to add instead of (or with) export section Pragma EXPORT: I doubt this has much chance, since haskell already made its choice here a long time ago (and even if it were still up for discussion, PRAGMA isn't right for it),

Re: [Haskell-cafe] Proposal: Pragma EXPORT

2013-09-17 Thread Evan Laforge
It also makes actual definitions cleaner/shorter rather than cluttering them with extra annotations (either PRAGMAs or public/private markers), though this is not that big of a deal. It's true, though you could get it pretty short, e.g. default private and leading ! for public. Go uses

Re: [Haskell-cafe] reifying typeclasses

2013-09-17 Thread Evan Laforge
Thanks to everyone who replied, indeed it looks like GADTs do what I claimed I wanted. That's neat because I've never been able to think of a use for them. However: On Sun, Sep 15, 2013 at 2:16 AM, o...@okmij.org wrote: Why not to introduce several type classes, even a type class for each

Re: [Haskell-cafe] Music update

2013-10-06 Thread Evan Laforge
I saw the the video on g+, it's especially nice with live instruments. I noticed the code had a fair amount of stuff dealing with limitations of the auto-bass, I assume you had to be careful not to gum up its works. Is there a robotic drumset back there somewhere too? Also change ringing is new

<    1   2   3   4