Re: [Haskell-cafe] Ideas

2007-08-25 Thread Evan Laforge
Reaktor has a few limitations though. 1. It's virtually impossible to debug the thing! (I.e., if your synth doesn't work... good luck working out why.) 2. It lacks looping capabilities. For example, you cannot build a variable-size convolution block - only a fixed-size one. (If you want to

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Evan Laforge
Indeed, you can write certain DSP algorithms beautifully in Haskell. Now, if only it could talk to the audio hardware... (Or just use common file formats even.) Oh, that's easy. I wrote an FFI interface to portaudio a while back to write a delay-looping type utility in haskell. It was pretty

Re: [Haskell-cafe] Re: Sillyness in the standard libs.

2007-11-29 Thread Evan Laforge
Let's ignore System.Time since it's obsoleted by Data.Time. While you're updating the Data.Time docs, could you mention the above in System.Time? I recently looked at both and used System.Time because Data.Time looked too complicated. ___ Haskell-Cafe

Re: [Haskell-cafe] Re: New slogan for haskell.org

2007-11-29 Thread Evan Laforge
frees the programmer from writing superfluous type signatures is a weak (and dubious) advantage. I very often write superfluous type signatures first (to be sure I know what I'm asking my program to do) and only then let Haskell check it. Then I leave it in as good documentation. I

Re: Re[2]: [Haskell-cafe] Execution of external command

2007-12-13 Thread Evan Laforge
it seems that script may be not terminated if its output isn't read, so better code should be (_, h, g, _) - runInteractiveCommand script params result - hGetLine h hGetContents h = evaluate.length hGetContents g = evaluate.length Tangent here, but does anyone else think that something

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Evan Laforge
A newtype can only have one constructor, with one argument, and is essentially a wrapper for that argument type. In the general case, you want to use data instead of newtype: data Rectangle = R Int Int I'm sure there's a trivial explanation for this, but here's something that I've always

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Evan Laforge
I'm sure there's a trivial explanation for this, but here's something that I've always kind of wondered about: Given a single constructor type like data X = X A B C can't that be transformed into newtype X = X (A, B, C)? There must be some difference, because if there weren't we could

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-17 Thread Evan Laforge
I interpreted Evan's question as why can't you have newtypes with multiple fields? -- i.e., newtype X = X A B C -- and that's the question I was answering. But maybe I misunderstood. Well, the question was both, and strictness answers both. Thanks for the clarification. I should have

Re: [Haskell-cafe] Missing join and split

2007-12-28 Thread Evan Laforge
Would not it be interesting and useful (but not really efficient) to have patterns something like: foo :: Eq a = a - ... foo (_{4}'b') = ... which would match a list with four elements ending with an element 'b'. Or: foo (_+';'_+';'_) = ... Maybe you could use view patterns? foo (regex

Re: [Haskell-cafe] Missing join and split

2007-12-30 Thread Evan Laforge
Parser combinators basically provide generalized regexes, and they all take lists of arbitrary tokens rather than just Chars. I've written a simple combinator library before that dispenses with all the monadic goodness in favor of a group combinator and returning [Either [tok] [tok]],

Re: [Haskell-cafe] Re: generalized newtype deriving allows the definition of otherwise undefinable functions

2010-03-09 Thread Evan Laforge
The difference (in work) between map Wrapped and conv is the difference between map id and id :: [a] - [a]. In the absence of any fusion/rewrite rules, the former breaks down a list, and builds up a new one with exactly the same elements (or, every element x becomes an id x thunk, perhaps).

Re: [Haskell-cafe] Re: Haskellers hate GUIs!!

2010-04-02 Thread Evan Laforge
This may not be helpful for you, but when I did GUI stuff with haskell I wrote the GUI part in c++ with fltk, exposed a medium-level api specific to that gui, and then call that api through the FFI. This is sort of like the web browser + backend thing, except switch c++ and fltk for javascript

Re: [Haskell-cafe] Announce: hothasktags

2010-04-07 Thread Evan Laforge
On Thu, Apr 1, 2010 at 1:46 PM, Luke Palmer lrpal...@gmail.com wrote: Hi, I'd like to draw attention to a little script I wrote.  I tend to use qualified imports and short names like new and filter.  This makes hasktags pretty much useless, since it basically just guesses which one to go to.

Re: [Haskell-cafe] Announce: hothasktags

2010-04-07 Thread Evan Laforge
Ohh, and the other issue I had was that setting iskeyword causes 'w' to skip over '.'s. This causes trouble for me because I'm used to using 'w' to skip between components of the symbol and 'W' to skip it entirely. Is there a workaround you use, maybe a better way to navigate?

Re: [Haskell-cafe] GSoC Project: A Haddock + Pandoc documentation tool

2010-04-09 Thread Evan Laforge
3) Configuration I haven't looked at this yet but I suspect people will not want another configuration file in their projects. Perhaps you could propose some kind of Cabal integration instead. It would be a shame if I had to figure out how to write a cabal file for my project and replace the

Re: [Haskell-cafe] Re: Is anyone using Haddock's support for frames?

2010-05-04 Thread Evan Laforge
On Tue, May 4, 2010 at 1:23 PM, David Waern david.wa...@gmail.com wrote: 2010/5/4 Sean Leather leat...@cs.uu.nl: Somewhat OT, but is there a place where we can request/review features in the new HTML presentation of Haddock. Are there any mockups of what the pages might look like? I've had

Re: [Haskell-cafe] Re: Haskell and scripting

2010-05-07 Thread Evan Laforge
On the one hand, this is doable with the GHC API.  On the other, that more or less means your program contains what amounts to a full copy of GHC. And the result is that your binary will grow by 35mb, add a few seconds to launch time, the first expression will take 3 or 4 seconds to evaluate,

Re: [Haskell-cafe] Proposal to solve Haskell's MPTC dilemma

2010-05-20 Thread Evan Laforge
I wonder: Of cases where overload resolution via available instances would be reasonable, how many would also make sense as a closed type class? By comparison, it seems that many uses of OverlappingInstances are really just trying to express a closed type class with one or more default

Re: [Haskell-cafe] Proposal to solve Haskell's MPTC dilemma

2010-05-20 Thread Evan Laforge
Hi Evan, hasn't EHC had something like this for a while with 'type class directives'? I dunno, I don't even know what ehc is. Is it this? http://www.cs.uu.nl/wiki/Ehc/WebHome I turned up a paper that mentioned type class directives, but I haven't read it yet. In any case, the EHC page says

Re: [Haskell] Re: [Haskell-cafe] Work on Video Games in Haskell

2010-05-26 Thread Evan Laforge
So, sadly, I think your chances of shipping your a title written in Haskell on the iPhone are shot to hell. +1 for the android version. Disclaimer: biased google employee :P Unfortunately then you get another cockamamie restriction in the whole JVM vs. tail calls thing... but if you can get

Re: [Haskell-cafe] Difference between div and /

2010-06-01 Thread Evan Laforge
[1] By co I mean Ruby, Python, Perl and others. There are no so many languages that do recognize the difference. % python -Q new Python 2.4.6 (#1, Aug 3 2009, 17:05:16) [GCC 4.0.1 (Apple Inc. build 5490)] on darwin Type help, copyright, credits or license for more information. 10 / 3 #-

Re: [Haskell-cafe] Cabal -j

2010-06-03 Thread Evan Laforge
On Thu, Jun 3, 2010 at 3:05 PM, Don Stewart d...@galois.com wrote: wasserman.louis: What, if anything, stands in the way of parallelizing Cabal installs, make -j style? Parallelizing ghc --make    http://vimeo.com/6572966 Something I wondered from watching that talk, rather than trying to

Re: [Haskell-cafe] How to Show an Operation?

2010-06-07 Thread Evan Laforge
How should I work around that. I could use two different name function, but I don't like this. Would I have to define a typeclass namedFunction which all have a name function? How about a named type: data Named a = Named { val_of :: a, name_of :: String } You can put it in Functor and

Re: [Haskell-cafe] Re: How does one get off haskell?

2010-06-17 Thread Evan Laforge
So how does one get off haskell? Are there people in similar situations that have managed? How did you do it? I used to get annoyed about all the java boilerplate and awkwardness. But then I learned that if I relax and stop thinking so much about the aesthetics of what I'm writing, I can just

[Haskell-cafe] checking types with type families

2010-06-22 Thread Evan Laforge
I have a parameterized data type: data Val result = VNum Double | VThunk (SomeMonad result) type Environ result = Map Symbol (Val result) I have a class to make it easier to typecheck Vals: class Typecheck a where from_val :: Val result - Maybe a instance Typecheck Double where

Re: [Haskell-cafe] checking types with type families

2010-06-23 Thread Evan Laforge
I think your problem here is that there's no mention of `a' on the left-hand size of from_val's type signature; you either need to use MPTC+fundep to associate what result is compared to a, or else use a phantom type parameter of Val to make it data Val result a = ... and then from_val :: Val

Re: [Haskell-cafe] checking types with type families

2010-06-23 Thread Evan Laforge
I'm interested in situations where you think fundeps work and type families don't.  Reason: no one knows how to make fundeps work cleanly with local type constraints (such as GADTs). If you think you have such as case, do send me a test case. Well, from looking at the documentation, it

Re: [Haskell-cafe] Monad transformers

2010-07-03 Thread Evan Laforge
As I say, every time I've tried to do this, I end up writing a function to run this stuff, and it typically takes a few hours to reach the point where it type-checks. It took me a while the first time, but then I just learned the pattern and I do it that way every time. Here's my pattern:

Re: [Haskell-cafe] Hot-Swap with Haskell

2010-07-16 Thread Evan Laforge
On Fri, Jul 16, 2010 at 11:21 AM, Don Stewart d...@galois.com wrote: Generally, in Erlang or Haskell, the semantics we use is to keep all the old code in memory, for  the case of closures and thunks that point back into that code. You can imagine a fine-grained semantics where as each top

Re: [Haskell-cafe] Error Monad and strings

2010-07-28 Thread Evan Laforge
I've always thought that being able to write: catMaybes :: [Maybe a] - [a] catMaybes xs = [ x | Just x - xs ] is really cool, which relies on: fail _ = [] being in the Monad instance for List. Really? I thought that's just a feature of list comprehensions. List comps are not monads,

Re: [Haskell-cafe] Why do unsafe foreign calls block other threads?

2010-08-03 Thread Evan Laforge
On Tue, Aug 3, 2010 at 3:06 PM, Gregory Crosswhite gcr...@phys.washington.edu wrote: But you've got it backwards:  if the function I am calling can call back into Haskell (i.e., is marked as safe), then GHC *doesn't* block the world, but if the function I am calling will never call back into

Re: [Haskell-cafe] Why do unsafe foreign calls block other threads?

2010-08-03 Thread Evan Laforge
Just think of unsafe in relation to unsafeIndex or something. It's faster, but you have to be sure the index is in bounds. Yes, but the whole reason to use unsafe is to get higher performance at the cost of safety.  If the result of calling an unsafe foreign function is that you *lose*

Re: [Haskell-cafe] Preview the new haddock look and take a short survey

2010-08-04 Thread Evan Laforge
This is something I've wanted for a long time, but I always intended to just submit a patch since it would be trivial, but maybe other people have an opinion about it too: I've always wanted a button to collapse or maybe toggle all expanded branches. Once a library gets large, it's easier to

Re: [Haskell-cafe] Re: Why is there no splitBy in the list module?

2006-07-11 Thread Evan Laforge
splitBy :: (a - Bool) -- ^ whether element is a seperator - [a] -- ^ list to split - [[a]] P.S. inspecting more than one element looks like an over-generalization to me and should be left to parsers or regexp libs. It's more generally useful if you don't drop the separators

Re: [Haskell-cafe] Re: Why is there no splitBy in the list module?

2006-07-12 Thread Evan Laforge
2006/7/12, [EMAIL PROTECTED] [EMAIL PROTECTED]: Jared Updike wrote: split is... unconcatIntersperse. How about separate? (split or splitBy is better but it is used all over the place in many libs) And for strings I definitely would use split :: [a] - [a] - [[a]] a lot, just like

Re: [Haskell-cafe] FFI basics

2007-02-21 Thread Evan Laforge
On 2/19/07, Yitzchak Gale [EMAIL PROTECTED] wrote: Simon Peyton-Jones wrote: Yitz, Please do make time to do this! This is the moment, while it is still fresh in your mind. Of course, you are correct. Thanks for the push. I am a bit busy with work, but the information is not lost. I'll have

Re: [Haskell-cafe] FFI basics

2007-02-26 Thread Evan Laforge
... and now I have more questions. Maybe it would be better if I just asked them on the mailing list, and then incorporated the answers into the wiki myself. Question #1 is compiling FFI using modules. I'd like to use ghc --make for the speed and convenience, but obviously it doesn't know how

Re: [Haskell-cafe] Why functional programming matters

2008-01-24 Thread Evan Laforge
This takes an iterator over some collection of Foos and finds the one with the highest value of updateTime. 9 lines of code, or 12 with the closing curly brackets. In Haskell this is so short and obvious you probably wouldn't bother declaring it as a function, but if you did, here it is:

Re: [Haskell-cafe] Why functional programming matters

2008-01-24 Thread Evan Laforge
A real time incremental gc would be really cool. Some people claim they exist, but which languages have one? Define real time. I'll note that, after all the mud that's been slung at Java, you've been able to get low-pause-time parallel GC in Java for years and years, and can get real

Re: [Haskell-cafe] Simple network client

2008-01-30 Thread Evan Laforge
PS: I would love to see an immutable filesystem that does not allow writing to files, it only creates new files and garbage collects files that have no incoming reference anymore... Just like a garbage collected heap, and a bit like an OLAP databases (as far as I remember my DB theory...)

Re: Re[2]: [Haskell-cafe] C++ interface with Haskell

2008-04-18 Thread Evan Laforge
To threadjack a little bit, I've been interfacing haskell with c++. It gets awkward when the c++ structures use STL types like string and vector. Of course those are too complex for haskell to marshal to. What I've been doing is defining an XMarshal variant of the X c++ class, that uses plain c

Re: [Haskell-cafe] C++ interface with Haskell

2008-04-19 Thread Evan Laforge
you mean, you hack around with the internal representation of those structures? Well, if you want to avoid double-copying, C++ can't access Haskell sequences, and Haskell can't access C++ sequences, I guess I don't see an alternative. I don't really mind double copying, but having to

[Haskell-cafe] functional update

2008-04-21 Thread Evan Laforge
Here's some haskell to update a particular field in a data structure (the below run in a StateT / ErrorT context): set_track_width :: (UiStateMonad m) = Block.ViewId - Int - Block.Width - m () set_track_width view_id tracknum width = do view - get_view view_id track_views -

Re: [Haskell-cafe] Storable class?

2008-04-22 Thread Evan Laforge
This uses hsc2hs. As far as I can tell, alignment is unused. I've never had an error from using 'undefined' there. #include c_interface.h instance Storable Color where sizeOf _ = #size Color alignment _ = undefined peek = peek_color poke = poke_color peek_color colorp =

Re: [Haskell-cafe] Storable class?

2008-04-22 Thread Evan Laforge
On Tue, Apr 22, 2008 at 9:29 PM, Evan Laforge [EMAIL PROTECTED] wrote: This uses hsc2hs. As far as I can tell, alignment is unused. I've never had an error from using 'undefined' there. Some architectures require all sorts of wacky alignments. E.g. floats may need to be 4 byte aligned

Re: [Haskell-cafe] announce: Glome.hs-0.3 (Haskell raytracer)

2008-04-24 Thread Evan Laforge
I've ended up writing something more like POV-Ray than OpenRT, and that's fine with me. I'd rather have something that's slower but more expressive than fast but inflexible. (The former is also perhaps more easily attainable, particularly in Haskell.) Not knowing anything about raytracing,

Re: [Haskell-cafe] functional update

2008-04-25 Thread Evan Laforge
Thanks everyone, this is all good stuff. I did look at Clean and it looks like it has somewhat nicer record syntax... but it doesn't look like anything haskell couldn't do better if it one day got a real record system. As for the rest of Clean, I'm afraid that spending too much time with it will

Re: [Haskell-cafe] elementary Maybe Monad problem .. sigh

2008-05-01 Thread Evan Laforge
2008/5/1 Galchin, Vasili [EMAIL PROTECTED]: Here is a simpler case of what I want to do .. 1) To function1 pass in (Maybe Int). 2) If Nothing then pass nullPtr to C function. 3) If Just 1, then pass a pointer to a 1 to teh same C function. Check out Foreign.maybeWith.

Re: [Haskell-cafe] sound synthesis

2008-05-02 Thread Evan Laforge
I remember an article ranting about how lazy evaluation would be great to do signal processing, but it was lacking real world example. The nyquist language does this. It's not haskell, but it does use lazy evaluation for signals. ___ Haskell-Cafe

Re: [Haskell-cafe] Write Haskell as fast as C. [Was: Re: GHC predictability]

2008-05-15 Thread Evan Laforge
Side point: Is the name go part of the idiom you mentioned? I sometimes use the same practise but usually just calls the worker the same as the real function with an added prime ('). I like to use go or the name of the function with _ prepended. For threading state type things outside of a

[Haskell-cafe] status of dynamic loading

2008-05-20 Thread Evan Laforge
I have an application where I'd like to load and run code at runtime. As far as I know, the possibilities are: Use hs-plugins. I'm not sure if this still works on modern ghc, or if it works on my platform (darwin intel), but I managed to get this compiled after fixing a use of STArray whose

Re: [Haskell-cafe] status of dynamic loading

2008-05-20 Thread Evan Laforge
Great stuff everyone, thanks so much. I did indeed manage to download an old hs-plugins, and the new one seems to work fine. I'll definitely check out hint and metaplug, and for most of the stuff that doesn't need to be easily changeable at runtime I can do the xmonad thing. On the down side,

[Haskell-cafe] ambiguous constraint errors

2008-05-28 Thread Evan Laforge
I have two related questions: #1 I'm getting some annoying type errors that I don't fully understand, and wind up having to do a workaround that I don't totally like. Here's a simplified version of my situation: data Ambi m = Ambi { ambi_monad :: m Int , ambi_int :: Int } some_ambi

Re: [Haskell-cafe] ambiguous constraint errors

2008-05-29 Thread Evan Laforge
get_int sym = fmap ambi_int (lookup sym ambi_table :: Maybe (Ambi Maybe)) Of you and the type system you're the only one who knows that that value is not used. The type system doesn't use (all) the rules you have in your mind. It follows more simple ones. You judge by values, not only types

[Haskell-cafe] hint / ghc api and reloading modules

2008-05-31 Thread Evan Laforge
I'm using hint, but since it's basically a thin wrapper around the GHC API, this is probably a GHC api question too. Maybe this should go to cvs-ghc? Let me know and I'll go subscribe over there. It's my impression from the documentation that I should be able to load a module interpreted, make

Re: [Haskell-cafe] How would you hack it?

2008-06-04 Thread Evan Laforge
On Wed, Jun 4, 2008 at 3:23 PM, Lanny Ripple [EMAIL PROTECTED] wrote: You might want to skim Shannon's 'A Mathematical Theory of Communcations'. Part 1, Section 2 and 3 are almost exactly your topic. (Or at least the direction you've headed in. :)

Re: [Haskell-cafe] appending an element to a list

2008-06-11 Thread Evan Laforge
Lets look at the actual reductions going on. To make the example easier, I would like to use last instead of your complicated until. It shouldn't make a difference. [ winds up doing twice as much work ] This was also my intuition. I had a function that built up a large output list by

Re: [Haskell-cafe] Documenting the impossible

2008-06-15 Thread Evan Laforge
Hmm, this gives me a new idea for a feature request - how about a function that evaluates to the source code line number it was called from? ;-) Well, that wouldn't be a function, but one of the other -hcs (j? n?) has srcloc_annotate which is a macro that does that. It would be nice if ghc had

[Haskell-cafe] 1/0

2008-06-16 Thread Evan Laforge
So, I know this has been discussed before, but: 1/0 Infinity 0/0 NaN ... so I see from the archives that Infinity is mandated by ieee754 even though my intuition says both should be NaN. Every other language throws an exception, even C will crash the program, so I'm guessing it's telling the

Re: [Haskell-cafe] 1/0

2008-06-16 Thread Evan Laforge
No, The issue is that '/' is always floating point division in haskell, for integer division, use `div`. 1 `div` 0 throws an exception like you expect. GHC behaves exactly the same as C here. But in C whether '/' means floating point or integral division depends on the types of its

Re: [Haskell-cafe] 1/0

2008-06-16 Thread Evan Laforge
... so I see from the archives that Infinity is mandated by ieee754 even though my intuition says both should be NaN. Other people have other intuitions. It may be that your intuition is telling you that neither result should be an ordinary number, and if that's what it's really telling

Re: [Haskell-cafe] Lambda and closures in PHP -- could someone please comment?

2008-06-18 Thread Evan Laforge
* A closure must only keep alive the varables it references, not the whole pad on which they are allocated (Python messed up here) Getting off subject, but I didn't know this about python. I'm not saying you're incorrect, but my experimentation shows: % cat t.py class A(object): def

Re: [Haskell-cafe] Re: Bit Streams

2008-06-18 Thread Evan Laforge
On Wed, Jun 18, 2008 at 10:43 AM, Andrew Coppin [EMAIL PROTECTED] wrote: Dominic Steinitz wrote: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict Ooo... looks interesting. Pity I can't look at any documentation for it. (Is that *really* Haddoc failing with a parse

Re: [Haskell-cafe] Meaning of ribbonsPerLine at Text.PrettyPrint.HughesPJ ?

2008-06-18 Thread Evan Laforge
byorgey: fons: I can't explain it, all I know is that you must set it to 1 or else it does bizarre things fons: hahah, ok fons: byorgey: that's funny considering its default value is 1.5 byorgey: if you set it to 1 then lineLength means what you think it should byorgey: fons: EXACTLY

Re: [Haskell-cafe] Re: Call Graph Tool?

2008-06-27 Thread Evan Laforge
Assuming I get it included, is there any features in particular you'd want to see in there? Note that if I do have it produce visualisations, they'll be static images as part of an analysis report rather than being interactive. I was just recently wondering about something like this. I'd

Re: [Haskell-cafe] ghci vi mode?

2008-06-27 Thread Evan Laforge
On Fri, Jun 27, 2008 at 12:04 PM, Adam Smyczek [EMAIL PROTECTED] wrote: If I remember correctly, ghci uses readline framework on Linux/OS X. Is it possible to change ghci editing mode to vi? Here's what I have: % cat ~/.inputrc set editing-mode vi set keymap vi set bell-style none

[Haskell-cafe] nested parsing?

2008-07-04 Thread Evan Laforge
Here's something I occasionally want to do with parsec: msg = do header body - manyTill anyToken footer vals - sub_parse parse_body (preprocess body) ... By coincidence I notice that perhaps the manyTill stack overflow thread could use something like this too. So I wrote:

Re: [Haskell-cafe] Is there a nicer way to do this?

2008-07-06 Thread Evan Laforge
On Sun, Jul 6, 2008 at 5:25 PM, John Hamilton [EMAIL PROTECTED] wrote: On Sun, Jul 6, 2008 at 16:45, Michael Feathers [EMAIL PROTECTED] wrote: segment :: Int - [a] - [[a]] segment 0 _ = [] segment _ [] = [] segment n x = (take n x) : segment n (drop n x) I did a version of this which

[Haskell-cafe] not for me, guv!

2008-07-06 Thread Evan Laforge
So I wrote a big email about this mysterious message I was getting, but then after some research and poking and debugging tracked it down to a dangling pointer in C that was causing a callback to point to an invalid address, which somehow worked anyway 99% of the time. That all said, I'm not

Re: [Haskell-cafe] Human-friendly compiler errors for GHC

2008-07-12 Thread Evan Laforge
What do you think about this feature? Would it be genuinely helpful or annoying? It could be handy if it understands qualified names. Occasionally typos e.g. just now Confg.default_x are surprisingly hard to see and I go around making sure Config is imported, making sure it exports default_x,

Re: [Haskell-cafe] uvector and the stream interface

2008-07-17 Thread Evan Laforge
An abstraction stack: Impure Pure How about strict vs. lazy? I ask because I assumed there were lazy variants of uvector or storablevector, using the bytestring list of chunks approach, but apparently not? Making a lazy version seems pretty easy, but rewriting all the basic

Re: [Haskell-cafe] How to use bracket properly ?

2009-10-19 Thread Evan Laforge
On Sun, Oct 18, 2009 at 11:50 PM, zaxis z_a...@163.com wrote: The original code is: winSSQ count noRed noBlue = do    let yesRed =  [1..33] \\ noRed    let yesBlue = [1..16] \\ noBlue    bracket (openFile ssqNum.txt WriteMode) (hClose) (\hd1 - pickSSQ count yesRed yesBlue hd1) It works

Re: [Haskell-cafe] Is there a null statement that does nothing?

2009-10-27 Thread Evan Laforge
On Tue, Oct 27, 2009 at 10:08 AM, Kim-Ee Yeoh a.biurvo...@asuhan.com wrote: Hi Brent, Re: 'if expressions, not statements' is an elegant clarification, one definitely for the haskellwiki, if not there already. Just for completeness' sake, bottom is a value for any expression. Wouldn't

Re: [Haskell-cafe] How to convert records into Haskell structure in Haskell way?

2009-11-02 Thread Evan Laforge
On Mon, Nov 2, 2009 at 5:29 PM, Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote: Hi,  Say I have something like this: [ Record { item = A1, value = 0 } , Record { item = B1, value = 13 } , Record { item = A2, value = 2 } , Record { item = B2, value = 10 } ]  How to convert it

Re: [Haskell-cafe] What's the deal with Clean?

2009-11-03 Thread Evan Laforge
So what's the deal with Clean? Why is it preferable to Haskell? Why is it not? Purely from glancing through the language reference, two things that it looks like clean has that I would love to have in haskell are better records and better arrays. The records don't implement any of the fancy

Re: [Haskell-cafe] What's the deal with Clean?

2009-11-05 Thread Evan Laforge
And this is confusing to those of us who are not compiler experts. Haskell knows when I have a list of Doubles, you know, because it's strongly typed. Then it proceeds to box them. Huh ? The laziness thing has many example od _reducing_ efficiency, but there seems to be a real lack of

Re: [Haskell-cafe] faster compiling for ghc

2009-11-12 Thread Evan Laforge
On Wed, Nov 11, 2009 at 11:22 PM, David Virebayre dav.vire+hask...@gmail.com wrote: On Thu, Nov 12, 2009 at 7:18 AM, Bulat Ziganshin bulat.zigans...@gmail.com wrote: Hello Evan, Thursday, November 12, 2009, 4:02:17 AM, you wrote: Recently the go language was announced at golang.org.  

Re: [Haskell-cafe] faster compiling for ghc

2009-11-12 Thread Evan Laforge
on windows use GNU ld? Improving GNU ld would be a huge win in a lot of places, and the fact that no one has done it (excepting gold of course) goes to show it's a lot easier said than done! On Thu, Nov 12, 2009 at 4:58 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On Nov 12, 2009, at 2:02 PM, Evan

Re: [Haskell-cafe] Status of TypeDirectedNameResolution proposal?

2009-11-18 Thread Evan Laforge
The proposal has this sentence, apparently in reference to using qualified imports: This is sufficient, but it is just sufficiently inconvenient that people don't use it much. Does this mean qualified imports? I use them exclusively, and I'd love it if everyone else used them too. Anyway, a

[Haskell-cafe] lazy logging (was: Are there standard idioms for lazy, pure error handling?)

2009-12-01 Thread Evan Laforge
This is only peripherally related, but I also have a lot of list functions that can possibly be an error, but usually processing can continue. So they tend to return [Either Error Result]. I have another function thus: -- A foldr version is not lazy enough and overflows the stack.

Re: [Haskell-cafe] GHC magic optimization ?

2009-12-03 Thread Evan Laforge
I will take an example: f x y= x+y The program ask the user to enter two numbers and print the sum. If the user enter 1 2 f 1 2=3 is stored and a gargage collector is used to remove this dandling expression later ? If the user enter again 1 2, ghc search in dandling results to try to find

Re: [Haskell-cafe] Is Haskell a Fanatic?

2009-12-03 Thread Evan Laforge
I'd just like to point out or reiterate the odd rise in trolling and the recent announcements of haskell-2010... Just wait until haskell-2012 is announced with nonexistential aka eschatological types spelled notany a. World. It evaluates to a new form of bottom that blackholes the entire

Re: [Haskell-cafe] Re: Optimizing Parsec 3 -- was: Wiki software?

2009-12-04 Thread Evan Laforge
On Fri, Dec 4, 2009 at 1:09 PM, John MacFarlane j...@berkeley.edu wrote: On Mon, Nov 23, 2009 at 12:29 PM, Antoine Latter aslat...@gmail.com wrote: I finally had some time to test it.  After running it multiple times (of course, it would be nice to use criterion here), I'm getting numbers in

Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-09 Thread Evan Laforge
On Wed, Dec 9, 2009 at 3:26 PM, John D. Earle johndea...@cox.net wrote: The problem that I see with elision resulting in juxtaposition is that it would alter the layout. Each line would not have the same number of characters before and after the makeover. Visual appearance would also be

Re: [Haskell-cafe] fun with 6.12

2009-12-14 Thread Evan Laforge
I noticed noise on the cabal list about updating for 6.12, and that it was nontrivial. Also, haddock won't compile with 6.12, and I couldn't find anything about a new release. If someone else doesn't get there first, I'll add them to the wiki tonight.

Re: [Haskell-cafe] fun with 6.12

2009-12-14 Thread Evan Laforge
Ohh, it's for *patches*, not just warnings. Never mind then... On Mon, Dec 14, 2009 at 4:08 PM, Evan Laforge qdun...@gmail.com wrote: I noticed noise on the cabal list about updating for 6.12, and that it was nontrivial. Also, haddock won't compile with 6.12, and I couldn't find anything

[Haskell-cafe] Yay 6.12.1!

2009-12-15 Thread Evan Laforge
So far, this new release has let me remove: - The new Import of xyz is redundant warning pointed out tons of cruft in my imports: 117 of them! Apparently it's better than the 6.10 algorithm. It's amazing how much cruft builds up in import lists over time even with -Wall. One issue is that I

Re: [Haskell-cafe] Re: Optimizing Parsec 3 -- was: Wiki software?

2009-12-15 Thread Evan Laforge
So my biggest reservation is if I can even call my branch the same parser as Parsec. Maybe we could go the way regexes: say parsec is an API, and allow multiple backends with different characteristics as long as they basically implement that API. In practice, a lot of parser combinator

Re: [Haskell-cafe] naming naming conventions (was: Re: Allowing hyphens in identifiers)

2009-12-18 Thread Evan Laforge
I used to refer to them as dromedaryCase and BactrianCase, but the names never caught on :( ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] lazily-loaded structures

2010-01-01 Thread Evan Laforge
My question is this: how do I change my program to make StringMap a lazily-loaded structure based on getStringMapValue without changing f? You can't, because 'f' has a pure signature, but you want it to run network operations, which are not pure. You could say it's logically pure if you

Re: [Haskell-cafe] lazily-loaded structures

2010-01-01 Thread Evan Laforge
What do you mean by completely abort? Couldn't it simply raise an exception that could be handled in main? Yeah, that's what I meant by complete abort. You don't get to save the work you did get done. You could checkpoint progress, but of course that's an impure operation.

[Haskell-cafe] wildcards for type variables?

2010-01-12 Thread Evan Laforge
Occasionally I have a function with an unused argument, whose type I don't want to restrict. Thus: f :: _unused - A - B f _ a = b Since it's a little unusual, I try to make it clear that the type is intentionally ignored. But it makes me wonder, would it make sense to allow _ as a type

Re: [Haskell-cafe] wildcards for type variables?

2010-01-13 Thread Evan Laforge
Isn't that what we have here? a function of type (a - A - B) cannot use the first argument in any meaningful way. I think, he wants to document that the type variable 'a' is not used in the *type*. Yeah, that's the idea, sorry if I wasn't clear. In the case of const, I might write const ::

Re: [Haskell-cafe] Name overloading

2010-01-13 Thread Evan Laforge
Now, in Haskell we have type inference, which is The Good Thing as it allows to validate your program at compile time. Hence, the idea coming up to my mind is that type inference actually forbids a type-directed resolution of names as in C++ or Java. Is this correct? There is a proposed

Re: [Haskell-cafe] Language simplicity

2010-01-14 Thread Evan Laforge
Wow, that's kind of cute: {-# LANGUAGE UnicodeSyntax #-} (*) = (*) (/) = (/) 公式 高 中 低=高*中*低/整數 整數 = 123 Oddly, if I change the order of these definitions I get syntax errors. Very mysterious. Nice how it knows that * is a symbol, but I'm not sure how I'm supposed to name a type. It certainly

Re: [Haskell-cafe] Language simplicity

2010-01-14 Thread Evan Laforge
Unicode identifiers are fun but this is a good point.  The line has to be somewhere, so it might as well be in the historical position unless there are widely agreed on benefits to moving it. I have already crossed that line: Ha, well haskell programmers wouldn't be haskell programmers if

Re: [Haskell-cafe] wildcards for type variables?

2010-01-14 Thread Evan Laforge
On Thu, Jan 14, 2010 at 5:19 AM, Ozgur Akgun ozgurak...@gmail.com wrote: Can someone give an example of a reasonable function that never uses one of its parameters, and justify the existence of that parameter in this case, please? As I mentioned, this is not only about parameters, but about

Re: [Haskell-cafe] Parse error

2010-01-18 Thread Evan Laforge
It's an improvement. It's still not pretty, but I guess that's as good as it's going to get... Maybe this is an instance of Haskell trying to tell me if you need to write a 20-line do-block in the middle of your function, you're doing it wrong. 20 lines is a lot, but I have smaller ones all

Re: [Haskell-cafe] Re: How many Haskell Engineer I/II/IIIs are there?

2010-02-11 Thread Evan Laforge
On Thu, Feb 11, 2010 at 1:49 PM, John Van Enk vane...@gmail.com wrote: Perhaps just defining the interface and demonstrating that different RTS's are swappable would be enough? I read a paper by (I think) a Simon, in which he described a haskell RTS. It would make it easier to experiment with

Re: [Haskell-cafe] What is the meaning of tilde (~) symbol

2010-02-14 Thread Evan Laforge
Finally, it is the array subscript operator: let x = arr ! 10 Shouldn't this be let x = arr !! 10 !! is the list subscript. Look in Data.Array.IArray for (!). Or Data.Map. There's still no consensus on typeclasses for collections, so these are all separate functions. Has anyone taken a

  1   2   3   4   >