Re: [Haskell] Call for Contributions - HC&A Report (November 2006 edition)

2006-10-14 Thread Ralf Hinze
Kurze Story zu BPL? ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

[Haskell] Call for participation: Workshop on Generic Programming 2006

2006-08-14 Thread Ralf Hinze
t half-baked, ==> exciting, new stuff) please drop me a short note. Slots will be ==> reserved on a first-come-first-serve basis. Looking forward to seeing you in Portland, Ralf Hinze

[Haskell] 2nd CFP: Workshop on Generic Programming 2006

2006-05-10 Thread Ralf Hinze
submission:3rd June 2006 Notification of acceptance:24th June 2006 Final submission due: 8th July 2006 Workshop: 16th September 2006 Authors should submit papers, in postscript or PDF format, formatted for A4 paper, to Ralf Hinze ([EMAIL PROTECTED]) by 3rd June

[Haskell] CFP: Workshop on Generic Programming 2006

2006-02-16 Thread Ralf Hinze
acceptance:24th June 2006 Final submission due: 8th July 2006 Workshop: 16th September 2006 Authors should submit papers, in postscript or PDF format, formatted for A4 paper, to Ralf Hinze ([EMAIL PROTECTED]) by 3rd June 2006. The length should be restricted to 12

[Haskell] ANNOUNCE: Frown - an LALR(k) Parser Generator for Haskell (version 0.6, beta)

2005-11-01 Thread Ralf Hinze
I'm pleased to announce the first release of Frown (version 0.6, andromeda release), an LALR(k) Parser Generator for Haskell 98. This is a beta quality release. Frown's salient features are: o The generated parsers are time and space efficient. On the downside, the parsers are quite large. o

Re: [Haskell] translation of "kind"

2005-06-20 Thread Ralf Hinze
Am Montag, 20. Juni 2005 13:45 schrieb Christian Maeder: > you could also say "ein Typkonstruktor mit Kind ..." (and leave the > gender open) Hier ist er: , _/^\_ < >

Re: [Haskell] translation of "kind"

2005-06-20 Thread Ralf Hinze
Am Montag, 20. Juni 2005 12:06 schrieb Christian Maeder: > Even Peter Thiemann in "Grundlagen der funktionalen Programmierung" > (1994) did not translate "Kind", although he used "geschönfinkelt" for > "curry" (honoring logicians Schönfinkel and Curry) > > I'ld prefer "der Kind" (and avoid situtat

Re: [Haskell] translation of "kind"

2005-06-18 Thread Ralf Hinze
> can anybody tell me what the German translation of the word "kind" as used in > type theory and especially in Haskell is? Wie wär's mit `Sorte', Ralf ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: 'Forest inversion'?

2003-08-20 Thread Ralf Hinze
Dear Marnix, your transformation can be rewritten as the composition of three functions: one that converts the forest into a binary tree (this is based on the natural correspondence between forests and binary trees (*), see Knuth TAOCP, Vol 1), one that mirrors a binary tree swapping left and righ

Re: Language extension proposal

2003-06-30 Thread Ralf Hinze
> If we could only figure out a good syntax for > (optional) type application, it would deal rather nicely with many of > these cases. Trouble is, '<..>' gets confused with comparisons. And > when there are multiple foralls, it's not obvious what order to supply > the type parameters. What about

Re: Typesafe MRef with a regular monad

2003-06-16 Thread Ralf Hinze
> Yes, that's a good point. So there are really three issues: > a) single-threaded-ness > b) making sure you look up in the right map > c) making sure the thing you find has the right type > > Even if you have typed keys, (Key a), then if you look them up in the > wrong map

Re: Typesafe MRef's

2003-06-13 Thread Ralf Hinze
Am Freitag, 13. Juni 2003 17:12 schrieb George Russell: > Keith wrote (snipped) > > > But George Russell's implementation relied on looking up something in > > one map with a key obtained from another map. I thought type-safe > > MRefs should disallow this. > > However if you disallow lookup up

Re: Typesafe MRef with a regular monad

2003-06-06 Thread Ralf Hinze
Am Freitag, 6. Juni 2003 16:09 schrieb Simon Peyton-Jones: > You can't overwrite an entry with a value of a different type, because > the keys are typed! Any more than you can overwrite an IORef with a > value of a different type. > S Why is that? Ok, here is my second implementation. It uses the

Re: Typesafe MRef with a regular monad

2003-06-06 Thread Ralf Hinze
Am Freitag, 6. Juni 2003 15:47 schrieb Simon Peyton-Jones: > Yes, one *could* use dynamic types. But the check would always succeed! Why is that? If I overwrite an entry with a value of a different type, then the check fails. I am certainly missing something ... Cheers, Ralf ___

Re: Typesafe MRef with a regular monad

2003-06-06 Thread Ralf Hinze
Am Freitag, 6. Juni 2003 15:23 schrieb Simon Peyton-Jones: > Oh bother, I forgot to add that you can of course insert a new value > with an old key (suitably typed) and have it overwrite. Else, as you > say, there would not be much point. > > Maybe it'd be better to have a separate key-constructio

Re: Typesafe MRef with a regular monad

2003-06-06 Thread Ralf Hinze
> A more concrete way to formulate a problem that I believe to be > equivalent is this. Implement the following interface > >module TypedFM where > data FM k -- Abstract; finite map indexed by keys > of type k > data Key k a-- Abstract; a key of type k, in

Re: ANN: H98 FFI Addendum 1.0, Release Candidate 10

2003-06-06 Thread Ralf Hinze
> On Fri, Jun 06, 2003 at 09:32:18AM +0100, Simon Peyton-Jones wrote: > > Yes! Yes! Advice is good! > > OK, how about "avoid unsafePerformIO like the plague"? > > Why is it the business of the FFI spec to document unsafe uses of > unsafePerformIO? I'd like to second Ross here. Advice is good at

Re: forall quantifier

2003-06-06 Thread Ralf Hinze
Am Freitag, 6. Juni 2003 09:15 schrieb Simon Peyton-Jones: > I forget whether I've aired this on the list, but I'm seriously thinking > that we should change 'forall' to 'exists' in existential data constructors > like this one. One has to explain 'forall' every time. But we'd lose a > keyword. O

Re: Collecting values from Functors?

2003-06-05 Thread Ralf Hinze
> Rather than using fmap, why not use gmap in GHC. > Using an appropriate generic traversal scheme, > say listify, all the code you write is the > following expression: > > listify (const True) mytree :: [Int] > > if you are looking for all the Ints in > mytree = Fork (Leaf 42) (Fork (Leaf 88) (Lea

Re: Random Permutations

2003-03-06 Thread Ralf Hinze
> Is there a library routine for random permutations? > > I didn't find any and did a quick hack, which works fine for my > application (length of list < 100), but what would be a more > elegant way? > > > permute :: StdGen -> [a] -> [a] > > permute gen [] = [] > > permute gen xs = (head tl) : pe

HR, App. D.5, minor correction

2002-08-04 Thread Ralf Hinze
Hi Simon, here is a minor correction to the May version of the HR. In appendix D.5 there is a table with an example for derived instances: for reasons of consistency the line showsPrec d (Leaf m) = showParen (d >= 10) showStr should be replaced by showsPrec d (Leaf m) = showPar

Re: [ADMINISTRIVIA]: Change list submission policy please?

2002-06-27 Thread Ralf Hinze
> The haskell mailing list is getting an increasing amount of > spam, viruses, and virus warnings. Would it be possible > to change the list policy to only allow submissions from > subscribed members? Please? I'd like to second this. The amount of spam etc is becoming more and more annoying ...

WAAAPL 2002, final call for papers

2002-05-20 Thread Ralf Hinze
Authors should submit papers of at most 12 pages, in postscript format, formatted for A4 paper, to Ralf Hinze ([EMAIL PROTECTED]) or Chris Okasaki ([EMAIL PROTECTED]) by 3rd June 2002. The proceedings will be published by ACM and will appear in the ACM digital library. Prog

Syntax highlighting for KDE's Kate

2002-05-03 Thread Ralf Hinze
Dear KDE users, I've hacked syntax highlighting files for Kate, KDE's editor. Feel free to use or to modify them. http://www.informatik.uni-bonn.de/~ralf/software.html#syntax Cheers, Ralf ___ Haskell mailing list [EMAIL PROTECTED] http://www.h

CFP: JFP Special Issue on Functional Pearls

2002-05-03 Thread Ralf Hinze
eptance or rejection by 30 November 2002. Revised versions are due on 31 January 2003. For other submission details, please consult an issue of the Journal of Functional Programming or see the Journal's web page at http://www.dcs.gla.ac.uk/jfp/. Guest Editor -------- Ralf Hinze Institut für

Haskell Report: minor error

2002-04-12 Thread Ralf Hinze
Hi Simon, minor error in the Report: Figure 5 that displays the hierarchy of Haskell classes defined in the Prelude also includes the MonadPlus class, which, however, is defined in Monad. Cheers, Ralf ___ Haskell mailing list [EMAIL PROTECTED] http://

Re: does this have a name (recusive datatypes)

2002-04-10 Thread Ralf Hinze
> Does this have a name: > > data S s a = Nil | S a (s (S s a)) I sometimes use the name `generalized rose tree' but that's certainly not standard. Chris Okasaki uses this data type, for instance, to implements priority queues with an efficient merge, see his book `Purely functional data structur

GHC 5.02.3, SuSE rpms

2002-04-09 Thread Ralf Hinze
I've uploaded SuSE 7.3 rpms for the patchlevel release of the Glasgow Haskell Compiler (GHC), version 5.02.3. http://www.informatik.uni-bonn.de/~ralf/ghc-5.02.3-1.src.rpm http://www.informatik.uni-bonn.de/~ralf/ghc-5.02.3-1.i386.rpm http://www.informatik.uni-bonn.de/~ralf/

WAAAPL 2002, preliminary announcement

2001-12-10 Thread Ralf Hinze
or Oct 8, 2002) Authors should submit papers of at most 12 pages, in postscript format, formatted for A4 paper, to Ralf Hinze ([EMAIL PROTECTED]) or Chris Okasaki ([EMAIL PROTECTED]) by 3rd June 2002. The accepted papers will be published as a University of Bonn technical report. Prog

Haskell workshop: 10-minute slots

2001-08-14 Thread Ralf Hinze
Folks, The Haskell Workshop in Firenze on 2nd September is now only a couple of weeks away. If you'd like to attend but haven't yet registered, please do so as soon as possible. For further details, see: http://music.dsi.unifi.it/pli01/registration/index.html The workshop programme is

2001 Haskell Workshop: call for participation

2001-07-22 Thread Ralf Hinze
papers, a number of slots for participants to make 10-minute informal presentations are available. To request such a slot, contact Ralf Hinze ([EMAIL PROTECTED]). 9.00 - 10.30: chaired by Ralf Hinze Functional Pearl: "Derivation of a Carry Lookahead Addition Circuit",

Re: Eq instance for (a,b,c,d,e) and upwards

2001-05-30 Thread Ralf Hinze
Henrik Nilsson wrote: > So, if, in the interest of being conservative, the stated minimal > bound cannot be "infinity", could it at least be a great deal > bigger than what reasonably would be used in *hand-written* > code? Say 15. An arbitrary choice, of course, but it is not > excessive from an

Re: Permutations of a list

2001-05-14 Thread Ralf Hinze
Andy Fugard wrote: > My main question is really what facilities of the language I should be > looking at to make this code more elegant! As you can see I currently know > only the basics of currying, and some list operations. Definitely list comprehensions! I digged out some old code: > module

2001 Haskell Workshop: final call for papers

2001-05-02 Thread Ralf Hinze
2001 Haskell Workshop: 2nd September 2001 Authors should submit papers in postscript format, formatted for A4 paper, to Ralf Hinze ([EMAIL PROTECTED]) by 1st June 2001. Use of the ENTCS style files is strongly recommended. The length should be restricted to the equivalent of 5000

2001 Haskell Workshop: 1st call for papers

2001-03-01 Thread Ralf Hinze
2001 Haskell Workshop: 2nd September 2001 Authors should submit papers of at most 12 pages, in postscript format, formatted for A4 paper, to Ralf Hinze ([EMAIL PROTECTED]) by 1st June 2001. The use of the ENTCS style files is strongly recommended. Application letters and functional

Re: Showing functions

2000-07-31 Thread Ralf Hinze
| Section 6.1.6 of the report says that "Functions are an instance of the | Show class but not | Read." How are functions meant to be shown? The standard prelude | 'specification' doesn't say anything about it. That's a typo. Section 6.3.3 says ``All Prelude types, except function types and IO t

Re: convex hull

2000-06-15 Thread Ralf Hinze
| I need a 'convex hull' implementation in Haskell. | Does anyone know where I can find one? Joern Dinkla has implemented several geometric algorithms in Haskell, see http://goethe.ira.uka.de/~dinkla/cglib.html Cheers, Ralf

Re: When is an occurrence an occurrence

2000-06-09 Thread Ralf Hinze
| Gentle Haskellers, | | Here's a Haskell98-typo question. | | Consider this program: | | module M where | | reverse xs = Prelude.reverse (tail xs) | | foo ys = M.reverse ys | | This is legal Haskell98. The call to Prelude.reverse and to M.reverse | must both be qualified,

Re: Haskell 98: partition; and take,drop,splitAt

2000-01-25 Thread Ralf Hinze
| Partition | | PROPOSAL: use the filter/filter defn of partition Agreed. | Take and drop I strongly vote for (A) because it _is_ sometimes useful. | splitAt | | PROPOSAL: use the take/drop defn of splitAt Agreed. Cheers, Ralf

re: The Haskell mailing list

1999-10-11 Thread Ralf Hinze
| I also agree with Simon that simply making this a moderated list is | not the solution. Perhaps splitting is best. How about | | haskell-info | haskell-talk | | where info carries *brief* announcements, requests for information | and responses to such requests, and talk carries anything and

Re: Fast Finite Maps w/ destructive update

1998-12-08 Thread Ralf Hinze
| I am trying to implement data compression code (lzw) and have been using a | home grown binary tree implementation which runs too slowly. | | I would prefer to use a fast/destructive finite map implementation... | Can anyone recommend one? What about tries? They are purely functional ;-) and f

Re: Stream of random comments continues

1998-12-04 Thread Ralf Hinze
| The discussion of random numbers in Haskell should perhaps | move elsewhere as it is quite restricted, but it shows one | problem with the functional approach to *practical* programming: | in *my opinion* our fascination by the Monadic Approach to | Universe and Everything, and the possibility

Re: Random comments

1998-12-03 Thread Ralf Hinze
| First: I had forgotten that what the Random module actually | gives you is [Integer], not [Int], but the same reasoning | applies. What's the range for the Integers? I guess Int is better suited. | Well, you naturally need functions that convert a list of | [Integer] to what you need. I'm not

Re: Random comments

1998-12-03 Thread Ralf Hinze
| > The stream-based approach has its problems if one requires random | > values of different types. If this is vital one automatically starts to | > use functions of type Seed -> (value, Seed). | I don't understand at all. Why would random values of different types | require that signature? Why

Re: Random comments

1998-12-03 Thread Ralf Hinze
| Could somebody - perhaps outside this list - provide a serious | example showing the *necessity* for RandomIO() - the Monadic, | "side-effect" version? In a pure functional language? Well, I'm not outside this list ;-). Honestly, there is no necessity for using the IO monad, it is just a matte

Addendum: randomIO

1998-12-02 Thread Ralf Hinze
I wrote ... > The following signature seems quite reasonable to me. > > type Seed = Int > getSeed :: IO Seed > setSeed :: Seed -> IO () > randomInt :: IO Int > randomInteger :: IO Integer > randomDouble :: IO Double I'm getting old ;-). Of course, `randomInteger' requires a

Re: Haskell 98: randomIO

1998-12-02 Thread Ralf Hinze
| I agree. In fact, I would be most happy with a function getRandom :: IO | Double that returns a random number between 0 and 1. Good point. When trying to develop a testbed for the library of sorting routines I found the library Random completely unusable. There are essentially two reasons: a) I

Re: Why I hate n+k

1998-11-30 Thread Ralf Hinze
Simon writes ... | Just to amuse you all, here's a quick Haskell 98 quiz: | | What do the following definitions do: | | 1 x + 1 = f x | | 2 (x + 1) = f 2 | | 3 (x + 1) * 2 = f x | | 4 (x + 1) 2 = g x | | | That's right! | | (1) partially defines (+). One could add m

Re: Reduction count as efficiency measure?

1998-11-25 Thread Ralf Hinze
| Is this true in practice? That is, are there programs which have | different asymptotic running times when compiled under ghc or hbc than | when running under Hugs? | | It would actually surprise me if there were; I'm having a hard time | imagining a realistic optimization that would do this.

RE: MonadZero (concluded)

1998-11-06 Thread Ralf Hinze
| Does this mean that code which relies on ++ and do notation with Maybe | will stop working? ++ is specialized to lists, I'm afraid. Ralf

Re: MonadZero (concluded)

1998-11-06 Thread Ralf Hinze
| class Monad m => MonadPlus m where | mzero :: m a | mplus :: m a -> m a -> m a | | Why is this here? It doesn't need to be in the prelude. Just | leave it for the user to define (and then the user may pick | better names, like Ringad, zero, and <+>). -- P Yes, nuke Mon

Re: Default Default

1998-11-05 Thread Ralf Hinze
| John Peterson writes | | Int is really not a nice | datatype and we shouldn't be allowing it to crop up unexpectedly. | | Yes, but if we believed that, we should use Integer, not Int, for | length. | | You are right, beginners may stub their toe on factorial. On the other | hand, with th

Re: mfail -> fail

1998-11-05 Thread Ralf Hinze
| Here's an even better idea: replace mfail with fail. | It is, after all, the fail of the IO monad! | | Option 4'': Monad ((>>=), return, fail) Unfortunately not, fail of IO fame has type IOError -> IO a and not String -> m a as Monad's new member. Here's my suggestion: o Mo

Haskell 98 libraries

1998-11-05 Thread Ralf Hinze
> Haskell 98 libraries > > * Make each module export all the relevant types and functions that the > Prelude defines, so that a programmer who does not import the Prelude > can get access to all the (say) list types and functions by saying > import List. This involves extra exports f

RE: MonadZero

1998-11-03 Thread Ralf Hinze
| I agree that this is an error that you would like the system to catch. | I disagree strongly with the suggestion that this is an error that you | should expect the *type system* to catch. | | Suppose that the original version of your nuclear reactor driver also | contained a definition: | |

Re: MonadZero

1998-11-03 Thread Ralf Hinze
| I want to make a different plea: keep the language design consistent! | Yes, the difference between f, g, h is a wart, but let's have one wart | repeated, rather than two different warts. I am not convinced. This argument could be reverted to support alternative 2. Haskell uses patterns in many

Re: MonadZero

1998-11-03 Thread Ralf Hinze
| > 1.Fix up the current version. | > use MonadZero for do expressions with *irrefutable* patterns | > (instead of *unfailable* patterns as now) | > 2.Nuke MonadZero altogether. | > add mfail :: m a to Monad instead I opt for 2. It's certainly true that the second choice breaks exist

Re: topdelcs / decls

1998-10-23 Thread Ralf Hinze
| just a thought .. why is it that some declarations | (data, type, newtype, class, instance) are only allowed | at the (module) top level? in some cases i'd like to have | more locality, and less namespace pollution. Let me add: local declaration might also increase the expressibility of Haskell

RE: topdelcs / decls

1998-10-23 Thread Ralf Hinze
| Your thought would destroy equational reasoning! For example you | would be able to define different equalties on the same data | structure. So Red==Black could be False in one place and True | in another place. Does that make any sense? Of course, it does. You neglect the fact that definitio

RE: Haskell 98

1998-10-22 Thread Ralf Hinze
| > So '---' is not a valid operator symbol, but '-->' is. A line | > of hyphens of | > any length introduces a comment. | > | > | > ] I do not understand the example: if every lexeme consisting of two | > ] or more hyphens begins a comment, `-->' begins a comment! | | No, '-->' does not consi

Re: Haskell 98

1998-10-16 Thread Ralf Hinze
| Comments to me directly ([EMAIL PROTECTED]), or the Haskell mailing | list. Here we are ... (comments are marked with `]') Typing of do expressions [...] 2. Nuke MonadZero altogether. Instead, augment the Monad c

Re: Instance contexts.

1998-07-28 Thread Ralf Hinze
| > I'd like to support Alex here: it is absolutely necessary to relax | > condition 10 of SPJ's list. | | http://www.dcs.gla.ac.uk/~simonpj/multi-param.html | | > Idioms like the one above (`Ord (s a)' or | > `Show (s a)') arise too often and are completely natural. | | One of the great

Re: Scoped typed variables.

1998-07-22 Thread Ralf Hinze
| This sounds great, but it could break old code, of course. This would have a | different type under Ralf's proposal than Haskell 1.4: | (id :: a -> a, id :: a -> a) | However, I think something like it is the only sane way to go. Whatever we do, type | variables should scope consistently

Re: Scoped typed variables.

1998-07-22 Thread Ralf Hinze
| > > Just as a sanity check, following an augmented proposal "A" where we can also | > > annotate the return type as well, consider these: | > > | > > f :: a -> (a -> a) -> a | > > f x = \g -> (g :: a -> a) x | > > | > > f (x :: a) :: (a -> a) -> a = \g -> (g :: a -> a) x | > > | > >

Re: avoiding repeated use of show

1998-07-22 Thread Ralf Hinze
| I would be more inclined to use <<. The reason is typing efficiency. | '&' is awkward to be typing frequently immediately after '"'. I do not type that fast ;-). | You are acutally using (.) below. Is there a way to do that (via | Fran like lifting?)? I'm afraid no. | > > instance Stringab

Re: avoiding repeated use of show

1998-07-22 Thread Ralf Hinze
> 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 opera

Re: Monomorphism

1998-07-21 Thread Ralf Hinze
One of the original motivations for questioning the DMR steems from the fact that function definitions expressed as simple pattern bindings are sometimes rejected. The definition sum as = foldr (+) 0 as is accepted but sum = foldr (+) 0 is not which is admittingly irritating. C

Re: Instance contexts.

1998-07-13 Thread Ralf Hinze
> Ralf: can you supply other examples? Sure thing. A while ago I implemented several popular priority queue structures. Being tired of proving them correct I worked out a simple method of checking their correctness (or rather: the absence of errors) at run-time. The idea is to cross-check a new i

Re: type synonyms

1998-07-09 Thread Ralf Hinze
> data / type / newtype: > > i'd like to have these choices > > type T1 = record C1 .. | C2 .. > type T2 = T1 > type T3 = new T2 > > with T2 identical to T1, > and T3 being an identical copy of T2 (but different from T2) > inheriting all its constructors and operations. That's basically newty

Re: monad transformers and lift

1998-07-09 Thread Ralf Hinze
> Suppose I have the following class of monad transformers: > > class (Monad m, Monad (t m)) => MonadT t m where > lift :: m a -> t m a > > and several instances of the class: > > instance MonadT MT1 where ... > instance MonadT MT2 where ... > . . . > instance MonadT MTn where ... > > I obta

Re: multi param type classes

1998-07-08 Thread Ralf Hinze
> you want to lift this restriction: > > > The type of each class operation > > must mention all of the class type variables. > > how would you resolve ambiguities? > probably by requiring an explicit type signature > at the point of usage. No longer ;-). I find SPJ's summary on http://www.dc

Re: MPTC: class type variables

1998-07-08 Thread Ralf Hinze
> I saw Mark yesterday, and have made quite a few changes > as a result. I've tried to address your points, and those > made by others, but you'll have to judge how successfully! > > http://www.dcs.gla.ac.uk/~simonpj/multi-param.html > > Anyway, you might want to take another look. Sigh.

Re: Structure of monads in an abstract form?

1998-07-06 Thread Ralf Hinze
> I think you can "encode", or "mimick" every monad by the following type, > which is the monad of continuations: > > type M a = (a -> Action) -> Action > [...] > Unfortunately the Haskell type system is often too restrictive to encode > the wanted features. I have for example no idea how to

Re: type errors

1998-07-01 Thread Ralf Hinze
> Ok, I did not reconize this solution, it seems to me the (nearly) proper one. > But why not write: > >class => Dictionary dict where >delete :: (Eq key, Ord key) => key -> dict key dat -> dict key dat >... > > So one could avoid multiparamter classes at all. The two types k

Re: what is leaking?

1998-06-26 Thread Ralf Hinze
> When I try to execute this: > > > result = foldl (+) 0 [1..10] > > main = putStr $show (result `mod` 10) > > Hugs gives: ERROR: Garbage collection fails to reclaim sufficient space > GHC gives: Stack space overflow: current size 262152 bytes. > > Why would this have an error? The list sh

Re: Syntax dubion

1998-06-26 Thread Ralf Hinze
> if I write > > (a &&& b) x = a x && b x > > hugs accepts it, but ghc rejects it. I think that ghc is correct in > that the report only allows > > funlhs > -> >var apat {apat } > | >pati+1 varop(a,i) pati+1 > | >

Re: Teaching Haskell

1998-06-24 Thread Ralf Hinze
> CUP just released my book on "Purely Functional Data Structures". I just got hold of a copy. My impression: it is *really* worth reading. Ralf

Re: laws for MonadPlus?

1998-06-23 Thread Ralf Hinze
> what laws should hold for the (++) operation? Associativity and leftward distributivity are missing in the Report: (m ++ n) ++ o = m ++ (n ++ o) (m ++ n) >>= k = (m >>= k) | (n >>= k) On the other hand right distributivity does not hold in general. Conversely, the report

Re: FW: Exceptions are too return values!

1998-06-10 Thread Ralf Hinze
> I'd be interested to know what people think of this. > Here's a reasonable design for exceptions in Haskell: > ... > The neat thing about this is that the exceptions can > be *raised* in arbitrary purely functional code, without > violating referential transparency. The question of > which exc

Re: How to do Exceptions in Haskell (I think)

1998-06-04 Thread Ralf Hinze
> would it be a solution if you defined > > > data RetVal b a = Result a | Exception b > > in this case you could say > > > instance Monad (RetVal b) where > > return = Result > > Result x >>= f = f x > > Exception x >>= f = Exception x Incidentally, the predefined data type `Either' ma

Inference of instance declarations

1998-06-04 Thread Ralf Hinze
[This is a repost of an email I sent yesterday to `[EMAIL PROTECTED]'. For some reasons it did not come through. Either the moderator didn't like it or something is wrong with `haskell.org'. I tacitly assume the latter ;-). RH] [This email is mainly directed to the type and class system experts a

Re: quicksort and compiler optimization

1998-05-11 Thread Ralf Hinze
> Ok, clearly I was wrong about list concatenation, but I think I have now > figured out what was bothering me about Ralf's objection to the of ++. > > The argument that the use of ++ in qsort means too many traversals of the > list makes sense if ++ is strict (or you are using a non-lazy languag

Re: quicksort and compiler optimization

1998-05-08 Thread Ralf Hinze
> > > o it uses (++) to catenate the results of the recursive calls (note that > > > (++) takes time proportional to the length of its first argument). > > This also seems wierd. Concatenation is a frequent enough operation on > lists. Give such frequency, shouldn't the internal representatio

Re: quicksort and compiler optimization

1998-05-07 Thread Ralf Hinze
> Also it misses a few useful optimizations, such as median-of-three > partitioning. For descriptions of that and other ways to speed > up quicksort, see Sedgewicks "Algorithms in C" or "Algorithms in Pascal" > (I'm afraid Sedgewick didn't write an "Algorithms in Haskell" ;-). Median of three mo

Re: quicksort and compiler optimization

1998-05-07 Thread Ralf Hinze
> The tutorial defines: > > quicksort []= [] > quicksort (x:xs) = quicksort [y | y <- xs, yy>=x] > > This code strikes me as twice as slow as it could be because it seems to > requires two loops through the list on each recursive call. I guess it is only included in the tutorial in orde

Re: Threading Monads

1998-05-05 Thread Ralf Hinze
Graeme Moss writes > A question born out only of curiosity: > > Can anyone provide a definition of `thread' equivalent to this: > > > thread :: Monad m => [a -> m a] -> a -> m a > > thread [] a = return a > > thread (k:ks) a = k a >>= thread ks > > not using pattern matching (eg. using map

Re: haskell and exceptions

1998-01-29 Thread Ralf Hinze
Matthias Fischmann writes ... > I am now trying to learn Haskell for half a week and I like it a lot. > But I still did not find out too much about exception handling. Is it > possible that there is no ml-like mechanism with `raise' and `handle' > built in? Yes, I know about types like > > data

RE: insert sort with foldr

1998-01-12 Thread Ralf Hinze
> Yes, you are right, but that is the same function that I wrote in my > original message as 'newfoldr': > > newFoldr::(a->[a]->b->b)->b->[a]->b > newFoldr f c [] = c > newFoldr f c (x:xs) = f x xs (newFoldr f c xs) Well, I merely wanted to throw in the technical term. > I asked if that func

Re: insert sort with foldr

1998-01-12 Thread Ralf Hinze
Dear Jose, > I am trying to define common functions with recursive combinators > avoiding recursive definitions. I have found some problems with > the "insert" function that inserts an element x in an ordered list xs > This function is used when you define insertion sort as "foldr insert []" > >

Re: Sets as monads?

1997-11-28 Thread Ralf Hinze
> 1) Is it possible for a set to define a monad? Monads require true polymorphism. Hence the answer is no (from Haskell's perspective) if there are constrains on the element type (like Eq oder Ord). > 2) Does anyone know if it's possible to define an instance of monads >for sets in Haskell?

Re: Sorting and Type Classes

1997-10-17 Thread Ralf Hinze
[Benchmark suckers and implementors only] Chris writes ... > While experimenting with the sorting algorithms that have been posted here > recently I discovered that the benchmarks were being quite seriously distorted > by the use of type classes to implement some of them. Even the use of `Ord a

Re: Filehandeling with Haskell

1997-10-13 Thread Ralf Hinze
Hi Roland, > However my question is: How to do a little bit more complex IO: > Assume I have a file called 'filenames.txt' that contains a > list of filenames eg: > file1.txt > file2.txt > file3.txt > > I now want to write a simple program, that prints out the first > line of every file me

Re: heap sort or the wonder of abstraction

1997-10-09 Thread Ralf Hinze
Lennart wrote > Well, I'm a sucker for a benchmark so I ran all of these with hbc. > I also added the smooth merge sort that comes with hbc. > ... > As you can see there is no clear winner, but I see no real reason > to change the sort that comes with hbc to something else at this > moment. You

Splay sort

1997-10-09 Thread Ralf Hinze
> Ralf, could I > ask you to run my code below through your experiments (I don't have > easy access to anything but hugs at the moment)? Here we are ... 5 | < |<= | > |>= |== | 1 2* | 1..100* | 2 1* | 100..1* | 1 2 2 1* |rando

Re: heap sort or the wonder of abstraction

1997-10-08 Thread Ralf Hinze
e complete binary trees in decreasing size. The size of the trees corresponds to the binary decomposition of the input length. The random-number generator which is stolen from the `hbc'-library. > random2Ints :: Int -> Int -> [Int] > random2Ints s1 s2 > | s1

Is Standard Haskell a serious language?

1997-08-21 Thread Ralf Hinze
o Types such as Packed Strings or Packed Booleans (ie bitlist) are missing in the Standard Library. Could one otherwise convince students that Haskell is not an academic playground? I believe not. Ralf Hinze

Re: A new view of guards

1997-05-06 Thread Ralf Hinze
Just wanted to add two minor points to the discussion. Beforehand let me say that I *really* like Simon's proposal [despite the various objections]. Mainly, because it's a small upwards compatible change with a considerable gain. Going back to Simon's first `clunky' example. > Now consider the f

Re: Monad transformers via single-parameter classes?

1996-05-29 Thread Ralf Hinze
It seems everybody is playing around with monads and monad transformers these days. I tried to `simplify' the multiple constructor classes a few days ago ;-). `State' worked as you described it, but I encountered problems with SML-like exception handling: > class Monad m => ExcMonad e m where >