
For learning, I would like to develop my own implementation of type inference, based on the paper "Typing Haskell in Haskell". At first sight, the source code of THIH contains a small number of tests, but I was wandering if a large test set exist? Thanks, Peter

Peter Verswyvelen wrote:
For learning, I would like to develop my own implementation of type inference, based on the paper "Typing Haskell in Haskell".
At first sight, the source code of THIH contains a small number of tests, but I was wandering if a large test set exist?
I'm pretty sure GHC maintains a large set of test cases. Maybe you can use some of those? Or maybe you can just pick a random project from hackage and run your type checker on that? Martijn.

I was recently working on an type inference algorithm and to test it I did
the following:
Used the quickcheck Arbitrary typeclass to generate expressions
Inferred types of the expressions using my algorithm,
converted the expressions that passed inference to haskell and wrote them
to a file (without type signatures)
converted and wrote the failed expression to a separate file
compiled the "passed" file with -Wall, and extracted all the type
signatures that were spit out as warnings
parsed the type signatures that -Wall spit out and compare with the
signatures generated by my algorithm.
compiled the "failed" file and make sure I get type errors for all my
expressions
My algorithm also infers infinite types (which haskell does not) so I had to
test that functionality manually.
Overall it was kinda messy, but it worked ok.
I could possibly send you one of my lists. My test expressions are all very
simple, no type classes, only 2 types (function and number), and the only
expression components are let, lambda, apply, identifier, and number. If
something like that would work, let me know.
Hope that helps,
- Job
On Tue, Oct 20, 2009 at 10:07 AM, Peter Verswyvelen
For learning, I would like to develop my own implementation of type inference, based on the paper "Typing Haskell in Haskell".
At first sight, the source code of THIH contains a small number of tests, but I was wandering if a large test set exist?
Thanks, Peter _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Tue, Oct 20, 2009 at 10:07 AM, Peter Verswyvelen
wrote: For learning, I would like to develop my own implementation of type inference, based on the paper "Typing Haskell in Haskell". At first sight, the source code of THIH contains a small number of tests, but I was wandering if a large test set exist?
Thanks, Peter
Dear Peter, The sources of the Helium compiler contain quite a few test files for type inference and other issues like static checking. Go to http://www.cs.uu.nl/wiki/Helium go to Downloads and get the most recent version. Then unpack it. Then go to the directory heliumsystem/helium/test/typerrrors that contains a large number of type erroneous programs,and heliumsystem/helium/test/correct contains quite a few that should pass the test (but that does depend somewhat on how extensive the language you support is). hope this helps, Jurriaan
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Thanks Job & Martijn for the feedback.
I would like to write a type inferrer that is mostly Haskell 98 with
Trex row polymorphism extensions (a bit like CAL I guess).
That will certainly take a while because I'm also studying the theory
in my spare time.
So as soon as (or if) I have something working, I will need a larger
set of tests.
So Job, no need to do put any effort in preparing test sets, but I
highly appreciate your offer.
Cheers,
Peter
On Wed, Oct 21, 2009 at 4:47 PM, Job Vranish
I was recently working on an type inference algorithm and to test it I did the following: Used the quickcheck Arbitrary typeclass to generate expressions Inferred types of the expressions using my algorithm, converted the expressions that passed inference to haskell and wrote them to a file (without type signatures) converted and wrote the failed expression to a separate file compiled the "passed" file with -Wall, and extracted all the type signatures that were spit out as warnings parsed the type signatures that -Wall spit out and compare with the signatures generated by my algorithm. compiled the "failed" file and make sure I get type errors for all my expressions
My algorithm also infers infinite types (which haskell does not) so I had to test that functionality manually.
Overall it was kinda messy, but it worked ok.
I could possibly send you one of my lists. My test expressions are all very simple, no type classes, only 2 types (function and number), and the only expression components are let, lambda, apply, identifier, and number. If something like that would work, let me know.
Hope that helps,
- Job
On Tue, Oct 20, 2009 at 10:07 AM, Peter Verswyvelen
wrote: For learning, I would like to develop my own implementation of type inference, based on the paper "Typing Haskell in Haskell".
At first sight, the source code of THIH contains a small number of tests, but I was wandering if a large test set exist?
Thanks, Peter _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (4)
-
Job Vranish
-
jur
-
Martijn van Steenbergen
-
Peter Verswyvelen