Participating students are encouraged to post their questions related to programming assignments, exercises, and lectures
in this discussion forum, as well as answers and hints for fellow students. This serves two purposes:
- To stimulate interaction between students during the course. A lively discussion is beneficial for everyone.
- To minimize the startup time for the assignments (for instance, about the software we use, GHC flags that are required for compilation, etc.).
Needless to say, it is strictly prohibited
to include (partial) answers to assignments.
Question about the Ant Presentations
: For the presentation of Thursday, shall I focus only on the High Level
Language itself, or should I also mention the other two parts (simulator
and visualizer) or our ants strategy?
: Focus on the high-level ant language, and explain some of the strategies you have encoded using your language. The main purpose of the presentation is to inform us what we can expect from your ants during the matches.
Problems with Hat
: I heard from some of you that they got an error on the readline package, even though this one is in ghc. I had the same one in windows when I was trying to load the QuickCheck
package (not Hat).
first you have to create an readline.o like this:
# any old temporary working directory will do
bash$ mkdir c:/tmp/hack
bash$ cd c:/tmp/hack
# assuming you've install 6.2.2 in c:/ghc/ghc-6.2.2
bash$ c:/ghc/ghc-6.2.2/bin/ar x c:/ghc/ghc-6.2.2/gcc-lib/libmoldname.a strcasecmp.o strncasecmp.o
bash$ c:/ghc/ghc-6.2.2/gcc-lib/ld --whole-archive -r -x -o readline.o c:/ghc/ghc-6.2.2/gcc-lib/libreadline.a strcasecmp.o strncasecmp.o
(for some versions the 'strcasecmp.o strncasecmp.o' must be replaced by 'string_old.o')
(or download it from: http://mijnadres.net/uu/readline.o
now place the readline.o file in:
(and delete the temp dir)
then edit C:\ghc\ghc-6.2.2\package.conf
look for package 'readline'
change: extra_libraries = ,
in: extra_libraries = ["readline", "advapi32"],
and to run your haskell program use:
c:\ghc\ghc-6.2.2\bin\ghci -package util -i\. .\Main.hs
So good luck !
Hmmz, Reinier pointed me that QuickCheck2
couldn't be found. I'm experiencing the same problem on both Windows and Redhat. Anybody any ideas here ?
: I managed to compile Hat with 32bit gentoo linux and GHC 6.4. Just do a "emerge hmake" to get hmake and then download the hat tar.gz file. Compilation succeeds, but there seems to be some problem with path names. This is the output if I try to run hat-observe:
/usr/local/bin/hat-observe: line 4: /usr/local/bin/harch: No such file or directory
/usr/local/bin/hat-observe: line 5: /usr/local/lib/hat//hat-observe: No such file or directory
/usr/local/bin/hat-observe: line 5: exec: /usr/local/lib/hat//hat-observe: cannot execute: No such file or directory
after installing hmake and before intalling Hat did you do:
(and than of course ./configure, make, make install)
Problem with textEntry (wxHaskell)
: On some Linux versions, the 'textEntry' control doesn't react to the enter
key on your keyboard. This can be solves by adding an extra property to
the textEntry control.
You must add the property processEnter := True
to make it work..
Exercise 2 (Unification monad)
Question by Jose and Bogdan:
We got puzzled on the third step
by the hint stating "try to localize your code for debugging / Typically,
one location should be enough". We can't find a solution that would
require writing debug information only in one location (...)
Step three mentions four "aspects" that we want to debug (see the bulleted list). The hint
states that typically one location should be enough to do the debugging for each
of the four
aspects (hence, four locations in total).
It is clearly advantageous to have the code for debugging at a single location in the code, instead of
having the same piece of code at several places. In fact, you can view it as evidence that the functionality you are monitoring is taken care of by a single function.
If you have to write debug information for one aspect on several locations, it might be an indication
that you missed a possibly useful abstraction. Introduce new helper-functions that do the monitoring for you, and
try to formulate new abstractions for often occurring patterns in your code. It basically is nothing but restructuring of code. My own implementation for exercise two contains exactly four locations where debugging takes place.
: Can someone explain to me what the means of a functional dependency are as mentioned in the slides about Monads on slide 64?
: A functional dependency helps to prevent ambiguities that may arise when using multiple parameter type classes. Functional dependencies are explained in detail in Mark Jones' paper Type Classes with Functional Dependencies
, which will be discussed during the
AFP lecture on advanced type classes. A functional dependency such as
a -> b
can be part of a class declaration, and could be read as follows: if we know which type the type variable
represents, then the type for
is uniquely determined by this type.