John Hughes mentioned a deficiency of Haskell:
OK, so it's not the exponential of a CCC --- but
Haskell's tuples aren't the product either, and I note the proposal to
change that has fallen by the wayside.
and Phil Wadler urged to either lift BOTH products and functions,
or none of
Mark's suggestion for declaring the selector functions
within the datatype already exists in the language OPAL
(developed at TU Berlin). Besides selectors, you also get the
test predicates there.
Example: the declaration
DATA list == empty
:: (first:char, rest:
%But there are no types `(\x-x)' or `(\x-())' in Haskell.
%So the expression does not typecheck (at least that is
%my understanding of how it works).
%You might think that
% type I x = x
%and then using I alone would give you the type `(\x-x)',
%but partial
% You can apply any constructor e1 with a kind (k1 - k2), be it a
% variable, constant, or application, to any other constructor e2 of
% kind k1, forming a (possibly partial) application (e1 e2), as described
% on pages 31--32 of the (draft) report. As you say, this permits currying.
Yes, but
Suggestion:
add another form of statement for monad expressions:
stmts - ...
if exp
which is defined for MonadZero as follows:
do {if exp ; stmts} = if exp then do {stmts}
else zero
Based on this, one can define list comprehensions by
Joe,
Your definition of divFloorRem (and probably divCeilingRem as well)
doesn't seem to be quite right, because I end up with
(-4) `mod` (-3) == -4
because divTruncateRem (-4) (-3) is (1,-1).
The condition in the "if" should be something like
signum r == -signum d
rather than
I like John's idea with a class Strict, but I think there should also be
a second class Eval for computing whnf's:
class Strict a where
strict :: a - Bool
class Eval a where
eval :: a - Bool
Example: for Complex we get:
instance Strict a = Strict
Lennart mentioned this recently; the situation is as follows:
1. semi-unification (the general one) is undecidable
2. it is semi-decidable
3. the semi-decision procedure for semi-unification can be augmented
with heuristics that finds almost all cases in which it fails
(this is a kind of
Another strange thing about n+k patterns.
Its definition uses = , but = is not part of the class Num.
Does that mean that n+k patterns have to be instances of class Real?
One could leave it class Num, if the translation were expressed
in terms of "signum" rather than "=".
Question:
Can one
Phil's (Robin Milner's ??) example typechecks in ML.
%Incidentally, there has been a lot of work done on Milner's type
%system extended to allow polymorphic recursion; this system is
%sometimes called ML+. One motivating example -- which I first
%heard from Milner -- is:
%
%
Parsing Haskell list comprehensions deterministically ((LA)LR) is currently very
hard, since both "pat - exp" (or also "pat gd - exp", as suggested by Thomas)
and "exp" are allowed as qualifiers in a list comprehension. Patterns and
expressions can look very much alike. Could one
11 matches
Mail list logo