[Haskell-cafe] Type checking with Haskell

Bernie Pope bjpop at csse.unimelb.edu.au
Thu Apr 12 09:13:51 EDT 2007

Hi Joel,

You may like to check out my mini-interpreter called (cheekily) baskell:


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 just equality constraints. Then I solve the constraints. Couldn't be
much simpler than that. Mind you, the input language is pretty minimal (no
type classes etcetera). 


> -----Original Message-----
> From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-
> bounces at haskell.org] On Behalf Of Joel Reymont
> Sent: 12 April 2007 13:04
> To: Haskell Cafe
> Subject: [Haskell-cafe] Type checking with Haskell
> 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 constructor per type and functions
> can take lists of expressions. Do I create a function taking an Expr,
> pattern-matching on appropriate constructor and returning True on a
> match and False otherwise?
> 	Thanks, Joel
> --
> http://wagerlabs.com/
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list