From leavens@larch.cs.iastate.edu Thu Aug 25 16:29:05 2005 Date: Thu, 25 Aug 2005 16:29:05 -0500 (CDT) From: Gary T. Leavens To: Computer Science 541 Subject: ++ is the append function in Haskell Hi all, In class I thought that "append" was used in Haskell to append lists. Actually, it's named ++ in Haskell. Sorry for the confusion. On the department Linux machines, the Prelude is in: /opt/hugs/lib/hugs/libraries See also http://haskell.org/definition/ for the official documentation. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ------------------------------- From leavens@larch.cs.iastate.edu Fri Aug 26 15:40:57 2005 Date: Fri, 26 Aug 2005 15:40:57 -0500 (CDT) From: Gary T. Leavens To: Jonathan Bentz Cc: Ru He Subject: Re: hugs question Hi Jonathan, On Fri, 26 Aug 2005, Jonathan Bentz wrote: > Is there a way I can put my Haskell test code in a file and execute it > instead of running interactively all the time? I have my Haskell function > code in a .lhs script and that works great, but I'm finding myself retyping > the tests interactively. I've tried a few things and haven't had any luck > with putting the executable commands in a file. Yes, one easy way is to define the tests as named expressions in a file: test1 = delete_twice 3 [3,4,5,3] test2 = delete_twice 3 [4,5,3] ... although it's nicer to do test 1 = ... test 2 = ... because then you can loop over them all... There is also a "HUnit" which is like JUnit for Haskell, if you are interested. See http://hunit.sourceforge.net/ . Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ------------------------------ From leavens@larch.cs.iastate.edu Tue Sep 13 22:41:50 2005 Date: Tue, 13 Sep 2005 22:41:50 -0500 (CDT) From: Gary T. Leavens To: hming@cs.iastate.edu Cc: Ru He Subject: Re: a type error, type inference Hi Ming, On Tue, 13 Sep 2005 hming@cs.iastate.edu wrote: > A second question is could you post somewhere on our class web the entire > reasoning process for type inferrencing using mymap as an example? (I asked TA > a little bit about that after class, he also didn't quite follow it.) Thanks! You can look at http://www.cs.iastate.edu/~leavens/ComS541/lectures/types/sml-type-inference.txt but that uses SML instead of Haskell notation. Perhaps better is: http://www.cs.iastate.edu/~leavens/ComS541/lectures/lambda-calculus/the-simply-typed-calculus.txt I'll try to update the first s I have time... See also the paper by Milner in the introduction to the literature handout. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ---------------------------------- From leavens@larch.cs.iastate.edu Thu Oct 6 17:07:59 2005 Date: Thu, 6 Oct 2005 17:07:59 -0500 (CDT) From: Gary T. Leavens To: Dave Doty Cc: Ru He Subject: Re: HW2 Hi Dave, On Thu, 6 Oct 2005, Dave Doty wrote: > On problem 9 of homework 2, won't we need to re-write the type of the infer > function to LambdaTerm -> (Maybe Type, LambdaTerm) in order to make it also > return a normal form of the term? I don't see how to encode the normal form > of the term just in the type. The problem is a bit ambiguous. It should say "first type check", instead of "both type check". The idea is to type check the term, and if there is an error, report it. Otherwise, you evaluate it to a normal form (which it's guaranteed to have, since it type checks...). What returned to the caller of such a function would be just the normal form. But if you think of an interactive system, you might print both the normal form and the type. Does that help? Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 -----------------