[Haskell-cafe] Re: Simple GADT parser for the eval example

2006-10-31 Thread Stefan Monnier
...No surprise there, since there is no way to fail in the event of a maltyped Expr. The next thing to try is a type class solution... Think about it: you need to do type checking. For our little language we used Template Haskell to do your Expr - Term a translation, thus the type-checking of

Re: [Haskell-cafe] Guidelines for proposing library changes

2006-10-31 Thread Ross Paterson
On Wed, Oct 25, 2006 at 11:58:59AM +1000, Donald Bruce Stewart wrote: After some discussion on the libraries list, I've put up the suggested 'best practice' for proposing library changes, here: http://haskell.org/haskellwiki/Library_submissions The idea is to reduce the number of

[Haskell-cafe] A type class puzzle

2006-10-31 Thread Yitzchak Gale
Consider the following sequence of functions that replace a single element in an n-dimensional list: replace0 :: a - a - a replace0 = const replace1 :: Int - a - [a] - [a] replace1 i0 x xs | null t= h | otherwise = h ++ (replace0 x (head t) : tail t) where (h, t) = splitAt i0 xs replace2

Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Tomasz Zielonka
On Tue, Oct 31, 2006 at 11:02:03AM +0200, Yitzchak Gale wrote: Consider the following sequence of functions that replace a single element in an n-dimensional list: replace0 :: a - a - a replace1 :: Int - a - [a] - [a] replace2 :: Int - Int - a - [[a]] - [[a]] Generalize this using type

Re: [Haskell-cafe] Simple GADT parser for the eval example

2006-10-31 Thread Ulf Norell
On Oct 31, 2006, at 2:19 AM, Dimitrios Vytiniotis wrote: -- Give a GADT for representation types data R a where Rint :: R Int Rbool :: R Bool Rpair :: R a - R b - R (a,b) -- Give an existential type with a type representation data TermEx where MkTerm :: R a - Term a - TermEx -- we

[Haskell-cafe] Tutorial: Writing a Lisp Interpreter In Haskell

2006-10-31 Thread Donald Bruce Stewart
People might be interested in a new tutorial that's just appeared in blogspace, by coffeemug (of #haskell): http://www.defmacro.org/ramblings/lisp-in-haskell.html Also, its on reddit, http://programming.reddit.com/info/oj1w/details An enthusiastic view of the language from a newcomer's

[Haskell-cafe] Re : Tutorial: Writing a Lisp Interpreter In Haskell

2006-10-31 Thread minh thu
Thanks for pointing it ! (There's also this one: http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html which is featured on the Tools and Libraries/Compilers and Interpreters page of the haskell wiki) bye, minh thu 2006/10/31, Donald Bruce Stewart [EMAIL PROTECTED]:

Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Yitzchak Gale
Tomasz Zielonka wrote: It's quite easy if you allow the indices to be put in a single compound value. Hmm. Well, I guess I don't need to insist on the exact type that I gave in the statement of the puzzle - although something like that would be the nicest. This is actually a function that is

[Haskell-cafe] Monad.Reader Licensing (Re: [Haskell] The Monad.Reader - Call for Copy)

2006-10-31 Thread Conrad Parker
Hi, On Tue, Oct 31, 2006 at 12:10:21PM +, Wouter Swierstra wrote: * License: The entire magazine should be published under a Creative Commons Attribution 2.5 License. This makes it much easier to publish, distribute, teach, and share the Reader. This license allows anyone to use

Re: [Haskell-cafe] Why is Haskell not homoiconic?

2006-10-31 Thread Jerzy Karczmarczuk
Henning Sato von Rosen wrote: I am curious as to why Haskell not is homoiconic? I am interested in the reasons behind that design descision. I ask using this defintion og homiconicity: Homiconic means that the primary representation of programs is also a data structure in a primitive type of

[Haskell-cafe] Re: Why is Haskell not homoiconic?

2006-10-31 Thread Stefan Monnier
Homiconic means that the primary representation of programs is also a data structure in a primitive type of the language itself The main reason is that Haskell is designed as a compiled language, so the source of the programme can safely disappear at runtime. So there's no need to have a

[Haskell-cafe] Re: Why is Haskell not homoiconic?

2006-10-31 Thread Jón Fairbairn
Henning Sato von Rosen [EMAIL PROTECTED] writes: Hi all! I am curious as to why Haskell not is homoiconic? It very nearly is. The icon for Haskell is a lower-case lambda, but the logo for these folk http://www.ualberta.ca/~cbidwell/cmb/lambda.htm is an upper-case lambda. Homiconic means

[Haskell-cafe] Why is Haskell not homoiconic?

2006-10-31 Thread Henning Sato von Rosen
Hi all! I am curious as to why Haskell not is homoiconic? I am interested in the reasons behind that design descision. I ask using this defintion og homiconicity: Homiconic means that the primary representation of programs is also a data structure in a primitive type of the language itself --

Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Greg Buchholz
Yitzchak Gale wrote: Tomasz Zielonka wrote: If you insist that each index should be given as a separate function argument, it may be possible to achieve it using the tricks that allow to write the variadic composition operator. I am not familiar with that. Do you have a reference? Is that

Re: Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Nicolas Frisby
See Connor McBride's Faking It: Simulating Dependent Types in Haskell http://citeseer.ist.psu.edu/mcbride01faking.html It might help; your example makes me think of the nthFirst function. If it's different, I'md wager the polyvariadic stuff and nthFirst can be reconciled on some level. Nick

[Haskell-cafe] hdbc linking errors

2006-10-31 Thread Jeff Polakow
Hello, When trying to compile a standalone program using hdbc in cygwin, I get many linker errors. I have no problems using my code interactively with ghci. I am using the command line: ghc --make -package HDBC -package HDBC-odbc -O -o testExecute testExecute.hs Am I missing something?

Re: Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Greg Buchholz
Rearranging... Nicolas Frisby wrote: On 10/31/06, Greg Buchholz [EMAIL PROTECTED] wrote: ...That first article is the strangest. I couldn't reconcile the fact that if our type signature specifies two arguments, we can pattern match on three arguments in the function definition.

Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Arie Peterson
Greg Buchholz wrote: ...That first article is the strangest. I couldn't reconcile the fact that if our type signature specifies two arguments, we can pattern match on three arguments in the function definition. Compare the number of arguments in the first and second instances... class

Re: Re: Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Nicolas Frisby
Does that explain how, why, or when you can use more arguments than you are allowed to use? Or is it just another example of using more arguments than you are allowed to use? Is this a Haskell 98 thing, or is it related to MPTCs, or fun deps, or something else? I don't understand you can

Re: [Haskell-cafe] hdbc linking errors

2006-10-31 Thread Jeff Polakow
Hello, I think my problem is a faulty ghc installation and not HDBC. sorry for the noise, Jeff [EMAIL PROTECTED] wrote on 10/31/2006 02:31:27 PM: Hello, When trying to compile a standalone program using hdbc in cygwin, I get many linker errors. I have no problems using my code

Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Tomasz Zielonka
On Tue, Oct 31, 2006 at 03:12:53PM +0200, Yitzchak Gale wrote: But I would rather not be forced to write things like replace (I 0 $ I 2 $ I 3 $ ()) in my code. My first attempt was very similar to yours, except I used replace (0, (2, (3, ( instead of your Index type. I started

Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Greg Buchholz
Arie Peterson wrote: ] I'm not sure I'm getting your point, but this is just because in the ] second instance, the second parameter of BuildList is 'a - r', so the ] specific type of 'build\'' is '[a] - a - (a - r)' which is just '[a] - ] a - a - r' (currying at work). I guess it just looks

Re: [Haskell-cafe] Accumulating related XML nodes using HXT

2006-10-31 Thread Albert Lai
Daniel McAllansmith [EMAIL PROTECTED] writes: Hello. I have some html from which I want to extract records. Each record is represented within a number of tr nodes, and all records tr nodes are contained by the same parent node. This is very poorly written HTML. The original structure

Re: [Haskell-cafe] A type class puzzle

2006-10-31 Thread Jacques Carette
Greg Buchholz wrote: I guess it just looks really strange to my eyes. For example, foo and bar are legal, but baz isn't. That's what I was thinking of the situation, but I guess the type classes iron out the differences. foo :: Int - Int - Int - Int foo 0 = (+) bar :: Int - Int - Int

[Haskell-cafe] Re: A type class puzzle

2006-10-31 Thread Arie Peterson
Greg Buchholz wrote: I guess it just looks really strange to my eyes. For example, foo and bar are legal, but baz isn't. That's what I was thinking of the situation, but I guess the type classes iron out the differences. Ah, but here 'baz' is illegal because of the (somewhat arbitrary)

Re: [Haskell-cafe] Simple GADT parser for the eval example

2006-10-31 Thread Greg Buchholz
Thanks to everyone who replied (especially Dimitrios Vytiniotis and Joost Visser). I now know the standard way to write the GADT parser. But I'm still curious if anyone has comments pertaining to the version using type classes. It seems so close to doing what we want, and it is pretty

[Haskell-cafe] there's a monster in my Haskell!

2006-10-31 Thread Andrew Pimlott
To boost the popularity of Scheme, Felleisen has argued for renaming lambda to something cool, such as Funster.[1] Likewise, Haskell intimidates newcomers with the arcane term monad. Peyton Jones's hopeful campaign to replace it with warm fuzzy thing[2] has so far produced few results. Inspired

Re: [Haskell-cafe] More documentation: how to create a Haskell project

2006-10-31 Thread Henning Thielemann
On Mon, 30 Oct 2006, David House wrote: On 30/10/06, Tony Morris [EMAIL PROTECTED] wrote: 4) If you want links to base libraries in your haddock output, do such and such (how do you do that anyway?) I believe you need a local copy of the library sources, whose path you give to haddock