Re: [Haskell-cafe] Type checking with Haskell

2007-04-13 Thread Derek Elkins
Stefan O'Rear wrote: On Thu, Apr 12, 2007 at 01:04:13PM +0100, Joel Reymont wrote: Folks, The ghc/compiler/typecheck directory holds a rather large body of code and quick browsing through did not produce any insight. How do you implement type checking in haskell? Assume I have an Expr type

Re: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Lennart Augustsson
It's so much easier to write the type checker because it's only a few constructs left in the language. But from a user's perspective it's a really bad idea. -- Lennart On Apr 12, 2007, at 15:25 , Joel Reymont wrote: On Apr 12, 2007, at 3:00 PM, Stefan O'Rear wrote: Also, GHC run

Re: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Bas van Dijk
On 4/12/07, Joel Reymont <[EMAIL PROTECTED]> wrote: What would be the benefit of running type checking after desugaring? After desugaring, the program is written in a much more simple language (GHC Core). Type checking a desugared program is much easier because the type checker has to deal with

Re: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Joel Reymont
On Apr 12, 2007, at 3:00 PM, Stefan O'Rear wrote: Also, GHC runs typechecking *before* desugaring, apparently thinking error messages are more important than programmer sanity :) What would be the benefit of running type checking after desugaring? -- http://wagerlabs.com/

Re: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Joel Reymont
Thanks Stefan! On Apr 12, 2007, at 3:00 PM, Stefan O'Rear wrote: Your problem, as I understand it, is even simpler than most since there are no higher order functions and no arguments. I do have functions and arguments but I don't have HOF. (That said, it would probably be better to fuse pa

Re: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Stefan O'Rear
On Thu, Apr 12, 2007 at 01:04:13PM +0100, Joel Reymont wrote: > Folks, > > The ghc/compiler/typecheck directory holds a rather large body of > code and quick browsing through did not produce any insight. > > How do you implement type checking in haskell? > > Assume I have an Expr type with a c

RE: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Bernie Pope
Hi Joel, You may like to check out my mini-interpreter called (cheekily) baskell: http://www.cs.mu.oz.au/~bjpop/code.html It has type inference, and it is pretty straightforward. I wrote it for teaching purposes. First, I pass over the AST and generate a set of typing constraints. They are j

Re: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Joel Reymont
On Apr 12, 2007, at 1:07 PM, Stefan Holdermans wrote: You might want to check out "Typing Haskell in Haskell" [1] by Mark P. Jones. Must be _the_ paper as Don suggested it as well. I also looked at my copy of Andrew Appel's compilers in ML book and realized that I should be going about it

Re: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Stefan Holdermans
Joel, How do you implement type checking in haskell? You might want to check out "Typing Haskell in Haskell" [1] by Mark P. Jones. Cheers, Stefan [1] Jones, Mark P. Typing Haskell in Haskell. In Erik Meijer, editor, Proceedings of the 1999 Haskell Workshop, Friday October 9th, 1999,