typekind inference

1996-03-11 Thread smk
% 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

typekind inference

1996-03-09 Thread smk
%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

Haskell 1.3, monad expressions

1996-03-08 Thread smk
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

Re: Haskell 1.3 (lifted vs unlifted)

1995-09-12 Thread smk
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

Defining datatype selector functions

1993-11-19 Thread smk
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:

Re: re. 1.3 cleanup: patterns in list comprehensions

1993-10-15 Thread smk
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

Polymorphic recursive calls possible via type classes

1993-07-28 Thread smk
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: % %

Re: Successor patterns in bindings and n+k patterns

1993-05-19 Thread smk
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

type inference and semi-unification

1993-02-26 Thread smk
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

Strictness in Haskell

1992-04-08 Thread smk
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

Division, remainder, and rounding functions

1992-02-17 Thread smk
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