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

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] 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),

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] 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?

[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] 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.

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

[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] 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

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] 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

[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] 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

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

[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: ---

[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

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

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] 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

[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] 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

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] 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

[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] 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

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

[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] 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

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] 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] 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] 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] 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

[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] 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

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

[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] 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

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] 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] 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] 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] 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] 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-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

[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

[Haskell-cafe] HughesPJ vs. Wadler-Leijen

2012-03-20 Thread Evan Laforge
I've been trying to get my head around the Wadler-Leijen pretty printing combinators for a while now and having some trouble. Specifically, I have trouble getting them to pick optimal line breaks. The existing combinators like 'sep' (and everything built from it) merge all elements with $ and

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

Re: [Haskell-cafe] Records in Haskell

2012-03-01 Thread Evan Laforge
Thanks Evan, I've had a quick read through. Thanks for reading and commenting! It's a bit difficult to compare to the other proposals. I can't see discussion of extracting higher-ranked functions and applying them in polymorphic contexts. (This is SPJ's `rev` example.) Putting h-r fields

Re: [Haskell-cafe] Records in Haskell

2012-02-27 Thread Evan Laforge
[ ccing the list because the wiki page was flawed and I made a bunch of changes, hope you don't mind ] Thanks Evan, but I think that wiki page isn't doing your proposal justice. There seem to be several typos in critical places that make it hard to follow (for me at least). Sorry about the

Re: [Haskell-cafe] Data.IntMap union complexity

2012-02-24 Thread Evan Laforge
I've wondered if it's faster to insert many keys by successive insertion, or by building another map and then unioning, and likewise with deletion. I eventually decided on successive, thinking a log n build + merge is going to be slower than a m*log n for successive insertion. So I wound up

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution -record update

2012-02-12 Thread Evan Laforge
OK, we could implement lenses, make `tempo' a lens instead of a selector, desugar the update syntax to call the update 'method' out of the lens, ... And of course somehow arrange the sugar that when `tempo' appears in other contexts we take the select 'method'. implement lenses - Done, of

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-10 Thread Evan Laforge
On Thu, Feb 9, 2012 at 10:03 PM, Donn Cave d...@avvanta.com wrote: Quoth Evan Laforge qdun...@gmail.com, On Thu, Feb 9, 2012 at 12:49 PM, Donn Cave d...@avvanta.com wrote: ... For example, in a better world you could write stuff like   modifyConfig :: (Config - a) - (a - a) - Config - Config

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-09 Thread Evan Laforge
On Thu, Feb 9, 2012 at 12:49 PM, Donn Cave d...@avvanta.com wrote: Quoth Evan Laforge qdun...@gmail.com, ... The non-composing non-abstract updates are what bug me, and make me scatter about tons of 'modifyThis' functions, both for composability and to protect from field renames. So

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-08 Thread Evan Laforge
On Wed, Feb 8, 2012 at 2:47 PM, Malcolm Wallace malcolm.wall...@me.com wrote: On 8/02/2012, at 14:16, Steve Horne sh006d3...@blueyonder.co.uk wrote: I haven't given a lot of thought to updates. I very much fail to see the point of replacing prefix function application with postfix dots,

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-08 Thread Evan Laforge
How about § then?  Surely at this late date we can allow ourselves *one* non-ASCII character? The very name of it (*section* sign) suggests taking a part; and if you are totally in love with dot, think of it as a dot with ponytails. I suggest record的field, or record之field for the more

[Haskell-cafe] a variant of TDNR (was: Re: Some thoughts on Type-Directed Name Resolution)

2012-02-06 Thread Evan Laforge
I brought up an idea on another thread, but it was a bit off subject and I think it got buried. Anyway, I'm curious to know if there are any obvious problems with this idea, or if it could be pursued further: It could be called Tagged Type Directed Name Resolution. The idea is a # prefix for

Re: [Haskell-cafe] Some thoughts on Type-Directed Name Resolution

2012-02-01 Thread Evan Laforge
I haven't read the underlying proposals, so I apologize if the following is covered, but my understanding of the discussion is that the x.f notation is intended to disambiguate f to be a field name of the type of x and therefore be advantageous over f x notation where f is presently in the

Re: [Haskell-cafe] Why were unfailable patterns removed and fail added to Monad?

2012-01-19 Thread Evan Laforge
On Thu, Jan 19, 2012 at 8:53 PM, Edward Z. Yang ezy...@mit.edu wrote: It's not obvious that this should be turned on by -Wall, since you would also trigger errors on uses like:    [ x | Just x - xs ] I was going to say, perhaps refutable matches were considered important was because back then

[Haskell-cafe] Functor0?

2012-01-15 Thread Evan Laforge
Often when I define some type that wraps something else, I find myself writing a function like the following: newtype Thing = Thing X liftThing f (Thing x) = Thing (f x) It's like a Functor, but I can't make it an instance because Functor requires that the type be parametric. So I've been using

Re: [Haskell-cafe] indentation blues

2011-12-14 Thread Evan Laforge
On Mon, Dec 12, 2011 at 4:50 PM, Martin DeMello martindeme...@gmail.com wrote: The vim autoindent for haskell is really bad :( Is there a better indent.hs file floating around somewhere? Alternatively, is the emacs haskell mode better enough that it's worth my time learning my way around emacs

Re: [Haskell-cafe] indentation blues

2011-12-14 Thread Evan Laforge
On Wed, Dec 14, 2011 at 5:56 AM, Rustom Mody rustompm...@gmail.com wrote: Is the haskell-mode that comes out of the box with emacs (v 23.3) the one you folk use or do you use something more specific/uptodate?  How to find out? [There should be a haskell-mode-version...] To the folks from the

Re: [Haskell-cafe] Haddock and the qualified imports

2011-12-06 Thread Evan Laforge
I've long wanted a display it like I typed it option, e.g. if I typed 'Module.function' the link would look exactly like that. I've also often wished that unimported but fully qualified modules like 'Data.List.partition' would link even if Data.List is not imported. I suppose similarly to the

Re: [Haskell-cafe] Haddock and the qualified imports

2011-12-06 Thread Evan Laforge
On Tue, Dec 6, 2011 at 11:51 AM, David Waern david.wa...@gmail.com wrote: 2011/12/6 Evan Laforge qdun...@gmail.com: I've also often wished that unimported but fully qualified modules like 'Data.List.partition' would link even if Data.List is not imported.  I suppose similarly to the way that s

[Haskell-cafe] type level strings?

2011-11-23 Thread Evan Laforge
So suppose I have a simple data type: data Thing { thing_id :: ThingId , thing_stuff :: Stuff } newtype ThingId = ThingId String Stuff is a Monoid, and Things need to be combined as well, so: instance Monoid Thing where mappend (Thing id1 stuff1) (Thing id2 stuff2) | id1 /=

Re: [Haskell-cafe] type level strings?

2011-11-23 Thread Evan Laforge
On Wed, Nov 23, 2011 at 4:03 PM, Holger Reinhardt hreinha...@gmail.com wrote: You can do this with phantom types, i.e.: data Thing a = Thing Stuff instance Monoid (Thing a) where   mappend (Thing stuff1) (Thing stuff2) = Thing (stuff1 `mappend` stuff2)   mempty = Thing mempty data ID1

Re: [Haskell-cafe] type level strings?

2011-11-23 Thread Evan Laforge
On Wed, Nov 23, 2011 at 4:25 PM, Julian Beaumont jp.beaum...@theonionknight.com wrote: On Thu, Nov 24, 2011 at 10:06 AM, Evan Laforge qdun...@gmail.com wrote: Well yes, but the key feature is that the IDs are arbitrary strings. And they're not knowable at compile time, since they are read from

Re: [Haskell-cafe] Documenting strictness properties for Data.Map.Strict

2011-11-17 Thread Evan Laforge
Any ideas for further improvements? I feel like there should be a canonical what is WHNF page on haskell.org that docs like this can link to. Namely, what it is theoretically, what that means for various examples of thunks (i.e. show how a sample graph would get reduced), and what that means

Re: [Haskell-cafe] Persistent Concurrent Data Structures

2011-11-01 Thread Evan Laforge
So I guess you're talking about imperative mutated data structures (which is btw the opposite of what persistence usually means in haskell). It seems like switching data storage would be as easy or hard as you've been able to abstract it, e.g. if you can put everything through 'get' and 'put'

Re: [Haskell-cafe] Organizing big repository

2011-10-27 Thread Evan Laforge
On Thu, Oct 27, 2011 at 10:02 AM, Konstantin Litvinenko to.darkan...@gmail.com wrote: I am trying to understand how to organize my code and edit-compile-run cycles. I can't figure out how to setup environment in such why that when I build some program using cabal, cabal will rebuild program

Re: [Haskell-cafe] Is it possible to get the information of instances of a type?

2011-10-26 Thread Evan Laforge
No, this lists all the instances of a class.  OP asked for the classes of which a given type is an instace. Presumably it is possible, since Haddock does it!  In the documentation generated for a type it lists classes of which the type is an instance.  So you might want to look at how

Re: [Haskell-cafe] Package documentation complaints -- and a suggestion

2011-10-25 Thread Evan Laforge
On Tue, Oct 25, 2011 at 2:17 AM, Ketil Malde ke...@malde.org wrote: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes: Right, but first we need to define what all those terms _mean_... and it's no good saying your package is stable if you change the API in a large-scale fashion every

Re: [Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

2011-10-19 Thread Evan Laforge
On Wed, Oct 19, 2011 at 9:49 AM, Stephen Tetley stephen.tet...@gmail.com wrote: On 19 October 2011 15:59, AM age...@themactionfaction.com wrote: Note that other programming languages have had to solve this exact problem and they usually end up with multiple functions- one for debugging, one

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-27 Thread Evan Laforge
On Mon, Sep 26, 2011 at 10:50 AM, Chris Smith cdsm...@gmail.com wrote: On Mon, 2011-09-26 at 18:53 +0200, Lennart Augustsson wrote: If you do [0.1, 0.2 .. 0.3] it should leave out 0.3.  This is floating point numbers and if you don't understand them, then don't use them. The current behaviour

Re: [Haskell-cafe] which tags program should I use?

2011-09-26 Thread Evan Laforge
suggests using :etags in GHCI or hasktags, or gasbag.  Of the three, hasktags comes closest to working but it has (for me) a major inconvenience, namely it finds both function definitions and type signatures, resulting in two TAGS entries such as: ./Main.hs,63 module Main where 6,7 main ::

Re: [Haskell-cafe] Attoparsec: Limiting Parsers to N Bytes, or Combing Parsers?

2011-09-23 Thread Evan Laforge
On Fri, Sep 23, 2011 at 8:04 PM, Michael Craig mks...@gmail.com wrote: Suppose we want to parse a 24-bit hex color value: input :: ByteString input = af093c blah blah blah type Color = (Word8, Word8, Word8) Attoparsec.Char8 exports a nice hexadecimal parser, but it consumes all available

Re: [Haskell-cafe] Attoparsec: Limiting Parsers to N Bytes, or Combing Parsers?

2011-09-23 Thread Evan Laforge
BTW you probably want 'data Color = Color !Word8 !Word8 !Word8' On Fri, Sep 23, 2011 at 8:21 PM, Evan Laforge qdun...@gmail.com wrote: On Fri, Sep 23, 2011 at 8:04 PM, Michael Craig mks...@gmail.com wrote: Suppose we want to parse a 24-bit hex color value: input :: ByteString input = af093c

Re: [Haskell-cafe] Attoparsec: Limiting Parsers to N Bytes, or Combing Parsers?

2011-09-23 Thread Evan Laforge
So the question remains: is there a way to limit a parser to a finite chunk of input? Perhaps a way to run the 'take n' parser on the input and then run another parser on its result? This smells like monadic behavior, but of course with different semantics than the Monad instance for Parser.

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-22 Thread Evan Laforge
If you can clear this up with a better explanation of the properties, great!  But if you can't, then we ought to reject the kind of thinking that would remove useful behavior when it doesn't fit some theoretical properties that looked nice until you consider the edge cases. It's not just

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-20 Thread Evan Laforge
This makes me wonder if maybe the reason this discussion is happening at all is that we don't have a well-defined meaning for what Enum *is*. At this point, it seems like the only answer is that it's I agree, that's why I suggested a separate 'range' function. I think the all values in this

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-20 Thread Evan Laforge
I actually think the brokenness of Ord for floating point values is worse in many ways, as demonstrated by the ability to insert a value into a Data.Set.Set and have other values disappear from the set as a result. Getting an unexpected element in a list doesn't really seem as bad as silently

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-20 Thread Evan Laforge
complete enumeration.  I'm taking it for granted that the current behavior on Float is useful; I honestly don't see how you could argue with that.  People use it all the time; I used it just this morning.  Of course it's useful. It was useful but not as useful as a 'range' function. I

Re: [Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-20 Thread Evan Laforge
On Tue, Sep 20, 2011 at 4:23 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Wednesday 21 September 2011, 00:38:12, Maciej Marcin Piechotka wrote: +1 for: class Eq a = Iq a where     (.) :: a - a - Bool     (.) :: a - a - Bool Regards -1 for the class name, too easy to

[Haskell-cafe] instance Enum Double considered not entirely great?

2011-09-19 Thread Evan Laforge
So I've been excising occurrences of the [n..m] syntax from my code. The reason is that I had been using [0..5] as a shorthand for [0, 1, 2, 3, 4, 5], mostly in tests. This works for integral types and it appears to work for floating point types. Then I tried switching to a fixed point format,

Re: [Haskell-cafe] pattern matching instead of prelude.head

2011-09-16 Thread Evan Laforge
On Fri, Sep 16, 2011 at 2:34 PM, Albert Y. C. Lai tre...@vex.net wrote: On 11-09-15 10:24 PM, Michael Litchard wrote: Someone commented on StackOverflow that pattern matching the first element of a list was preferable to head. This makes sense intuitively. Could someone articulate the reason

Re: [Haskell-cafe] Categorized Weaknesses from the State of Haskell 2011 Survey

2011-09-13 Thread Evan Laforge
I would appreciate is a few paragraphs in the toplevel haddock page or module that describe the general architecture and layout of the modules, as well as the typical entry points. Since the module system doesn't have a notion of private modules and it's common to re-export symbols, it can be

Re: [Haskell-cafe] Data.IArray rant

2011-09-06 Thread Evan Laforge
I am unconvinded that this is any more wrong than using a for loop in an imperative language. Remember that the lists are lazy, so it’s misleading to say “convert the array to a list” since what happens most of the time is that elements are taken out of the array and passed to the processing

[Haskell-cafe] Data.IArray rant

2011-09-02 Thread Evan Laforge
I never liked Data.IArray. Recently I had to deal with it again and it kind of touched off a bit of a rant: Array bounds are an inclusive range, which runs counter to almost all other uses of ranges, and for good reason. Length of an array is (high - low + 1). If you want to convert a list to

  1   2   3   4   >