Re: looking for System.Console.Readline example

2003-12-02 Thread Martin Norbäck
tis 2003-12-02 klockan 14.23 skrev Johannes Waldmann: > Martin Norbäck wrote: > > > main = do input <- readline "prompt> " ; handle input > > but this only reads one line (and it gives a Maybe String) > I wanted a (lazy) list of all input lines, > w

Re: looking for System.Console.Readline example

2003-12-02 Thread Martin Norbäck
tis 2003-12-02 klockan 12.55 skrev Johannes Waldmann: > I am looking for an example program > that uses System.Console.Readline > > http://www.haskell.org/ghc/docs/latest/html/readline/System.Console.Readline.html > > If my main program looks like this: > main = do input <- getContents ; handle i

Re: update of ghc-6.0 rpms for Red Hat Linux 9

2003-06-05 Thread Martin Norbäck
u make any changes to it? Regards, Martin -- Martin Norbäck [EMAIL PROTECTED] Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG http://www.dtek.chalmers.se/~d95mback/ SWEDEN

Re: Lazy evaluation alternative

2003-01-24 Thread Martin Norbäck
CPS to represent an infinite data type. Yes, you can simulate lazy evaluation. But the point is that we don't want to simulate it, we want it built-in into the language, for optimization purposes. Regards, Martin -- Martin Norbäck [EMAIL PROTECTED] Kappland

RE: Using Bison as Haskell parser generator

2002-10-17 Thread Martin Norbäck
tor 2002-10-17 klockan 17.32 skrev Simon Marlow: > Note that Happy has support for some Haskellish things which you won't > get if you use bison to generate Haskell. For example: type signatures > on productions, and support for threading a monad around the parser. Another feature which I would l

Re: Q: Forcing repeated evaluation

2002-09-12 Thread Martin Norbäck
t > this optimisation? Thank you for your feedback. The easiest way is to make it a function l _ = [ i*i*i | i <- [0..n] ] -- for very large n x1 = f1 (l ()) x2 = f2 x1 (l ()) x3 = f3 x2 (l ()) () can be any value really. Regards, Martin -- Martin Norbäck

Re: Why concatMap instead of concat.map?

2002-09-11 Thread Martin Norbäck
.map"? I think it's just because it's easier to read/write concatMap f list than (concat.map) f list Regards, Martin -- Martin Norbäck [EMAIL PROTECTED] Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG

Re: Main.main naming convention

2002-09-10 Thread Martin Norbäck
tis 2002-09-10 klockan 01.22 skrev Manuel M T Chakravarty: > Martin Norbäck <[EMAIL PROTECTED]> wrote, > > > I have a question about the Main.main naming convention. Would it be a > > good idea to lift the restriction and allow any module which exports a > > functio

Main.main naming convention

2002-09-09 Thread Martin Norbäck
top level. Regards, Martin -- Martin Norbäck Safelogic AB [EMAIL PROTECTED]Stena Center 1C +46 (0)31 772 81 70S-412 92 GÖTEBORG http://www.safelogic.seSWEDEN signature.asc Description: PGP signature

Main.main naming convention

2002-09-09 Thread Martin Norbäck
top level. Regards, Martin -- Martin Norbäck [EMAIL PROTECTED] Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG http://www.dtek.chalmers.se/~d95mback/ SWEDEN OpenPGP ID: 3FA8580B signature.asc Description: PGP signature

RE: Yet more text pedantry

2002-08-13 Thread Martin Norbäck
e moderated? This will make things progress more slowly. Regards, Martin -- Martin Norbäck [EMAIL PROTECTED] Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG http://www.dtek.chalmers.se/~d95mback/ SWEDEN Ope

Re: Yet more text pedantry

2002-08-12 Thread Martin Norbäck
o. Looking at my original post (UTF-8 library), I never expected this much traffic :) Can't we make a mailing list for these issues? [EMAIL PROTECTED] is my proposal, who can create such a list? I'm interested in participating in a working group to solve these issues. Regards,

Re: ANNOUNCE: hat-2.00

2002-06-20 Thread Martin Norbäck
tor 2002-06-20 klockan 18.54 skrev Jens Petersen: > Malcolm Wallace <[EMAIL PROTECTED]> writes: > > > We are pleased to announce a new release of Hat, the Haskell tracing > > (an debugging) system for Haskell'98. > > > For information on hat: http://www.cs.york.ac.uk/fp/hat/ > > For hat do

Re: Prob with numeric values

2002-05-23 Thread Martin Norbäck
t it works for any numeric type, including Int) instance Num a => A a where inc a = a + 1 Regards, Martin -- Martin Norbäck [EMAIL PROTECTED] Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG http://www.dtek.chalmers.se

Re: preprocessing printf/regex strings (like ocaml)

2002-05-16 Thread Martin Norbäck
bility to translate an application without having to recompile it and good tool support. > i18n is a useful hack to retrofit onto the C printf system, but I think it > would be a backward step for Haskell. Since I've never seen any i18n systems for Haskell, everything w

Re: preprocessing printf/regex strings (like ocaml)

2002-05-15 Thread Martin Norbäck
tis 2002-05-14 klockan 18.56 skrev anatoli: > Robert Ennals <[EMAIL PROTECTED]> wrote: > > Surely that problem only arises if one insists on encoding all the relevant > > information inside a string. > > This is pretty much the only option, because translators > and programmers are different peo

Re: preprocessing printf/regex strings (like ocaml)

2002-05-14 Thread Martin Norbäck
tis 2002-05-14 klockan 16.45 skrev Robert Ennals: > > Martin Norbäck <[EMAIL PROTECTED]> wrote: > > > I agree that i18n needs positional arguments. > > > What's wrong with simply doing like this: > > > > > > printf "I have %. %. %..&q

Re: preprocessing printf/regex strings (like ocaml)

2002-05-14 Thread Martin Norbäck
ll rest' || head rest' /= '.' || index > length xs then '%':printf (d:ds:rest') xs else xs!!(index - 1) ++ printf (tail rest') xs printf (r:rest) xs = r:printf rest xs printf [] _ = [] Note that there are no errors if the format st

Re: text/x-haskell and text/x-literate-haskell added to the GNOMEMIME database

2002-04-18 Thread Martin Norbäck
for that MIME type will not see it as text in the browser. So using text/ is a good way of specifying that the fallback of just showing the contents as text is perfectly OK. Even better maybe would be to have source/haskell, but introducing a completely new top-level media type is a bit heavy.

text/x-haskell and text/x-literate-haskell added to the GNOME MIMEdatabase

2002-04-18 Thread Martin Norbäck
plain text is OK. x-* means that it's not an officially registered MIME type (there is really no need to register it officially.) Our hope is that everyone will use these MIME types where appropriate. Regards, Martin -- Martin Norbäck [EMAIL PROTECTED] Kapplandsgat

Re: Coding Problems!! Please help

2002-04-17 Thread Martin Norbäck
ot of work yourself here, and only got stuck on the strange >.> operator. One of the things about this book which I don't like is that Thompson introduces a lot of non-standard functions. You can try to make the following definition in your file: (>.>) = flip (.) Regards,

Re: Hugs plugin, Haskell Browser

2002-03-14 Thread Martin Norbäck
tor 2002-03-14 klockan 08.02 skrev Ketil Z. Malde: > "Manuel M. T. Chakravarty" <[EMAIL PROTECTED]> writes: > > > The detailed choice of colours is, of course, adjustable. > > At least on a Unix machine, I am quite sure you can use > > XEmacs also in batch mode to generate the HTML > > Sure. Ha

Re: Why is this function type-correct

2002-03-04 Thread Martin Norbäck
mån 2002-03-04 klockan 15.11 skrev Rijk J. C. van Haaften: > Hello, > > Recently, I wrote a function similar to > > x :: a > x = x 42 > > which is type-correct (Hugs, Ghc, THIH). > Still, from the expression it is clear > that the type shoud have a function type. It might interest you to know

Re: why is this legal

2002-02-02 Thread Martin Norbäck
lör 2002-02-02 klockan 16.03 skrev Antony Courtney: > Of course, good compilers/tools will let you turn such warnings on and > off selectively, and good programmers write programs that compile > without warnings (since warnings usually indicate dubious constructs). > While the examples you give

Re:

2002-01-24 Thread Martin Norbäck
fre 2002-01-25 klockan 08.27 skrev David Feuer: > Martin Said: > > > Those two constructs are not the same > > > Compare > > > newtype T1 = C1 Bool > > dataT2 = C2 !Bool > The report says clearly that for a newtype like T1, > C1 _|_ = _|_ > This is the same as for T2 and C2. No. C1 _|_

Re: newtype pattern matching

2002-01-24 Thread Martin Norbäck
fre 2002-01-25 klockan 02.21 skrev Feuer: > Please reply to [EMAIL PROTECTED] > > > I don't remember if I answered this before, but... > > I don't see the relevance of there being no constructor to match on. That > is the case for any tuple type. It seems that > > newtype T1 [a1 a2 ...] = C1

Re: newtype pattern matching

2002-01-22 Thread Martin Norbäck
tis 2002-01-22 klockan 15.52 skrev Feuer: > Why is pattern matching on newtypes lazy? Does this add to efficiency > somehow? If not, it seems to be just another rule to keep straight. That's the difference between newtype and data. Newtypes are unboxed, so there is no constructor to match on. P

Re: Inverse function

1999-12-30 Thread Martin Norbäck
Wed Dec 29 1999, [EMAIL PROTECTED] -> > Is it possible to define an inverse function such that given the functions > f,g, and h and their inverses f',g', and h', the inverse function would > return the appropriate inverse? > e.g. > inverse(f)=f' > inverse(g)=g' > inverse(h)=h' Do you want to have

Re: type of deleteBy

1999-12-07 Thread Martin Norbäck
Mon Dec 06 1999, Keith Wansbrough -> > Sergey: > > I propose for Haskell-2 to add to the library > > > > delBy :: (a -> Bool) -> [a] -> [a] > > delBy _ [] = [] > > delBy p (a:as) = if p a then as else a:(delBy p as) > > So what do you propose as the definition for > > del :: (

Re: io monad binding, coding style

1999-01-17 Thread Martin Norbäck
Fri Nov 19 1999, Greg O'Keefe -> > The Haskell 98 Report contains the following example, in section 7.2 on > page 89: > > main =readFile "input-file" >>= \ s -> > writeFile "output-file" (filter isAscii s) >> > putStr "Filtering succesful\n" >

Re: order of evalutation of ||

1998-05-29 Thread Martin Norbäck
-BEGIN PGP SIGNED MESSAGE- On Thu, 28 May 1998, S. Alexander Jacobson wrote: > 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. Ye

Re: Binary files in Haskell

1998-02-26 Thread Martin Norbäck
On Wed, 25 Feb 1998, Jerzy Karczmarczuk wrote: : PS. Could somebody inform me what is the current status of : multi-parametric classes? Concretely (for example) I would : like to construct a generic Universal Parser : : type Uparser a c = [c] -> [(a,[c])] : : which consumes any stream and prod

Defining search trees as monads

1997-09-28 Thread Martin Norbäck
Hi! When I was trying to sleep last night I though I could implement Search Trees in Haskell. And not only that, I would try to implement them as monads. The problem is that search trees require context Ord a. What I want is something like the following: - - - - - - - - - - - - - - - - - - - -