Joe writes:
I forgot to mention that I did try it with hbc:
... transcript of working program omitted ...
That's surprising! I'd be interested to know if `maptry' works,
since in that case it makes sense to run the program, as well
as type it. Cheers, -- P
In the Report 1.2 on page 98, in the definition of rationalToRealFloat, the
line beginning "where y" has unbalanced parentheses.
-Norman
---
Messing about with signature files fills a much-needed gap in the working
day.
I'm puzzled by a detail in the Report, which seems to contradict itself.
On page 13 it says:
The special form -e denotes prefix negation, [...] and is simply
syntax for negate (e), where negate is as defined in the standard
prelude.
The standard prelude defines negate a
Joe writes:
| Phil Writes:
|
| | The closest one can come is
| |
| |class G a where
| |g :: a -> Bool
| |g x = g [x]
| |
| |instance G Int
| |instance G [Int]
| |instance G [[Int]]
| |...
| |
| |which requires an infini
Tobias Nipkow and Simon Finn were both kind enough to point
out that my Trie example was wrong, in that it is perfectly
typeable in ML (or Haskell).
Tries are like Mark's datatype X. The untypeable version is like
Mark's datatype Y.
data Try a = Atom a | List (Try [a])
mapt
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:
%
%
| From: [EMAIL PROTECTED]
|
| I'm puzzled by a detail in the Report, which seems to contradict itself.
|
| On page 13 it says:
|
| The special form -e denotes prefix negation, [...] and is simply
| syntax for negate (e), where negate is as defined in the standard
| prelude
TRANSLATING MONOMORPHISM TO POLYMORPHISM, AND POLYMORPHIC RECURSION
(An addition to Konstantin and Mark's remarks.)
The great thing about Milner's polymorphism is that it came for free:
adding a function declaration does not make a function more efficient.
This is true for the usual implementati
I haven't tried it in Haskell,
but it should either be illegal or cause the type-checker to enter an
infinite loop. (Hmmm! Maybe someone should try it ...)
Yes, after all, everyone knows that a language is defined by its
implementation... (:-)
-Paul
Phil writes:
| Joe writes:
|
| | Phil Writes:
| |
| | | The closest one can come is
| | |
| | |class G a where
| | |g :: a -> Bool
| | |g x = g [x]
| | |
| | |instance G Int
| | |instance G [Int]
| | |instance G [[Int]]
| | |
Phil Writes:
|However, for the extended type system that allows polymorphism in
|recursion, this is no longer the case -- my thanks to Lennart
|Augustsson for pointing this out. The counter-example (similar
|to one of Mark's) is:
|
|g :: a -> Bool
|g x = g [x]
|
|This function
11 matches
Mail list logo