Re: [Haskell-cafe] google-like "do you mean?" feature

2009-04-15 Thread Robin Green
On Wed, 15 Apr 2009 23:31:50 -0700 Michael Mossey wrote: > I was thinking that it might be useful to have a Google-like "do you > mean this?" feature. If the field name is //customer=, then the > parser might recognize a huge list of variants > like //ustomer=, //customor=, etc... You could redu

Re: [Haskell-cafe] google-like "do you mean?" feature

2009-04-15 Thread Andy Smith
2009/4/16 Michael Mossey : > I was thinking that it might be useful to have a Google-like "do you mean > this?" feature. If the field name is //customer=, then the parser might > recognize a huge list of variants like //ustomer=, //customor=, etc... that > is, recognize them well enough to continue

[Haskell-cafe] google-like "do you mean?" feature

2009-04-15 Thread Michael Mossey
I'm thinking of writing a parser to load files that my customers have created. I'm a software requirements engineer; the data consists of the customers' thoughts in response to the latest release of the requirements doc. In fact, the files will probably be copies of the requirements doc itself,

[Haskell-cafe] Issues with running Ghci from emacs

2009-04-15 Thread Daryoush Mehrtash
I am having problem running GHCI with Haskell files that include imports. I am running emacs22 on Ubuntu, with haskell-mode-2.4 extensions. I load my file (Fal.lhs in this case) in emacs. Then try to run the Ghci by doing C-c C-l. The result is shown below. Ghci fails to find the Draw.lhs

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Matt Morrow
And i forgot to include the defs of (co)prod: coprod (<>) i1 i2 = (\a b -> i1 a <> i2 b) prod (><) p1 p2 = (\a -> p1 a >< p2 a) diag = foldr (curry (prod mappend fst snd . uncurry (coprod mappend (spli

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Matt Morrow
*..against Monoid's method names. On Wed, Apr 15, 2009 at 9:59 PM, Matt Morrow wrote: > ... against the Monoid method's names. > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Matt Morrow
I think this has the semantics you're looking for. (it would probably be somewhat prettier if "mappend" wasn't such an ugly identifier (compared to, say, (++)), but this is just me trying to sneak a shot in against the Monoid method's names ;) ghci> let diag = foldr (curry (prod mappend fst snd .

Re: [Haskell-cafe] Enum to String, and back?

2009-04-15 Thread michael rice
Thanks guys. It works like a charm. Michael --- On Wed, 4/15/09, Rahul Kapoor wrote: From: Rahul Kapoor Subject: Re: [Haskell-cafe] Enum to String, and back? To: Cc: haskell-cafe@haskell.org Date: Wednesday, April 15, 2009, 3:20 PM On Wed, Apr 15, 2009 at 3:13 PM, michael rice wrote: > Usin

Re: [Haskell-cafe] Data.ByteString woes

2009-04-15 Thread Jason Dusek
Could you pastebin something that demoes the error? -- Jason Dusek ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Brackets and Asynchronous Exceptions

2009-04-15 Thread Andrew Gallagher
Great. Thanks! This is exactly what I was looking for. Apparently this issue is also described in the paper Asynchronous Exception in Haskell. Thanks, Andrew On Wed, 15 Apr 2009, Jason Dagit wrote: On Wed, Apr 15, 2009 at 4:06 PM, Andrew Gallagher wrote: Hi, In a program I am writing, I

[Haskell-cafe] Re: ANN: Elerea, another FRP library

2009-04-15 Thread Achim Schneider
Peter Verswyvelen wrote: > The reason why I'm talking about examples and not semantics is > because the latter seems to be pretty hard to get right for FRP? > There's a difference between those two? I've heard much, but never anyone complaining about specifications overlapping in a compatible way

Re: [Haskell-cafe] Brackets and Asynchronous Exceptions

2009-04-15 Thread Jason Dagit
On Wed, Apr 15, 2009 at 4:06 PM, Andrew Gallagher wrote: > Hi, > > In a program I am writing, I have many locations where I acquire a resource, > perform an operation with it, then release it.  I have been using the > 'bracket' function so that the "release" operation would be performed even > if

[Haskell-cafe] Brackets and Asynchronous Exceptions

2009-04-15 Thread Andrew Gallagher
Hi, In a program I am writing, I have many locations where I acquire a resource, perform an operation with it, then release it. I have been using the 'bracket' function so that the "release" operation would be performed even if the operation threw an exception. This seems to work nicely.

[Haskell-cafe] Mondrian and Haskell

2009-04-15 Thread Vasili I. Galchin
Hello, Several days ago I posted a question about retargeting GHC to generate CIL so that Haskell could be a .NET language. One objection was Haskell "lazy" nature didn't fit well with .NET's CLR. I found a couple publications http://www.ddj.com/windows/184404967;jsessionid=0AVCEATVAEG

Re: [Haskell-cafe] ANN: Elerea, another FRP library

2009-04-15 Thread Peter Verswyvelen
I think it would be nice if we could make a "reactive benchmark" or something: some tiny examples that capture the essence of reactive systems, and a way to compare each solution's pros and cons. For example the "plugging a space leak with an arrow" papers reduces the recursive signal problem to e

Re: [Haskell-cafe] Enum to String, and back?

2009-04-15 Thread Rahul Kapoor
On Wed, Apr 15, 2009 at 3:13 PM, michael rice wrote: > Using Show it is possible to establish a relationship between an enum type > and a String type to display it. > Can one as easily establish a reverse relationship, i.e., convert a String > type like "Red" back to its corresponding Color type?

Re: [Haskell-cafe] Enum to String, and back?

2009-04-15 Thread Martijn van Steenbergen
Hi Michael, michael rice wrote: Can one as easily establish a reverse relationship, i.e., convert a String type like "Red" back to its corresponding Color type? So that "Red" :: [Char] -> Red :: Color Yes, simply add Read to your list of to be derived type classes. Then you can say: > re

[Haskell-cafe] Enum to String, and back?

2009-04-15 Thread michael rice
Hi, Using Show it is possible to establish a relationship between an enum type data Color     = Red     | Blue     | Green     | Yellow     | Orange     | Brown     | White     | Black     deriving (Show, Eq, Enum, Bounded) and a String type to display it. *Main> Red Red *Main> [Red,Green,Blue]

Re: [Haskell-cafe] types and braces

2009-04-15 Thread Conor McBride
Hi Niklas Good to hear from you, and thanks for providing such a useful starting point for my experiments. On 15 Apr 2009, at 19:27, Niklas Broberg wrote: Hi Conor, Conor McBride: The trouble is, the production I've added causes a reduce/reduce conflict in the grammar, but I don't get any mo

Re: [Haskell-cafe] types and braces

2009-04-15 Thread Niklas Broberg
Hi Conor, Conor McBride: > The trouble is, the production I've added causes a > reduce/reduce conflict in the grammar, but I don't get > any more precise complaint than that. To get more precise complaints, you should give the -i flag to happy, that will cause happy to print the whole parser tabl

Re: [Haskell-cafe] ANN: Elerea, another FRP library

2009-04-15 Thread Claus Reinke
but the fact that the breakout example works is an indication that at least it's not hopelessly broken. Well, a breakout game does *not* work (yet) in most other FRP implementations except Yampa, which do have firm theoretical foundations :-) While certainly more entertaining, the problem looks

Re: [Haskell-cafe] Re: Maybe off-topic -- Writing contracts or software specifications

2009-04-15 Thread Peter Verswyvelen
There's one sentence I remember from some Extreme Programming books I read: "the customer only knows what he wants when he gets it" :-) On Tue, Apr 14, 2009 at 11:27 AM, Achim Schneider wrote: > "Richard O'Keefe" wrote: > > > If you have a low level of trust, you'll need a great level of > >

RE: [Haskell-cafe] Strange type error with associated type synonyms

2009-04-15 Thread Simon Peyton-Jones
| But the core part of my suggestion (which this example was meant | to help explain) remains attractive, at least to me: somewhere during | type inference, GHC *does* unify the *apparently free* 'd' with an | internal type variable (lets call it 'd1, as in the type error message) You are specula

[Haskell-cafe] Fast mutable arrays of ByteString?

2009-04-15 Thread Maxime Henrion
Hello all, I have been rewriting a small utility program of mine from C to Haskell for fun. This tool reads lines from stdin or from files, shuffles them one or more times using the Fisher-Yates algorithm, and outputs the result to stdout. Since this algorithm is based on in-place updat

Re: [Haskell-cafe] Looking for the fastest Haskell primes algorithm

2009-04-15 Thread Adrian Neumann
I've just uploaded a package with some functions I had lying around. > http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Numbers Am 14.04.2009 um 14:40 schrieb Niemeijer, R.A.: Today I happened to need a large list of prime numbers. Obviously this is a well-known problem, so I figur

[Haskell-cafe] ANN: level-monad-0.3

2009-04-15 Thread Sebastian Fischer
I am pleased to announce version 0.3 of the package level-monad. This package implements breadth-first search directly as an instance of MonadPlus (without using an intermediate tree representation). In version 0.3 I have added a MonadPlus instance for iterative deepening inspired by Michae

Re: [Haskell-cafe] cabal install vs. profiling

2009-04-15 Thread Gwern Branwen
On Wed, Apr 15, 2009 at 11:21 AM, David F. Place wrote: Hi, Suppose I have installed a number of libraries and have written a program using them.  Now, I want to profile my program.  What is the best way to get the profiling versions of the libraries installed? Thanks, David I'd chuck 'libra

[Haskell-cafe] cabal install vs. profiling

2009-04-15 Thread David F. Place
Hi, Suppose I have installed a number of libraries and have written a program using them. Now, I want to profile my program. What is the best way to get the profiling versions of the libraries installed? Thanks, David ___ Haskell-Cafe mailing list Ha

Re: [Haskell-cafe] types and braces

2009-04-15 Thread Conor McBride
On 15 Apr 2009, at 16:01, Lennart Augustsson wrote: I'd suggest using some different kind of brackets to relieve the misery, like {| |}. That would speed up my tinkering, certainly. I did have a d'oh moment: you can write data Foo = Moo {goo :: Int} -- braces where a type goes and indee

Re: [Haskell-cafe] types and braces

2009-04-15 Thread Lennart Augustsson
I'd suggest using some different kind of brackets to relieve the misery, like {| |}. On Wed, Apr 15, 2009 at 4:10 PM, Conor McBride wrote: > Hi folks > > In search of displacement activity, I'm trying to tweak > Language.Haskell.Exts to support a few more perfidious > Exts I have in mind -- they

[Haskell-cafe] Re: [ANNOUNCE] hgettext 0.1.10 - last major release

2009-04-15 Thread Florent Becker
Vasyl Pasternak writes: > Hello, > > I've uploaded last (and latest) significant version on hgettext > module. Currently it works fine, and has bindings to all gettext > functions (from libintl.h). Next versions will be only bug fixes of > this version. > I don't see any strong reasons to write

[Haskell-cafe] types and braces

2009-04-15 Thread Conor McBride
Hi folks In search of displacement activity, I'm trying to tweak Language.Haskell.Exts to support a few more perfidious Exts I have in mind -- they only need a preprocessor, but I do need to work on parsed programs, ideally. I was hoping to add a production to the grammar of types to admit expre

Re[2]: [Haskell-cafe] GHC including System.Time but not Data.Time?

2009-04-15 Thread Bulat Ziganshin
Hello John, Wednesday, April 15, 2009, 5:35:00 PM, you wrote: > I agree. Is there any chance of 6.10.3 reverting the change? both 6.6 and 6.8 had last releases at spring, so i don't expect new 6.10.* at all -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re: [Haskell-cafe] GHC including System.Time but not Data.Time?

2009-04-15 Thread John Goerzen
Lennart Augustsson wrote: > Removing a package in a minor release is, to quote, an epic fail. > I don't understand how that could be done. I agree. Is there any chance of 6.10.3 reverting the change? -- John > > -- Lennart > > On Tue, Apr 14, 2009 at 6:56 PM, Bulat Ziganshin > wrote: >> He

Re: [Haskell-cafe] ANN: Elerea, another FRP library

2009-04-15 Thread Peter Verswyvelen
Well, a breakout game does *not* work (yet) in most other FRP implementations except Yampa, which do have firm theoretical foundations :-) 2009/4/15 Patai Gergely > > I don't think using dirty tricks to implement FRP deserves > > flak, at all, from my POV, it sounds like complaining that the > >

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Jan Christiansen
Hi, On 15.04.2009, at 13:28, Sebastian Fischer wrote: Actually, there are a number of implementations that implement the same behaviour as the original version, e.g., diag = concat . foldr diags [] where diags [] ys = ys diags (x:xs) ys = [x] :

Re: [Haskell-cafe] Non-atomic "atoms" for type-level programming

2009-04-15 Thread Claus Reinke
- if type-level tags (such as 'data TTrue'/'data TFalse') are declared repeatedly in separate modules, they represent separate types, preventing shared use (your type-level predicate doesn't return my version of 'TTrue'/'TFalse') How is the need for a common import for 'data TTrue; data

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Sebastian Fischer
diag [[1,2,3],[4],[5,6,7]] What it should be? *Main> diag [[1,2,3],[4],[5,6,7]] [1,2,4,3,5,6,7] it's basically just "skipping holes": 1 2 3 4 5 6 7 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell-cafe] Ambiguous reified dictionaries

2009-04-15 Thread Jules Bean
Simon Peyton-Jones wrote: > Yes, Haskell says that in any program there should be only one > instance for any particular type (here Monoid Int). GHC > doesn't check that, but it should really do so. It's not > necessary for soundness (ie no runtime crash) but it is > necessary for coherence (ie

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Miguel Mitrofanov
What about diag [[1,2,3],[4],[5,6,7]] ? What it should be? Sebastian Fischer wrote on 15.04.2009 15:28: Prelude> let diag = concat . diags where diags ((x:xs):xss) = [x] : zipWith (:) xs (diags xss) this has a different semantics on finite lists, so I should add a test case: *Main> diag

[Haskell-cafe] Re: Data.ByteString woes

2009-04-15 Thread Achim Schneider
David Carter wrote: > I then thought I might work around the problem by converting lazy > ByteStrings to strict ones in order to do the regex match. > strictBS :: LB.ByteString -> B.ByteString strictBS = B.concat . LB.toChunks lazyBS :: B.ByteString -> LB.ByteString lazyBS = LB.fromChunks . pure

Re: [Haskell-cafe] Non-atomic "atoms" for type-level programming

2009-04-15 Thread Wolfgang Jeltsch
Am Dienstag, 14. April 2009 20:01 schrieb Tillmann Rendel: > How is the need for a common import for 'data TTrue; data TFalse' > different then the need for a common import for 'data Bool = True | False'? Why not say data True data False, instead of data TTrue data TFalse? I

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Sebastian Fischer
Prelude> let diag = concat . diags where diags ((x:xs):xss) = [x] : zipWith (:) xs (diags xss) this has a different semantics on finite lists, so I should add a test case: *Main> diag [[1,2,3],[4,5,6],[7,8,9]] [1,2,4,3,5,7,6,8,9] Your version yields [1,2,4,3,5,7]. Actually, there are a nu

Re: [Haskell-cafe] Re: ANN: Elerea, another FRP library

2009-04-15 Thread Wolfgang Jeltsch
Am Mittwoch, 15. April 2009 09:03 schrieb Achim Schneider: > I don't think using dirty tricks to implement FRP deserves flak, at > all, from my POV, it sounds like complaining that the IO monad is > implemented using C... meaning that if you're that close to bare > thunks, you have every right to u

[Haskell-cafe] Data.ByteString woes

2009-04-15 Thread David Carter
Hi, I am battling with Data.ByteString.Lazy.Char8, and currently losing. Any help gratefully received. Here's my code: import qualified Data.ByteString.Lazy.Char8 as B import Text.Regex.Posix ((=~)) test = B.pack "abc" =~ B.pack "b" :: Bool This works fine without the ".Lazy", and is also fine u

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Emil Axelsson
Sorry, I misread the task :) / Emil Emil Axelsson skrev: Why not: diag = [(x, sum-x) | sum <- [2..], x <- [1 .. sum-1]] / Emil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Looking for the fastest Haskell primes algorithm

2009-04-15 Thread Lennart Augustsson
For isPrime you might want to implement the AKS test, http://en.wikipedia.org/wiki/AKS_primality_test On Tue, Apr 14, 2009 at 3:05 PM, Edward Kmett wrote: > You might want to start with the Sieve of Atkin: > > http://en.wikipedia.org/wiki/Sieve_of_Atkin > > -Edward > > On Tue, Apr 14, 2009 at 8:4

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Emil Axelsson
Why not: diag = [(x, sum-x) | sum <- [2..], x <- [1 .. sum-1]] / Emil MigMit skrev: If I understand the problem correctly... Prelude> let diag = concat . diags where diags ((x:xs):xss) = [x] : zipWith (:) xs (diags xss) Prelude> take 10 $ diag [[ (m,n) | n <- [1..]] | m <- [1..]] [(1,1)

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread MigMit
If I understand the problem correctly... Prelude> let diag = concat . diags where diags ((x:xs):xss) = [x] : zipWith (:) xs (diags xss) Prelude> take 10 $ diag [[ (m,n) | n <- [1..]] | m <- [1..]] [(1,1),(1,2),(2,1),(1,3),(2,2),(3,1),(1,4),(2,3),(3,2),(4,1)] Sebastian Fischer wrote on 15.04.200

[Haskell-cafe] Code Golf

2009-04-15 Thread Sebastian Fischer
Fancy some Codegolf? I wrote the following function for list diagonalization: > diag l = foldr (.) id ((sel l . flip sel) ((:[]).(:))) [] > where > sel = foldr (\a b c -> id : mrg (a c) (b c)) (const []) . map (flip id) > > mrg [] ys = ys > mrg xs [] = xs > mrg (x:xs)

[Haskell-cafe] Re: Looking for the fastest Haskell primes algorithm

2009-04-15 Thread Johannes Waldmann
for the API design, always check others before rolling your own. E.g. the (three) functions with "Prime" in their name from http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html I hope they are there for a reason. While we're at it - do we have modPow? modInverse? And of course check t

Re: [Haskell-cafe] Looking for the fastest Haskell primes algorithm

2009-04-15 Thread wren ng thornton
Edward Kmett wrote: You might want to start with the Sieve of Atkin: http://en.wikipedia.org/wiki/Sieve_of_Atkin Also worth reading _Lazy wheel sieves and spirals of primes_: http://www.cs.york.ac.uk/ftpdir/pub/colin/jfp97lw.ps.gz -- Live well, ~wren _

[Haskell-cafe] Re: ANN: Elerea, another FRP library

2009-04-15 Thread Achim Schneider
"Patai Gergely" wrote: > Am I right thinking that the > NOINLINE pragma on unsafeDupablePerformIO prevents the problem of > multiple evaluation discussed yesterday? > From what I know and experienced, yes. Each individual unsafePerformIO only ever evaluates its action once, and if they are preven

Re: [Haskell-cafe] ANN: Elerea, another FRP library

2009-04-15 Thread Patai Gergely
> I will test it on a couple of machines, desktops and laptops. Try using a sensible nonzero value with threadDelay. Apparently it brings CPU usage down under Windows while retaining smoothness. However, increasing it from zero results in jerkiness under Linux... > If you take a look what Yampa do

Re: [Haskell-cafe] understanding typeable

2009-04-15 Thread Anatoly Yakovenko
So I am getting a little further, but i am seeing this bizarre behaviour: I wrote a function that will fold over parameters and push them into a constructor if it can given this type: data Foo = FooC Int | BarC Int deriving (Data, Typeable, Show) i can do this: > l

Re: [Haskell-cafe] ANN: Elerea, another FRP library

2009-04-15 Thread Patai Gergely
> I don't think using dirty tricks to implement FRP deserves > flak, at all, from my POV, it sounds like complaining that the > IO monad is implemented using C... meaning that if you're that > close to bare thunks, you have every right to use any means > necessary to make them behave properly. Dirt

[Haskell-cafe] Re: Best text editor

2009-04-15 Thread Achim Schneider
Jeff Wheeler wrote: > As one of the Yi developers, I'd love to hear some more specific > feedback on this. Do you remember any specific Vim features that were > missing? > Nope, but I'll be writing bug reports next time, at the very least. -- (c) this sig last receiving data processing entity.

[Haskell-cafe] Re: ANN: Elerea, another FRP library

2009-04-15 Thread Achim Schneider
"Patai Gergely" wrote: > ... > I don't think using dirty tricks to implement FRP deserves flak, at all, from my POV, it sounds like complaining that the IO monad is implemented using C... meaning that if you're that close to bare thunks, you have every right to use any means necessary to make the