[Haskell-cafe] Re: Type classes and type equality

2007-04-19 Thread oleg
- If we permit overlapping instances extension, then a few lines of code decide equality for all existing and future types: class TypeEq x y b | x y - b instance TypeEq x x HTrue instance TypeCast HFalse b = TypeEq x y b This is exactly what I was after, but

RE: [Haskell-cafe] How Albus Dumbledore would sell Haskell

2007-04-19 Thread Simon Peyton-Jones
| Simon (aka Dumbledore) is speaking to four different Houses: scientists | (Ravenclaw), engineers (Hufflepuff), entrepreneurs (Slytherin), and | managers (Griffindor). I wish I could live up to this image! Lots of interesting ideas on this thread, and Haskell-Cafe threads are *supposed* to

[Haskell-cafe] RE: [Haskell] haskell question

2007-04-19 Thread Simon Peyton-Jones
[Redirecting to Haskell Cafe] Hi Greg I think it's very likely that you *can* do what you want. I have not taken long enough to understand just what you are trying to do, but I do know why your program is failing, and I think you'll agree it *should* fail. Look at these lines (slightly

Re: [Haskell-cafe] question about Data.Binary and Double instance

2007-04-19 Thread Duncan Coutts
On Wed, 2007-04-18 at 21:12 -0700, David Roundy wrote: On Thu, Apr 19, 2007 at 10:20:21AM +1000, Duncan Coutts wrote: and people will for ever be defining newtype wrappers or complaining that the whole library isn't parametrised by the endianness or whatever. For existing formats you need

Re: [Haskell-cafe] Parallel executing of actions

2007-04-19 Thread Mitar
Hi! On 4/18/07, Juan Carlos Arevalo Baeza [EMAIL PROTECTED] wrote: This evaluates all the elements of the list using parMap (the expensive part, right?), and then sequentially applies the action on the current thread. True. But currently I have the main function I would like to parallel

RE: [Haskell-cafe] How Albus Dumbledore would sell Haskell

2007-04-19 Thread ajb
G'day all. Quoting Simon Peyton-Jones [EMAIL PROTECTED]: Lots of interesting ideas on this thread, and Haskell-Cafe threads are *supposed* to wander a bit. But, just to remind you all: I'm particularly interested in concrete examples (pref running code) of programs that are *

Re: [Haskell-cafe] How Albus Dumbledore would sell Haskell

2007-04-19 Thread Mirko Rahn
* small * useful * demonstrate Haskell's power * preferably something that might be a bit tricky in another language Something I like: A finite (binary) relation data Rel q = Rel { elems :: [(q,q)] } We do not export constructors, hence rel xs =

Re: [Haskell-cafe] How Albus Dumbledore would sell Haskell

2007-04-19 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: I updated the diff example a bit: http://andrew.bromage.org/darcs/diff/ It now features TWO newtype synonyms. This illustrates a crucial feature of Haskell: Abstractions are cheap. Okay, looking at that code: The

Re: [Haskell-cafe] First order Haskell without Data

2007-04-19 Thread Josef Svenningsson
Hi, Just a comment or two on the implications of converting higher-order functions to data. The paper you reference about this uses the method of defunctionalization. This is a whole program transformation and might therefore not be suitable in a compiler such as GHC or YHC. On the other hand,

Re: [Haskell-cafe] question about Data.Binary and Double instance

2007-04-19 Thread Jules Bean
Duncan Coutts wrote: Yeah, we've concentrated so far on the serialisation of Haskell values, not reading/writing externally defined binary formats. I don't think we've been especially clear on that. But we do intend to tackle both. Speaking for myself, I certainly didn't realise you were

Re: [Haskell-cafe] question about Data.Binary and Double instance

2007-04-19 Thread Duncan Coutts
On Thu, 2007-04-19 at 12:23 +0100, Jules Bean wrote: Duncan Coutts wrote: Yeah, we've concentrated so far on the serialisation of Haskell values, not reading/writing externally defined binary formats. I don't think we've been especially clear on that. But we do intend to tackle both.

[Haskell-cafe] Writing guards shorthand

2007-04-19 Thread Joel Reymont
Support I want to infer the type given an Op that looks like this (incomplete): data Op = Minus | Plus | Mul | LT | GT Is there a shorthand way of bunching Minus, Plus and Mul in a function guard since they all result in TyNum whereas the rest in TyBool? I really

Re: [Haskell-cafe] Writing guards shorthand

2007-04-19 Thread Neil Mitchell
Hi isBool x = isLT x || isGT x isNum x = not $ isBool x isLT and isGT can be derived automatically using derve [1], with the Is class (or DrIFT if you want). Thanks Neil [1] google data derive On 4/19/07, Joel Reymont [EMAIL PROTECTED] wrote: Support I want to infer the type given an Op

Re: [Haskell-cafe] Writing guards shorthand

2007-04-19 Thread Joel Reymont
This is what want. Notice the succinctness. Objective Caml version 3.10+dev24 (2007-02-16) # type foo = A | B | C | D | E | F ;; type foo = A | B | C | D | E | F # A;; - : foo = A # let infer = function | A | B | C - true; | D | E | F - false;; val infer : foo - bool = fun # infer

Re: [Haskell-cafe] Writing guards shorthand

2007-04-19 Thread Jules Bean
Neil Mitchell wrote: Hi isBool x = isLT x || isGT x isNum x = not $ isBool x isLT and isGT can be derived automatically using derve [1], with the Is class (or DrIFT if you want). You can also get a long way with GHC's built in derivations for Eq, Enum and Show. If an Enum instance is

Re: [Haskell-cafe] Writing guards shorthand

2007-04-19 Thread Jules Bean
Joel Reymont wrote: This is what want. Notice the succinctness. # let infer = function | A | B | C - true; | D | E | F - false;; val infer : foo - bool = fun Yes, I appreciate what you want, and I know ocaml too :) I was just talking around the other ways you can achieve it. I don't

Re: [Haskell-cafe] Writing guards shorthand

2007-04-19 Thread Neil Mitchell
Hi Jules, What this leads us towards is that it might be rather nice (perhaps even nice enough to build into a compiler) to be able to derive, for each type with multiple constructors, a type 'which is the enumeration of the constructors'. I.e. a type with the same constructors (up to some

[Haskell-cafe] 2 HaXml questions

2007-04-19 Thread Marc Weber
a) After filtering the content I want to use how do I extract the text? eg a = xtract html/body/h2/- which should return the text contained in the h2 tag. There is a parser called text which returns the text but I don't know how to use it ? Is there a much simpler way I have missed?

[Haskell-cafe] Re: Writing guards shorthand

2007-04-19 Thread Jón Fairbairn
Joel Reymont [EMAIL PROTECTED] writes: Support I want to infer the type given an Op that looks like this (incomplete): data Op = Minus | Plus | Mul | LT | GT Is there a shorthand way of bunching Minus, Plus and Mul in a function guard since they all result

Re: [Haskell-cafe] Re: Writing guards shorthand

2007-04-19 Thread Joel Reymont
On Apr 19, 2007, at 4:10 PM, Jón Fairbairn wrote: Is there some reason why you don't want data Op = Aop Aop | Bop Bop data Aop = Minus | Plus | Mul data Bop = LT | GT It's a long story. The short version is that the above will complicate my AST a whole lot. I had it this way

Re: [Haskell-cafe] Re: Writing guards shorthand

2007-04-19 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jón Fairbairn wrote: Is there some reason why you don't want data Op = Aop Aop | Bop Bop data Aop = Minus | Plus | Mul data Bop = LT | GT or similar? I would agree that it's a shame one cannot just write data Op = Aop (Minus |

[Haskell-cafe] fftw bindings

2007-04-19 Thread Fawzi Mohamed
Hi everybody, I was wondering if someone had fftw bindings for haskell, or if I should roll my own. I did a small search but found nothing. Fawzi ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] COM and Haskell

2007-04-19 Thread Justin Bailey
All, I'm interested in automating Excel using Haskell. I'm writing a little program for my wife and it'd be nice to fill out an Excel spreadsheet for her (with formatting so I don't think CSV will cut it). A bit of Googling didn't turn up anything interesting. Has any work been done on using

[Haskell-cafe] Morphing ASTs and scrapping boilerplate code

2007-04-19 Thread Joel Reymont
Folks, I'm transforming ASTs as part of my compiler from one language into another. The source AST is a list of statements whereas the target AST is a class definition. type Object a = State Obj a data Obj = Object { objSym :: Integer -- starting # for gensym , objVars ::

Re: [Haskell-cafe] fftw bindings

2007-04-19 Thread David Roundy
On Thu, Apr 19, 2007 at 05:37:05PM +0200, Fawzi Mohamed wrote: I was wondering if someone had fftw bindings for haskell, or if I should roll my own. Not that I'm aware of, but if you roll your own, please make them public, as I'll be interested in fftw bindings before long. -- David Roundy

[Haskell-cafe] Re: Morphing ASTs and scrapping boilerplate code

2007-04-19 Thread Joel Reymont
Just to clarify, I really liked the SYB solution to my previous issue with stripping token locations. It looked like this: strip :: (Data a) = a - a strip = everywhere (mkT f) where f (TokenPos a _) = a f x = x In the general AST transformation case, my constructor name is the

Re: [Haskell-cafe] Morphing ASTs and scrapping boilerplate code

2007-04-19 Thread Twan van Laarhoven
Joel Reymont wrote: I have a lot of boilerplate code like this and wonder how I can scrape it. instance Morpher Type C.Type where morph TyInt = return C.TyInt morph TyFloat = return C.TyFloat morph TyStr = return C.TyStr morph TyBool = return C.TyBool morph TyColor = return

Re: [Haskell-cafe] COM and Haskell

2007-04-19 Thread Marc Weber
On Thu, Apr 19, 2007 at 08:59:17AM -0700, Justin Bailey wrote: All, I'm interested in automating Excel using Haskell. I'm writing a little program for my wife and it'd be nice to fill out an Excel spreadsheet for her (with formatting so I don't think CSV will cut it). A bit of

Re: [Haskell-cafe] COM and Haskell

2007-04-19 Thread Paul Moore
On 19/04/07, Marc Weber [EMAIL PROTECTED] wrote: There is only one library: hdirect. But I don't know its status there have been some posts and some authors may have chnaged it. I'd suggest grepping some mailinglist archives (you can find them all on haskell.org) or wait till someone else gives

Re: [Haskell-cafe] COM and Haskell

2007-04-19 Thread Neil Mitchell
Hi I'm interested in automating Excel using Haskell. I'm writing a little program for my wife and it'd be nice to fill out an Excel spreadsheet for her (with formatting so I don't think CSV will cut it). A bit of Googling didn't turn up anything interesting. Does she need to

Re: [Haskell-cafe] COM and Haskell

2007-04-19 Thread Neil Mitchell
Hi If you application will be only small you'll be faster using VBScript. Or Python or Perl, or (probably, I'm not sure) Ruby. Or likely many others. No, VBA only. VBA is integrated with Excel and can talk to all the Excel data structures, be developed inside the Excel program etc. It can

Re: [Haskell-cafe] COM and Haskell

2007-04-19 Thread Marc Weber
On Thu, Apr 19, 2007 at 06:18:24PM +0100, Neil Mitchell wrote: No, VBA only. I had VBA in mind but typed the wrong name. Thanks Neil for correcting my statement. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: How Albus Dumbledore would sell Haskell

2007-04-19 Thread DavidA
Simon Peyton-Jones simonpj at microsoft.com writes: But, just to remind you all: I'm particularly interested in concrete examples (pref running code) of programs that are * small * useful * demonstrate Haskell's power * preferably something that might be a

Re: [Haskell-cafe] fftw bindings

2007-04-19 Thread Magnus Therning
On Thu, Apr 19, 2007 at 09:20:36 -0700, David Roundy wrote: On Thu, Apr 19, 2007 at 05:37:05PM +0200, Fawzi Mohamed wrote: I was wondering if someone had fftw bindings for haskell, or if I should roll my own. Not that I'm aware of, but if you roll your own, please make them public, as I'll be

[Haskell-cafe] Re: fftw bindings

2007-04-19 Thread Al Falloon
Magnus Therning wrote: On Thu, Apr 19, 2007 at 09:20:36 -0700, David Roundy wrote: On Thu, Apr 19, 2007 at 05:37:05PM +0200, Fawzi Mohamed wrote: I was wondering if someone had fftw bindings for haskell, or if I should roll my own. Not that I'm aware of, but if you roll your own, please make

Re: [Haskell-cafe] Re: How Albus Dumbledore would sell Haskell

2007-04-19 Thread Lennart Augustsson
A theorem prover might be a really cool example, but if there's one person in the audience that cares then Simon is lucky. :) You need to have examples that people can recognize and see the utility of. -- Lennart On Apr 19, 2007, at 20:48 , DavidA wrote: Simon Peyton-Jones

Re: [Haskell-cafe] How Albus Dumbledore would sell Haskell

2007-04-19 Thread ajb
G'day all. Quoting Isaac Dupree [EMAIL PROTECTED]: Okay, looking at that code: The comments before the type definitions are mostly good... now it looks like I'm going into critique mode :) BTW, for the record, I didn't try too hard with this. It is meant to be illustrative of what you can

Re: [Haskell-cafe] Re: fftw bindings

2007-04-19 Thread David Roundy
On Thu, Apr 19, 2007 at 05:46:49PM -0400, Al Falloon wrote: For us less knowledgable, what's fftw? Fastest Fourier Transform in the West. http://www.fftw.org/ Its cool, they use generative programming: an OCaml program generates codlets in C that can be composed and tuned to the specifics

Re: [Haskell-cafe] COM and Haskell

2007-04-19 Thread Doug Kirk
I hate to recommend Java to Haskellers, but there is a project named Poi at Apache's Jakarta site[1] that will allow you to (with some Java programming) read, write, and manipulate Excel files directly. You don't have to COM to Excel, you don't even need Excel installed! Nice for producing

RE: [Haskell-cafe] COM and Haskell

2007-04-19 Thread Tim Docker
There are also equivalent libraries (for producing xls files without excel) for python: http://sourceforge.net/projects/pyexcelerator http://sourceforge.net/projects/pyxlwriter/ perl: http://search.cpan.org/dist/Spreadsheet-WriteExcel/ so you don't have to use java... Tim -Original

Re: [Haskell-cafe] Re: How Albus Dumbledore would sell Haskell

2007-04-19 Thread Derek Elkins
DavidA wrote: Simon Peyton-Jones simonpj at microsoft.com writes: But, just to remind you all: I'm particularly interested in concrete examples (pref running code) of programs that are * small * useful * demonstrate Haskell's power * preferably something that