Postgraduate research in
FUNCTIONAL PROGRAMMING
at the University of Glasgow
OK, you *could* do buzzword-compliant programming for company X on
their test harness for their test rig for the GTI (General Toaster
Interface). You'd make a
The goal of having a human-written interface is to give the programmer the
opportunity to say (and document) just what the interface of a module is. I
think of this as analogous to specifying a type signature for a function...
often illuminating, but should not be obligatory. Especially when
Lennart writes:
| So if we had
|
| data Age = Age !Int
| foo (Age n) = (n, Age (n+1))
|
| it would translate to
|
| foo (MakeAge n) = (n, seq MakeAge (n+1))
|
| [makeAge is the "real" constructor of Age]
|
| Now, surely, seq does not evaluate its first argument when the
The Glasgow Haskell Compiler -- version 0.26
We are proud to announce a new public release of the Glasgow Haskell
Compiler (GHC, version 0.26). Sources and binaries are freely
available by anonymous FTP and on the
Folks,
We're trying to do a "Haskell vs anything-else (preferably C)" study. We're
interested both in their size and structure, and in their performance. We
intend to make quite detailed comparative measurements of their performance.
Do you have programs we could have a look at?
We
Folks,
I've added a list of topics to the WWW page for FPCA '95. If you specify
what topic(s) your paper covers, I'll have a better chance of assigning your
paper to appropriate referees. Doing so is strictly optional, however.
Details at URL:
Here's a thought, engendered by a glass of beer in the Lamplighter's pub
in Gastown, Vancouver by John Hughes, Lennart Augustsson, and Simon PJ:
type classes can model extensible records.
Suppose we want to define a record for a person:
record Person = { Age : Int; Weight :
The following four related papers, all on the topic of mutable state in
non-strict functional languages, are available by FTP. The first two are as
yet unpublised; the last two are published.
I'm posting this to the types mailing list as well as the functional
programming ones because
| Maybe the symbol table isn't passed around to all dark corners though.
Dead right it ain't. There are plenty of places you don't need a symbol
table.
| Anyway, what it seems to me you lose by doing it the way you described
| is that you are stuck again if some day you want to set those
Fergus
| I would find Simon's arguments more convincing if he showed
| a convenient idiom that did things properly, rather than a
| convenient way to write broken programs.
|
| (Doing it properly is probably not too hard, but I'll leave it up to
| the proponents of this proposal to demonstrate
| Why muddle implementation with language design? Pick a design that
| we know everyone can implement -- e.g., exported functions must have
| type declarations -- and stick to that. When the state of implementations
| improve, the specification for Haskell 1.5 can change accordingly. -- P
| |
| International Conference on Functional Programming (ICFP97) |
| Symposium on Partial Evaluation and Program Manipulation (PEPM97)|
|
| However, in return, perhaps somebody can supply me with parse trees for
| the following:
|
| - - 1(accepted by nhc and hbc)
| (- 1 `n6` 1) where infix 6 `n6` (accepted by nhc, hbc, ghc)
| (- 1 `r6` 1) where infixr 6 `r6` (accepted by nhc,
The Glasgow Computing Science Department is seeking two new members of
academic (i.e. faculty) staff, one permanent (i.e. tenured) and the
other temporary.
I am very keen to attract excellent researchers to the department,
especially ones interested in language design and implementation (and
You've seen the Happy parser generator I assume?
It's not a full attribute grammer extension, but it's moving in
that direction.
| Would it be possible to design a standard attribute grammar
| extension to Haskell? This could then be added as an appendix to
| the Report, or as a separate
The Glasgow Haskell Compiler -- version 2.01
We are pleased to announce the first release of the Glasgow Haskell
Compiler (GHC, version 2.01) for *Haskell 1.3*. Sources and binaries
are freely available by anonymous FTP and
International Conference on Functional Programming (ICFP'97)
9-11 June 1997, Amsterdam
http://www.fwi.uva.nl/research/func/icfp97.html
Of course this should be 14 Feb '97!
Simon
| Deadline [URLs below]
| ~
|
| Haskell workshop14 February 1996
|
| '97? Or is this a Very Dead Line?
Folks,
Many of you will know of John Hughes pretty printing library [1].
I recently extended it with two new features:
* An "empty document" which is a unit for all the composition
operators. In practice this is tremendously useful.
* A "paragraph fill" combinator.
A new view of guards
Simon Peyton Jones, April 1997
This note proposes an extension to the guards that form part of function
definitions in Haskell. The increased expressive power is known (by me
anyway!) to be useful. The
Folks,
There's often been quite a bit of discussion on the Haskell mailing list
about extensions of type classes. Erik Meijer, Mark Jones and I have
written a draft paper that explores the type-class design space, discussing
the various design decisions one must make, and their consequences.
RFC-822-HEADERS:
Original-Via:
==
Folks,
I have realised that the class Ix is under-documented in the Haskell Report.
I propose to add the following:
New section 6.9.1 "The Class Ix". (Renumber subsections in 6.9).
~
Arrays may be subscripted
| This one is easy (I think) (for a change). The module above is quite legal,
| and exports the type T but not the constructor. If you wanted the
| constructor to go too, you can write
|
| module M( T(..) )
|
| or
|
| module M( T(T) )
| But, but, but, how can you say that
I thought this message from Joe should have wider circulation.
Someone out there must have good ideas about this!
Simon
--- Forwarded Message
Date:Thu, 27 Feb 92 01:38:44 -0700
From:[EMAIL PROTECTED] (Joe Fasel)
To: [EMAIL PROTECTED], [EMAIL PROTECTED], kh,
[EMAIL
PAPER_LIST.
Simon PJ, University of Glasgow.
Implementing lazy functional languages on stock hardware:
the Spineless Tagless G-machine
Version 2.4
Simon L Peyton Jones, University of Glasgow
The Spineless Tagless G-machine is an abstra
Now that the Haskell report has appeared in SIGPLAN Notices, it seems
like a good time to broadcast the current status of Haskell
implementations. Below appears an up-to-date summary of implementations
known to me. If there are other implementations about, please let me know!
Simon Peyton
Namrata asks...
| So, when x1' + x2' is evaluated,
| Is (1,2) pattern matched against (a,b) twice -- once for x1' and once
| for x2' ??
The translation you give (correctly I think) expresses the required
*semantics*. But the translation is not the required *implementation*. A
compiler can do
| From: Stephen J Bevan [EMAIL PROTECTED]
| Date: Fri, 27 Nov 92 12:07:04 GMT
|
|
| Is it possible to import a type and the derived "show" function for it
| without having to import all the type's constuctors? For example, in
| the following I attempt to import just Lexeme into Token as the
Here, for your interest, is a freshly-updated summary of the current state of
Haskell implementations, at least those known to us.
Simon Peyton Jones, Glasgow University.
Haskell: Current status
[Simon Peyton Jones wrote the original
People reading the update-notation thread might also be interested in
"Imperative functional programming"
Peyton Jones Wadler, POPL 93
which you can grab by ftp
fromftp.dcs.glasgow.ac.uk
in pub/glasgow-fp/papers/imperative.ps.Z
The paper mainly
|What if (the appropriate parts of) the standard prelude is
| explicitly *not* imported:
|
| import Prelude ()
| or
| import Prelude hiding(map)
|
| (see section 5.4.3).
|
|Are then the hidden parts of the standard prelude still available via
| n+k patterns, list
This message is directed specifically at people who are interested in the
*internals* of the Glasgow Haskell compiler. If you aren't, then just
delete this message. We don't have an exhaustive list of all ghc-internals
users, which is why this message is going to the Haskell mailing list.
I don't like Phil's suggestion to have non-lifted products:
* It messes up the uniform semantics for algebraic data types (all lifted).
For example
a) You have to explain that
f ~(z,a) = ... is the same as f (z,a) = ...
but
g ~(z:a) = ... is NOT the
(This message assumes we head for the strictness-annotation-on-constructor-arg
solution. I'll respond to Phil's comments in my next msg.)
The problem with polymorphic strictness
~~~
John asks what the problem is with strict constructor args. As Lennart and
Gentle Haskell-1.3 people,
This message argues for a particular approach to abstract data types in Haskell.
The problem
~~~
We have long been a bit unhappy with Haskell's treatment of abstract data types.
It's easy to make a new algebraic data type abstract, just by not exporting its
Folks,
Warren Burton makes what appears to me to be a Jolly Sensible suggestion about
the syntax of type signatures. Haskell already has many dual ways of doing
things (let/where, case/pattern-matching). Warren proposes an alternative
syntax for type signatures.
Simon
--- Forwarded
I think we should be pretty cautious about jumping in with lifed function
spaces. I have come up with two distinct unintended effects. While neither
is fatal to the idea, I don't think either obvious, and I am nervous that
others may pop out of the woodwork somewhere down the road (to mix
| We can avoid both the case expressions and the helper function by Simon
| Peyton Jones' guard syntax
|
| -- version 3
| simplify (Plus e e') | s - simplify e ,
|s' - simplify e',
|(Val 0) - s
| = s'
|
Thanks for feedback about pattern guards. Here are some quick responses.
1. Several people have suggested something along the lines of being
able to backtrack half way through a pattern guard. I considered this
but (a) I couldn't see a nice syntax for it and
(b) it's against the spirit
Koen suggests:
| The solution is real easy: To express the necessity of a Monad to be a
| Functor, change the definition of the class Monad as follows:
|
| class Functor m = Monad m where
| ...
When to make one class into a superclass of another is a rather tricky
matter of judgement:
| 1.- In the version 1.2 there is a restriction that a C-T instance declaration
| may only appear either in the module where C or T are declared, but in
| the version 1.3 this restriction does not appear. What is the reason for
| the change? Why is the restriction in 1.2 at all?
| I have a small question about defining functions over types declared
| with "newtype". Consider the following:
|
|newtype MyList a = MyList [a]
|
|myMap1 :: (a - b) - MyList a - MyList b
I would say
myMap f (MyList xs) = MyList (map f xs)
| Perhaps there is no elegant
There's a Haskell 1.4 report bug list at
http://haskell.systemsz.cs.yale.edu/report/bugs.html
John Peterson puts the entries in, but it's really up to others to write
the entry.
Would you like to document the bugs you've found along with the fixes
and send an entry to John? It
The report says explicit that instance declarations like
instance C (a,a) where ..., or for (Int,a) or for [[a]] are not
I now only would like to know why this design decission was made,
are there any problems with the instance declarations I have in mind?
You might find "Type classes -
In fact, I would like to hear what all the major implementors have as their
picture of a final version of Haskell. You've all been pretty quiet.
I assume you've all already aired your opinions at the workshop, but it would
be nice to see them here as well.
Reasonable request.
I hope that
There are few formal connections between monads and
single-threaded state... For any state-transformer monad... there
is a trivial operation... that will instantly destroy any hope for
single-threadedness: getState s = (s, s)
In day-to-day Haskell 1.3 programming what is
The Prelude module is imported automatically into all modules as if
by the statement `import Prelude', if and only if it is not imported
with an explicit import declaration. This provision for explicit
import allows values defined in the Prelude to be hidden from the
unqualified
Sergey
Thanks for your various messages. I've explained your results below.
You are right to say that
it's hard to be sure what optimisations will happen when; arguably
that's a bad shortcoming of functional programming (especially the lazy sort).
Profiling tools help a bit.
I think, though,
So here is my call for contribution:
Send an abstract syntax and/or a parser specification!
It doesn't matter if a parser generator is used or recursive descent
techniques are applied.
If there is enough echo, I'd like to setup a web page for this
project, containing things to
Folks,
I thought you might find the following bug I've just
found in GHC entertaining.
In the strictness analyser we need to compare abstract values
so that the fixpoint finder knows when to stop. In the
middle of this code was the following:
sameVal :: AbsVal - AbsVal - Bool
I have enclosed below a test file that causes an error that puzzles
me. Both GHC and Hugs kick it out, so at least they agree; however, I
must admit that I don't understand it.
Yes, it is a bit confusing, and it took me a few minutes
to see what is going on.
Here's your problem:
data
Is there any reason for not allowing:
data Test = Test {}
in Haskell?
I can't think of one. Maybe Std Haskell should allow it.
I'll put it on the Std-Haskell board.
Simon
I would like to use Haskell for several larger scale projects, but I
can't figure out how to read and write binary data. It does not appear
that the language supports binary files. Am I missing something?
Colin Runciman and his Merrie Men are working on writing
Haskell values into binary
I'd be delighted if a programming-language-aware person applied for this
(tenured) post. Deadline 13 March.
Simon
Lectureship in Computing Science
University of Glasgow
The University invites applications for a permanent lectureship in the
Department of
Real world example: development tools process a large geometric data set to
build a run-time optimized BSP tree with precalculated lighting and
collision information. The user application will not modify this data, but
it will have to load it dynamically without slowing down a 30Hz
PS. Could somebody inform me what is the current status of
multi-parametric classes?
GHC 3.01 supports multi-parameter type classes
in more or less the form described in the last section of
"Type classes: an exploration of the design space"
infixl 7 *$
infixl 6 +$, -$
class Ring a where
(+$), (-$), (*$) :: a - a - a
negateR :: a - a
fromIntegerR :: Integer - a
zeroR, oneR :: a
It's particularly irritating having to use many of the Num methods and
therefore having to give them different names.
Suggestion:
2. how would I have found/fixed such an error in a more complex function
w/o assertions and w/o print statements?
Good questions
There was a proposal to put assertions into Std Haskell, which we
have implemented in GHC. (I'm not sure we've yet put that version out
though.) So
Not to reject assertions (they would be welcome), but I think that you
need something slightly different in a functional programming language.
Assertions in procedural languages typically define system state before
and after a particular function gets executed.
State assertions are less
To the newcomer who is not part of the FP academic community, this all
makes life sort of difficult. These differences seem larger than the
differences among C compilers and are MUCH larger than the differences
among Java compilers. I have been trying to learn Haskell and have been
Yes, GHC does some CSE stuff, but not very much. I don't think it has a large
performance impact, but (as luck would have it) but I plan to work on it a bit
in the newt few months.
My advice would be: write clear code, and let the compiler do the
CSE. If it doesn't, complain to the compiler
Greencard allows Haskell to call C (or Corba). Is there a way to give C
code access to Haskell functions?
GHC does not yet allow this, but we are working hard on H/Direct,
a successor to Greencard, that will. It'll also allow you to
seal up Haskell programs inside COM objects. Timescale: a
rigid and I belong to the small legion of amateurs who implemented their
own math. domain system, Rings, Fields, Modules, etc. This apparently
has no chance to be included into the Haskell standard, nobody cares.
Standards develop because people who care about particular aspects
of them push
If you have a statement like:
result= a || b || c
does Haskell guarantee that a gets evaluated before b?
If it does then I only have to protect against pattern match failure in
one place, a.
Yes; if a is true, b and c won't be evaluated. That's part of
the defn of ||
Simon
I have a base class,Organization, with name and address functions.
I want classes Buyer and Seller from Organization.
Now if I want to create an 2 instances of Seller
data Yahoo = Yahoo
instance Organization Yahoo where
name _= "Yahoo"
addreess = ...
data DoubleClick=
data Weirder a b = Weirdest a b
class Weird c where
f1 :: c - c
f2 :: Weirder a b - c - Weirder a b
f3 :: Weirder a c - Weirder c a
f4 :: c - c - Bool
instance Weird (d,e) where
f1 (x,y) = (x,y)
f2 w (x,y) = Weirdest x y
f3 (Weirdest x y) = Weirdest y x
Alex,
If I were you I'd dispense with "deriving(Read,Show)" in module Publisher,
and add an explicit instance for Read/Show on Publisher in PublisherDB.
That would solve your circularity problem.
Haskell does permit mutually recursive modules, but Hugs does not support
them, and GHC requires
Alastair Reid has been very quiet, so I'll pipe up for him.
Here's a reasonable design for exceptions in Haskell:
* A value of Haskell type T can be
EITHER one of the values we know and love
(bottom, or constructor, or function,
depending on T),
I was keeping quiet myself, because I am planning to write
a paper touching on this topic. But the cat seems to be
mostly out of the bag now, so I might as well pipe up.
I'm glad you did. That's a neat idea. I'm familiar
with the NDSet idea -- that's in the Hughes/O'Donnell
paper that
Just to reiterate. I strongly urge you to ensure consistent exception
behavior. As a matter of course, two different compiles should not result
in two different programs.
One of the wonderful things about functional languages is that they
do not prescribe the order of evaluation. To
I thought about this problem some more, and I have realized that the
problem of nondeterminacy for Haskell exceptions would in fact be
considerably worse that I had previously considered. The trouble is
that in the general case the problem is not just that the choice of
which exception is
Alex,
main = do input - getContents
putStr $ addTwo $ makeLines input
addTwo lines = ask1++(ask2 (Strict x)) ++ (result (Strict y))
where x:y:xs = map read lines
ask1 = "Enter an Integer: "
ask2 _ = "Enter another Integer: "
I just reread Dima's answer to my query about the database access in
particular and am confused. Dima says that he can't allow queries
outside the IOMonad because he has to worry about freeing memory (query
output).
However, Haskell/Com (built on top of Greencard?) seems to be able to
The paper says:
"We are working on a distributed implementation of Concurrent Haskell.
Once nice property of MVars is that they seem relatively easy to implement
in a distributed setting..."
I assume that they are not referring to GPH here.
(I was surprised that at this statement given
The ghc compiler complains about 2 type errors in the following code:
data SearchResult a = Found a | Fail
class (Eq key, Ord key) = Dictionary dict key dat where
delete :: key - dict - dict
search :: key - dict - (key,SearchResult dat,dict)
searchList :: [key] -
Actually I think you would be better off with a class like
this:
class (Eq key, Ord key) = Dictionary dict key where
delete :: key - dict dat - dict dat
search :: key - dict dat - (key, SearchResult dat, dict dat)
searchList :: [key] - dict dat -
| class (Eq key, Ord key) = Dictionary dict key dat where
|delete :: key - dict - dict
| ...
| the first error:
|
| Class type variable `dat' does not appear in method signature
| delete :: key - dict - dict
|
| Why does ghc expect that I use all of the type
|5. In the signature of a class operation, every constraint must
| mention at least one type variable that is not a class type
| variable. Thus:
...
|class C a where
| op :: Eq a = (a,b) - (a,b)
|
| is not OK because the constraint (Eq a)
Folks
This message is to update you on the state of play so far
as Standard Haskell is concerned. I'm circulating to three
Haskell-related mailing lists; in future I'll mail only
the "haskell" list, so pls subscribe to it if you want to
see anything more.
You may remember that John Hughes has
That's basically newtype with the data constructor omitted (I would
prefer data to record). Unfortunately, this seems to be incompatible
with the class system. (There was a long discussion on the Standard
Haskell discussion list, unfortunately the entry vanished).
No, it just moved over to
etc... all seem to be things that are waiting 'till Haskell 2. My
point was that _something_ should be in Standard Haskell. The features
you mention are likely to help when writing a better network library,
but let's not get distracted from the option of including something
straightforward
More generally, regardless of the standards process, it feels like the
GHC, Hugs define the de facto Haskell standard (it doesn't look like HBC
is still in progress but I could be wrong). As such, it seems tough to
write libraries right now as the upcoming GHC/Hugs release will contain
read :: Read a = String - a
read s = let [(r,s')] = reads s in r
This *won't compile* if you don't treat the let binding definition
monomorphicly. Without monomorphism, the types of r and s' are
r :: Read a = a
s' :: Read a = String
This leads to an ambiguity error for s'.
But if there are too many things missing, no one will use Standard
Haskell - it already seems as if most of the people on this list are
going to go straight to Haskell 2, which would mean that Standard
Haskell might only be used for teaching.
Indeed, I do expect that most of the people on
Olaf suggests
Hence I suggest that part (b) of rule 1 of the MR should
be deleted, i.e. simple
pattern bindings are just treated as function bindings. As I have said in a
previous email, the recomputation issue could be handled by warnings from the
compiler.
That would indeed not fall
Simon L Peyton Jones wrote:
So far as GHC is concerned, I wrote on this list a month ago:
"More specifically, I plan to continue beavering away on GHC.
GHC is public domain software, and Microsoft are happy for it to
remain so, source code and all. If anything, I'll have quite
I'm going to ask a very stupid question.
Why on earth is len computed twice in this example? I really don't
understand this!
I have to confess that I mischievously hoped that someone
would say this: it demonstates the point nicely that
lifting the monomorphism restriction would cause
I would like to avoid using show all the time for printing strings e.g.
val = "the sum of 2 and 2 is "++(show $ 2 + 2)++" whenever."
I would prefer to type something like:
val = "the sum of 2 and 2 is "./(2+2)./" whenever."
-- i can' find a better haskell compatible operator
Let
I think the way that Hugs 1.3c handles it would meet your goals. All that
it requires is a strict extension to the syntax for patterns to allow type
annotations. These can be useful in their own right, but also can be
applied
to problems like the one that you gave:
f :: [a] - a - [a]
I cannot find there the subject. Could you citate?
Sorry, it turns out I missed your point entirely.
class (Ring r,AddGroup (m r)) = RightModule m r where
cMul :: m r - r - m r
So here, m :: *-*
What you really want is to say
instance Ring r = RightModule (\t-t) r where
class (Ring r,AddGroup (m r)) = RightModule m r
where
cMul :: m r - r - m r
-- "vector" (m r) multiplied by "coefficient" r'
Haskell rejects this (m r) in the context. Could Haskell-2 allow it?
Yes. See
In any case, I hope that Simon will follow his urge to get Standard
Haskell done with Real Soon Now, even if there is no overwhelming
consensus on certain issues, so that we can then concentrate on Haskell
2.
That's just what I intend to do. I don't see Std Haskell as a big
deal, but even
I think all this discussion about numerics in Haskell is great. I'm convinced
that designing good libraries is a major creative act, not just an add-on to a
language; and that the existence of good libraries has a big effect on how much
use a language gets. ('Good' means both having a
Yes, I think it's a fine idea to loosen up the syntax and allow import and
infix anywhere. But could someone clarify what the intent is with regards to
the scoping of liberally sprinkled imports/infixes?
I've added a clarification; my intent was that all ttimport/tt and tt
fixity/tt
This is a summary of all the outstanding issues I'm aware of for Verison 1.2.
If there are others I've omitted, let me know.
Glasgow have the token for all files except the Prelude source files
themselves, which Joe has the token for.
There are actions on
Paul (check proposed syntax
This one is a straightforward parser bug. The fix is quite easy,
but I can't see a workaround (other than getting source and doing the fix).
I guess the workaround is to leave out the annotation.
So I'm afraid it's just "fixed in the next release".
Incidentally, we're planning to make fairly
| If a new symbol is added, (apparently) no test is made to see if this
| causes a clash with existing symbols in higher-level modules.
|
| Also, moving a function from one module to another sometimes confuses
| the recomp system, when it's looking for it in the "old" place: eg:
Both of these
| I need some expert help on a program of mine. The program benchmarks
| several implementations of functional priority queues. Basically, it
| evaluates different expressions using different implementations of
| priority queues: binary heaps, Braun heaps, pairing heap, leftist heaps
| etc. I
| a never ending story: the Haskell Library and its constituents.
| `group' and `groupBy' did not make into the List library:
... and a bunch of others. I've fixed it in our upcoming source release.
Thanks for reporting this.
Simon
| I couldn't fix. But I played around with it, I found a small little
| script which reproduces it very well:
|
| type state = ([Int] Bool)
...
| panic! (the `impossible' happened):
| tlist
This bit me some while ago, so don't be embarassed about writing an
incorrect program!
Anyway,
1 - 100 of 176 matches
Mail list logo