Re: [Haskell-cafe] type inference and named fields

2005-06-24 Thread Christian Maeder
Malcolm Wallace wrote: Here is a strawman proposal, which does not fix the consecutive update problem, but which might address the original typing problem. I think it does not really address the original typing problem. It would allow you to write: voidcast v@(VariantWithTwo{}) = v { field1

Re: [Haskell-cafe] type inference and named fields

2005-06-23 Thread Christian Maeder
Malcolm Wallace wrote: voidcast :: Fields a - Fields Void voidcast v@(VariantWithTwo{}) = v { field1 = Void , field2 = Void } voidcast v@(VariantWithOne{}) = v { field1 = Void } I would not expect that updating only field1 can change the type of v. The right thing is to construct a new value.

Re: [Haskell] translation of kind

2005-06-20 Thread Christian Maeder
Wolfgang Jeltsch wrote: can anybody tell me what the German translation of the word kind as used in type theory and especially in Haskell is? Even Peter Thiemann in Grundlagen der funktionalen Programmierung (1994) did not translate Kind, although he used geschönfinkelt for curry (honoring

Re: ghc 6.4 without libreadline4

2005-06-16 Thread Christian Maeder
Christian Maeder wrote: Geoffrey Alan Washburn wrote: Does anyone have a prebuilt version of ghc 6.4 that works with libreadline5? The generic Linux version on http://www.haskell.org/ghc/download_ghc_64.html requires libreadline4, I did not worry about the readline version and it worked

Re: [Haskell-cafe] Generalized version of `words'?

2005-06-13 Thread Christian Maeder
Here is my version: -- | split list at separator elements, avoid empty sublists splitBy :: Eq a = a - [a] - [[a]] splitBy x xs = let (l, r) = break (==x) xs in (if null l then [] else [l]) ++ (if null r then [] else splitBy x $ tail r) -- suffix By usually indicates a (a - a - Bool) argument

Re: [Haskell-cafe] Generalized version of `words'?

2005-06-13 Thread Christian Maeder
Dimitry Golubovsky wrote: Does there exist a generalized version of the `words' function i. e. one that breaks an arbitrary list into parts by an arbitrary predicate? splitAt is not what I need. I had to write my own: -- A version of words, but works with any lists on any predicate.

Re: Building ghc-6.4-branch on Solaris

2005-06-10 Thread Christian Maeder
Axel Simon wrote: Warning: retaining unknown function `getgrnam_r' in output from C compiler I haven't overridden anything in build.mk, so I assume SplitObjs=YES. When would I observe these warnings? the first time when the inplace compiler translates System/Posix/Resour ce.hs I just see

Re: 5.02

2005-06-10 Thread Christian Maeder
Simon Marlow wrote: On 10 June 2005 08:58, Serge D. Mechveliani wrote: Now, I indeed, intend to compare 6.4 to 5.02 on several examples, downloaded ghc-5.02.3 and tried to make it with ghc-6.4 Yes, that's unlikely to work. I was able to install the binaries from

Re: 5.02

2005-06-10 Thread Christian Maeder
Christian Maeder wrote: 6.4 produces better and faster code than 6.2.2 and 5.04.2 for our application. better was supposed to mean smaller binaries ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman

Re: Building ghc-6.4-branch on Solaris

2005-06-09 Thread Christian Maeder
Axel Simon wrote: gcc -O -Wall -I../../../ghc/includes -I../../../ghc/rts -I/core/include-c env.c -o env.p_o cc1: /core/include: Not a directory My gcc does not complain about that missing directory. I was able to create a working installation under solaris with: ./configure

Re: addListToFM

2005-06-03 Thread Christian Maeder
Serge D. Mechveliani wrote: I used to apply FiniteMap.addListToFM. Now, what is its best expression in ghc-6.4 ? Is this \ mp pairs - Map.union (Map.fromList pairs) mp ? (the order of the arguments in Map.union is essential). This looks fine to me. best is hard to meet. I'ld

Re: Map, Set libraries

2005-06-02 Thread Christian Maeder
Serge D. Mechveliani wrote: As Jens Fisseler notes, I have made a confusion about Set.elems, Set.toList, Set.setToList. There is even Set.toAscList (although one may argue that should be Set.toDistinctAscList) I think the right choice is Set.toList (replacing setToList) Is Set.elems just a

Re: Map library

2005-06-02 Thread Christian Maeder
Mario Blazevic wrote: mapFilter :: (a - Maybe b) - Map k a - Map k b mapFilter f = map Maybe.fromJust . filter Maybe.isJust . map f How about using Map.foldWithKey (and adding Ord k = to the type signature)? mapFilter f = Map.foldWithKey ( \ k - maybe id (Map.insert k) . f) Map.empty

Re: [Haskell-cafe] ghc 6.4 import problem (Map vs. FiniteMap)

2005-05-31 Thread Christian Maeder
Daniel Fischer wrote: Indeed, I have looked at the sources and found out that now the implementations of 'Set' and 'Map' are basically the same. The major achievement of (the new) Data.Set and Data.Map are canonical names that should be used in conjunction with qualified imports: import

MPC with fundeps: ghc-6.2.2 vs ghc-6.4

2005-05-20 Thread Christian Maeder
Hi, the following (reduced) example used to go through with ghc-6.2.2 but fails with ghc-6.4. Which behaviour is correct? I compile with: ghc -fglasgow-exts Context.hs module Context where class Language a class Language a = Logic a b | a - b class (Language a, Logic b c, Logic d e) =

[ ghc-Bugs-1198393 ] Program aborts with segmentation fault when profiling used

2005-05-09 Thread Christian Maeder
Hi, I also have (a rather large) program (not included) that segfaults when compiled with profiling. I use the ghc-6.4 linux binary distribution from the web. It is not even necessary to call the program with +RTS -p -RTS. There is no problem with ghc-6.2.2, except that the old version uses its

Re: [Haskell-cafe] about Ghci

2005-04-28 Thread Christian Maeder
SCOTT J. wrote: Hi, I use Windows XP and I like to start Ghci in extended mode. What do I have to do in order not having to type always :set -fglasgow-exts under unix this line can be put in a file .ghci in your home directory. Maybe $HOME is a variable under windows as well (and it is

Re: [Haskell] Undefined of Char.toUpper ?

2005-04-27 Thread Christian Maeder
Luo Shuli wrote: Dear Haskellers, I am a beginer of the haskell language and study it from Yet Another Haskell Tutarial of Hal Daume III. Example from the tutarial: Prelude map Char.toUpper Hello World This works only with ghci I try it on Hugs for windows32, compile error:

Re: Viewing profiles with daVinci (uDraw)

2005-04-13 Thread Christian Maeder
ghcprof should be adapted to the new release of uDraw(Graph) http://www.informatik.uni-bremen.de/uDrawGraph Who maintains ghcprof? (What has cgprof to do with it?) Christian Simon Marlow wrote: On 13 April 2005 14:00, Bernd Holzmüller wrote: I am trying to create graphical profile

Re: GHC 6.4 Release Candidate Binary for Mac OS X

2005-03-08 Thread Christian Maeder
Wolfgang Thaller wrote: I've uploaded a Mac OS X installer based on the stable tree from March 2nd + the patches I committed yesterday at: http://opeongo.cas.mcmaster.ca/~wolfgang/GHC-6.4.20050302.pkg.zip I've only a remote account on a Mac. Do I have a chance to install ghc-6.4 locally as a

Re: new ghc under solaris

2005-02-25 Thread Christian Maeder
Simon Marlow wrote: What version of gcc are you using? I used gcc_2.95.3 until I discovered the warning: LdvProfile.c:43: #error Please use gcc 3.0+ to compile this file with DEBUG; gcc 3.0 miscompiles it I've switched to gcc_3.4.3. Now the final linking of the stage2 compiler fails (with

ghc HEAD and tee

2005-02-25 Thread Christian Maeder
Hi, we used redirect output of ghc via tee (within a Makefile). With the new ghc this randomly fails now. Does anyone have an explanation for this? ghc omitted args 21 | tee log yields: Skipping Main ( hets.hs, hets.o ) Linking ... tee: write error The linked binary and the log

new ghc under solaris

2005-02-24 Thread Christian Maeder
Hi Simon and solaris GHC users, I've made progress with ghc HEAD under solaris 8. In fact I could successfully install a ghc-6.5 compiler that was able to compile a couple of files (including Hello World) But on one file (by chance HughesPJ.hs with an unqualified module name) I got a Bus Error

Re: ghc-6.4.20050220: panic! eval_data2tag...

2005-02-23 Thread Christian Maeder
This happens when partially recompiling with -O (I thing I've send a similar bug-report that was kept in the moderator's queue because it was to slightly too large - over 40K ) Christian Thomas Hallgren wrote: Hi, I managed to distill my program into to the following small example that still

Re: ghc-6.4.20050220: panic! eval_data2tag...

2005-02-23 Thread Christian Maeder
Simon Peyton-Jones wrote: Should be fixed now -- can you try with the HEAD? yes, it work now! Thanks Christian | ghc-6.4.20050220: panic! (the `impossible' happened, GHC version | 6.4.20050220): | eval_data2tag | GHCziPrim.dataToTagzh{(w) v 95f} | @ (Bug.S{tc r14v}

Re: [Haskell-cafe] Re: New to haskell: unresolved overloading question

2005-02-22 Thread Christian Maeder
Keean Schupke wrote: There are problems with this approach... instance (Ord a, Num a) = ApproxEq a where x ~= y = (abs (x-y) 1) However it should do what you want with just -foverlapping-instances -fundecidable-instances. Only -fallow-incoherent-instances allowes to resolve 3.5 ~= 2.6

[Haskell-cafe] Re: New to haskell: unresolved overloading question

2005-02-22 Thread Christian Maeder
Tomasz Zielonka wrote: Why not forget about ApproxEq for () and Bool and simply define a function? (~=) :: (Ord a, Num a) = a - a - Bool x ~= y = abs (x-y) 1 Indeed, this works best. The instance for lists is also not too important. Christian ___

Re: [Haskell-cafe] Re: Point-free style (Was: Things to avoid)

2005-02-11 Thread Christian Maeder
[EMAIL PROTECTED] wrote: Note that currying applies to operator sections too. The idiom of pipelined functions deserves its own special mention: countlines = length . lines But this is really a shorthand for: countlines cs = length . lines $ cs an interesting use of $ (in conjunction with

installing current binary distribution

2005-02-04 Thread Christian Maeder
Hi, I've installed ghc-6.3.20050202-i386-unknown-linux.tar.bz2 only to find out that gcc-3.4.1 seems to be hard-wired into this ghc: ghc-6.3.20050202: could not execute: gcc-3.4.1 Why is this so. Do I need to install from sources? My current gcc version is: gcc (GCC) 3.3.1 (SuSE Linux) Cheers

Re: installing current binary distribution

2005-02-04 Thread Christian Maeder
Simon Marlow wrote: On 04 February 2005 12:23, Christian Maeder wrote: ghc-6.3.20050202: could not execute: gcc-3.4.1 This is because we currently configure the nightly builds to use gcc-3.4.1, and unfortunately that gets baked into the GHC binary. You can compile from source to get around

Re: [Haskell-cafe] Haskell binding to Berkeley DB?

2005-02-04 Thread Christian Maeder
our uniform workbench has a simpleDB binding to BDB. http://www.informatik.uni-bremen.de/uniform/wb/ The sources can be downloaded with cvs -d \ :pserver:[EMAIL PROTECTED]:/repository \ co uni and can be compiled with a recent ghc-6.2.2. The only documentation that I'm aware of is a

Re: [Haskell-cafe] using Map rather than FiniteMap

2005-01-26 Thread Christian Maeder
S. Alexander Jacobson wrote: zipped =zip [1..] [1..10]::[(Int,Int)] untup f (x,y) = f x y produce = foldr (untup Map.insert) Map.empty zipped fm = length $ Map.keys produce main = print $ fm Has this profile: example +RTS -p -K5M -RTS total time =5.10 secs

6.4 News

2005-01-12 Thread Christian Maeder
Hi, in a new version of ghc I've noticed that a colon in a path (as argument to -i) is no longer recognized. Will this also be the case in the new version ghc-6.4? Cheers Christian This used to compile with ghc6.2.2: ghc --make -v -i../DrIFT-src:../.. GenerateRules.hs [...] Glasgow Haskell

Re: [Haskell-cafe] Guards (Was: Some random newbie questions)

2005-01-07 Thread Christian Maeder
Henning Thielemann wrote: What about dropping Guards? :-) Are they necessary? Do they lead to more readable source code? Do they lead to more efficient code? I could perfectly live without them up to now. I hardly need guards too, but their advantage is that they let pattern matching fail,

Re: [Haskell-cafe] Utility functions

2004-12-29 Thread Christian Maeder
Derek Elkins wrote: I find myself writing things like, splitListOn :: Eq a = a - [a] - [[a]] similar stuff was discussed in July 2004 on [EMAIL PROTECTED] under the headding Prelude function suggestions, ie. http://www.haskell.org//pipermail/libraries/2004-July/002366.html Cheers Christian

[Haskell-cafe] Re: Haskell problem please help

2004-12-16 Thread Christian Maeder
N.B. if you want a faster answer such questions are best posted to [EMAIL PROTECTED] My answer: I asume that your function all_rotations somehow needs to be called recursively for the rest of the input list xs. Cheers Christian imranazad wrote: Hi, im not very good with haskell, i barely know

-fallow-incoherent-instances

2004-11-30 Thread Christian Maeder
The attached module does not compile and yields the following error: InCoherentInst.hs:17: Could not deduce (Confuse a) from the context (Typeable a) arising from use of `breakFn' at InCoherentInst.hs:17 Probable fix: Add (Confuse a) to the type signature(s) for

Re: -fallow-incoherent-instances

2004-11-30 Thread Christian Maeder
I wrote: If, furthermore, the confusing instance is commented out, the source even compiles without extensions. Correction: -fglasgow-exts is still required for the type GeneralBreakFn, but -fallow-overlapping-instances can be omitted. {-# OPTIONS -fglasgow-exts -fallow-overlapping-instances

Re: -fno-monomorphism-restriction

2004-11-29 Thread Christian Maeder
I've found a much shorter example (without imports) that does not compile. The error displayed is: Ambiguous type variable `a' in the top-level constraint: `ATermConvertibleSML a' arising from use of `las' at /home/maeder/haskell/examples/NoMonoRestr.hs:29 (comenting out the initial

Re: -fno-monomorphism-restriction

2004-11-29 Thread Christian Maeder
Christian Maeder wrote: I've found a much shorter example (without imports) that does not compile. and shorter: {-# OPTIONS -fno-monomorphism-restriction #-} module NoMonoRestr where data ATermTable = ATermTable data Annotation = Annotation data Annoted a = Annoted a [Annotation] toPair

Re: Bug in compiling large projects ?

2004-11-26 Thread Christian Maeder
Use -fallow-incoherent-instances to use the first choice above) This flag should be added to the flag reference list: http://www.haskell.org/ghc/docs/latest/html/users_guide/flag-reference.html#AEN5847 Christian ___ Glasgow-haskell-users mailing

Re: -fno-monomorphism-restriction

2004-11-26 Thread Christian Maeder
Simon Peyton-Jones wrote: I'm not sure whether you are saying (a) or (b): a) This is a compiler bug; even with -fno-monomorphism-restriction the module should compile. Are you sure? b) this is a feature request: you want a flag -fmonomorphism-restriction to restore the

Re: -fno-monomorphism-restriction

2004-11-26 Thread Christian Maeder
I wrote | If someone wants to reproduce the error, do the following: | 1) check out HetCATS repository with: | cvs -d pserver:[EMAIL PROTECTED]:/repository co | HetCATS | 2) comment out variable HC_PACKAGE in the Makefile (to avoid dependency | from uni) | 3) add the flag

Re: [Haskell] Haskell-mode 2.0

2004-11-26 Thread Christian Maeder
Stefan Monnier wrote: I have recently taken over maintainership of Haskell-mode, and after making a bunch of changes, I figured it would be a good idea to make a new release. You can find this new release at: http://www-perso.iro.umontreal.ca/~monnier/elisp/ Thank you! This release has

-fno-monomorphism-restriction

2004-11-24 Thread Christian Maeder
Hi, I've a file ATC/Sml_cats.hs that does not compile (see below) with the flag -fno-monomorphism-restriction (ghc 6.2.2), whereas it compiles fine without that option. Since I want to use -fno-monomorphism-restriction for other files (from programatica) I've a problem, because there is no

unlit/ghci does not work on DOS file

2004-11-18 Thread Christian Maeder
Hi, calling unlit on a DOS file fails, whereas hugs is able to process the same file (under unix). Christian Prelude readFile Test.lhs = putStrLn . show \r\n module Test where\r\n\r\n Prelude :l Test.lhs Test.lhs line 2: unlit: Program line next to comment phase `Literate pre-processor' failed

Re: deriving...

2004-10-20 Thread Christian Maeder
deriving instances will only work for a) known/builtin classes (like Typeable, Eq, Show, etc) b) datatypes T that are defined elsewhere using data (or newtype) where the corresponding deriving clause is missing. HTH Christian MR K P SCHUPKE wrote: instance Typeable (T a) Forgive my stupid

Re: deriving...

2004-10-19 Thread Christian Maeder
Simon Peyton-Jones wrote: derive( Typeable (T a) ) But that means adding 'derive' as a keyword. Other possibilities: deriving( Typeable (T a) ) -- (B) Re-use 'deriving' keyword The trouble with (B) is that the thing inside the parens is different in this situation than in a data type

[Haskell] Building from source

2004-10-06 Thread Christian Maeder
Hi, after checking out fptools from cvs. The simple sequence $ autoreconf $ ./configure $ make failed in the directory hood, because the target boot is unknown there. Could/Should this be fixed? I know how to use mk/build.mk and the ProjectsToBuild variable. I don't need hood, but make still

Re: [Haskell] Building from source

2004-10-06 Thread Christian Maeder
Simon Marlow wrote: If you don't want to build hood, then remove it from the tree. Did you perhaps check out *everything*? The right way is to check out fpconfig Ah, that was my error. I checked out everything by cvs co fptools instead of only doing cvs co fpconfig. (When I read fpconfig, I

Re: [Haskell-cafe] Re: Roman Numerals and Haskell Syntax abuse

2004-07-06 Thread Christian Maeder
Christian Maeder wrote: George Russell wrote (snipped): Now 145. roman=(0#);a#n|n1=|n=t!!a=s!!a:a#(n-t!!a)|n+t!!b=t!!a=s!!b:a#(n+t!!b)|10=(a+1)#n where b=2*div a 2+2;s=mdclxvi;t=[1000,500,100,50,10,5,1] 138 roman=(!6);n!a|n1=|n=t=s!!a:(n-t)!a|n+c=t=s!!(2*e):(n+c)!a|10=n!(a-1)where(d,m)=a`divMod

Re: [Haskell-cafe] Re: Roman Numerals and Haskell Syntax abuse

2004-07-06 Thread Christian Maeder
Graham Klyne wrote: now 134 roman=(!6);n!a|n1=|n=t=s!!a:(n-t)!a|c=t=s!!(2*e):c!a|10=n!(a-1)where(d,m)=a`divMod`2;e=d+m-1;s=ivxlcdm;c=10^e+n;t=10^d*(1+4*m) Doesn't that need import Array? No, ! is user defined here (since ghc does not like # as infix) btw, now 127:

Re: How do I specify the source search path?

2004-06-30 Thread Christian Maeder
Jorge Adriano Aires wrote: Using the -i flag. Unfortunatly relative paths (using '~') don't seem to work, so you have to type the full path: ghci -i/home/user/HAppS/ right '~' is not expanded, but '-i../HApps:.' should work As far as I know, there is also no way to specify the search path in an

compiling ghc-6.2.1

2004-06-09 Thread Christian Maeder
Christian Maeder wrote: [EMAIL PROTECTED] - rpm -q gcc gcc-3.3.3-41 make (in ghc-6.2.1) fails (in ghc/GC.c) with: GC.c: In function `threadLazyBlackHole': GC.c:4049: warning: use of cast expressions as lvalues is deprecated make[2]: *** [GC.o] Fehler 1 The actual error not messed up by warnings

Re: compiling ghc-6.2.1

2004-06-09 Thread Christian Maeder
Christian Maeder wrote: The actual error not messed up by warnings is: ../../ghc/compiler/ghc-inplace -optc-O -optc-w -optc-Wall -optc-W -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return -optc-Wbad-function-cast -optc-I

Re: Glasgow Haskell on different versions of Linux

2004-06-09 Thread Christian Maeder
I wrote: since version 6.2 we have 2 binary distributions for (generic) linux: for glibc 2.2 and glibc 2.3 Maybe this is no longer necessary. I've produced an installation (under glibc 2.2) that runs under glibc 2.2 and glibc 2.3. I've now also successfully installed ghc-6.2.1 from source under

Glasgow Haskell on different versions of Linux

2004-06-08 Thread Christian Maeder
Dear Haskellers, since version 6.2 we have 2 binary distributions for (generic) linux: for glibc 2.2 and glibc 2.3 Unfortunately our network has machines with both of this glibc versions. The problem seems to be related with the inclusion of ctype.h. Is it possible to produce a GHC binary for

Re: Glasgow Haskell on different versions of Linux

2004-06-08 Thread Christian Maeder
Christian Maeder wrote: since version 6.2 we have 2 binary distributions for (generic) linux: for glibc 2.2 and glibc 2.3 Maybe this is no longer necessary. I've produced an installation (under glibc 2.2) that runs under glibc 2.2 and glibc 2.3. As also Volker Stolz suggested I've changed, after

Re: Compiling data

2004-05-27 Thread Christian Maeder
We have put a large list in double quotes and used read to convert the large literal string (too big for hugs, though) into the needed list. This reduced compile time drastically, but I don't know how the runtime changed. (Also errors can only occur at runtime.) Christian Ketil Malde wrote:

Re: [Haskell-cafe] Syntax for modifying nested product types

2004-04-23 Thread Christian Maeder
Malcolm Wallace wrote: perhaps cond f field = if cond then f field else field foo { bar = perhaps cond0 f (bar foo) , wib = perhaps cond1 g (wib foo) } I tend to write functions: upd_bar f x = x { bar = f (bar x) } upd_wib f x = x { wib = f (wib x) } in order to avoid mentioning

Re: [Haskell-cafe] Adding Ord constraint to instance Monad Set?

2004-03-31 Thread Christian Maeder
Simon Peyton-Jones wrote: Yes, it is, I believe. Constraints on data type declarations are a mis-feature. I tried to get them removed, but there was some argument that they could be made useful (see John Hughes's paper Restricted data types in Haskell, Haskell workshop 1999), and they stayed.

Re: [Haskell-cafe] Where's the error in this snippet of code?

2004-03-24 Thread Christian Maeder
Alex Gontcharov wrote: Ignore the layout pStack needs to be indented to the same level than digStack (or a where must be inserted after digStack). I can't find the error, running it gives parse error during compile on pStack, it is not very descriptive and I don't what is wrong. after correct

Stack space overflow after optimization

2004-03-17 Thread Christian Maeder
Hi, my program throws Stack space overflow: current size 1048576 bytes. Use `+RTS -Ksize' to increase it. only when translated with -O. Is it possible that the next release of ghc uses a higher stack size at least when the -O flag is set? (Only to reduce the likelyhood that our users need to

Re: Parsec State Monad Question

2004-03-05 Thread Christian Maeder
In a local copy of Parsec.Prim I've added: mapState :: (st1 - st2) - State tok st1 - State tok st2 mapState f (State i p u) = State i p $ f u mapOkReply :: (st1 - st2) - Reply tok st1 a - Reply tok st2 a mapOkReply _ (Error a) = Error a mapOkReply f (Ok a s e) = Ok a (mapState f s) e mapConsumed

Re: [Haskell] Re: Data.Set whishes

2004-02-20 Thread Christian Maeder
Koen Claessen wrote: And instead of: mapSet, emptySet, ... We have: Set.map, Set.empty, ... This is how Chris does it in Edison. and Daan Leijen in DData: http://www.cs.uu.nl/~daan/ddata.html Christian (Well, Set.map is actually missing there)

Re: [Haskell] Parsec question: attempted 'notMatching' combinator

2004-02-18 Thread Christian Maeder
Hi, In a local copy of Parsec.Prim I've added a primitive, that may be of help for your problem as well. consumeNothing :: GenParser tok st () consumeNothing = Parser (\state - Consumed (Ok () state (unknownError state))) With this I've implemented: checkWith :: (Show a) = GenParser tok st a

Re: [Haskell-cafe] elemt from list

2004-01-27 Thread Christian Maeder
The pattern [x] only matches singleton lists. Pajo Patak wrote: I want to return a list, from and list of lists (all integers), where is the erroe in the code? nthList :: [[a]] - Int - [a] nthList ([x]:xs) 1 = [x] nthList ([x]:xs) (n+1) = nthListh xs n

Re: [Parsec] Extracting line and column numbers

2004-01-13 Thread Christian Maeder
Tomasz Zielonka wrote: On Tue, Jan 13, 2004 at 12:44:10PM +0100, Stefan Holdermans wrote: abstract and I cannot extract the line and column numbers from a SourcePos value. What are my options? What about these? sourceColumn :: SourcePos - Column sourceLine :: SourcePos - Line These

Re: ANNOUNCE: GHC version 6.2

2003-12-17 Thread Christian Maeder
since GHC version 6.2.the following link is missing: http://www.haskell.org/ghc/docs/latest/html/base/index.html I asume that I need to change my bookmark to: http://www.haskell.org/ghc/docs/latest/html/libraries/index.html Cheers Christian ___

Re: incompatible signatur syntax within instance definition

2003-12-10 Thread Christian Maeder
Fergus Henderson wrote: Allowing repeated constraints would not be sufficient for that. Yes, you're right. A true (but senseless) constraint like Show Int is rejected as well. (The same applies to Show a if a is a scoped type variable, that is when a is monomorph.) So a function with type a -

Re: type of (/) ?

2003-12-09 Thread Christian Maeder
Yaroslav Korchevsky wrote: my_avg list = (accum list) / (length list) ERROR U:\slav\FP\Avg.hs:11 - Type error in application *** Expression : accum list / length list *** Term : accum list *** Type : Float *** Does not match : Int Why

Re: incompatible signatur syntax within instance definition

2003-12-08 Thread Christian Maeder
Fergus Henderson wrote: I think the issue here is that in ghc (with -fglasgow-exts), the a here refers to the same type variable a in the top of the instance declaration, which has already been constained, and cannot be constrained again. Is that a bug or a feature? With Haskell 98, it is a fresh

incompatible signatur syntax within instance definition

2003-12-05 Thread Christian Maeder
Hi, if I try to supply a signatur for the local function showsl below, then ghc rejects a constraint (Show a) whereas hugs (and nhc98) needs this constraint. What should be the correct notation? (apart from omitting any signature) Cheers Christian (BTW, I would appreciate if the

Re: incompatible signatur syntax within instance definition

2003-12-05 Thread Christian Maeder
I've just noticed that I used ghc with -fglasgow-exts. Without extensions hugs, ghc und nhc98 consistently need the constraint in the type signature (below) showsl :: Show a = List a - ShowS Switching the extensions on, breaks this code, however (ghc only). Christian I wrote: Hi, if I try

Re: show function

2003-12-03 Thread Christian Maeder
rui yang wrote: I want to print a function which itself have some functions as it's parameters and will return some functions as the results, and I want to print out the result, does anyone knows how to define the instance declaration of show class to this function type? I don't know if it

changed link

2003-10-15 Thread Christian Maeder
Hi, on: http://www.haskell.org/bookshelf/ the link for: Online Haskell Course by Ralf Hinze (in German). should be changed from: http://www.informatik.uni-bonn.de/~ralf/teaching/HsKurs_toc.html to: http://www.informatik.uni-bonn.de/~ralf/teaching/Hskurs_toc.html At least my browser seems to be

Re: interact behaves oddly if used interactively

2003-10-01 Thread Christian Maeder
I wrote: main=interact id basically echoes every line of my input, whereas main=interact show correctly waits for EOF before outputting something. The unix cat and sort behave in a similar way (sort obviuously has to wait for the last line.) Still I would regard it to be more pure (or abstract)

Re: interact behaves oddly if used interactively

2003-10-01 Thread Christian Maeder
Malcolm Wallace wrote: [...] Surely the name suggests that interactive behaviour is required, i.e. exactly some interleaving of input and output. The chunk-size of the interleaving should depend only on the strictness of the argument to interact. I'm not happy that interleaving depends on the

Re: interact behaves oddly if used interactively

2003-10-01 Thread Christian Maeder
I wrote: But looking at the two actions of interact: interact f = do s - getContents putStr (f s) I would expect the first action to be finished before the second Keith Wansbrough wrote: Why? Because the actions are written down in that order? Why not? Why should I expect pipelining?

Re: interact behaves oddly if used interactively

2003-10-01 Thread Christian Maeder
Can actually someone supply an implementation of something like interact that does no pipelining for the argument id? Simply doing putStr !$ f !$ s was not enough! Yes, of course. Your code above only forces the evaluation of the first cons-cell of the list, which is not enough. You want to

interact behaves oddly if used interactively

2003-09-30 Thread Christian Maeder
Hi, For GHC (6.0.1) main=interact id basically echoes every line of my input, whereas main=interact show correctly waits for EOF before outputting something. Furthermore the buffering mode must be LineBuffering. If I explicitely set the buffering to NoBuffering I'm not able to enter EOF by

Re: interact behaves oddly if used interactively

2003-09-30 Thread Christian Maeder
main=interact id basically echoes every line of my input, whereas main=interact show correctly waits for EOF before outputting something. Which of these are you claiming is wrong? I guess interact does what it should, but I think it should be changed to avoid interleaved in- and output. lose

Re: unary minus

2003-09-05 Thread Christian Maeder
I wrote: I wonder why Haskell only allows the unary minus on the left side of an expression (lexp in the grammar). The unary minus may also occur on the right hand side (rule: exp - lexp). So -1 == -1 is correct, because == has lower precedence than -. Also -1*2 is correct although it is

Re: need some info/help

2003-09-04 Thread Christian Maeder
Brett G. Giles wrote: Naturally, there are many great resources for this at www.haskell.org Ensure you check out both Alex and Happy for the parsing and sourcing. (note that Alex is currently being re-written, I'm not sure if the latest public version has the new format/syntax) I think, parsing

unary minus

2003-09-04 Thread Christian Maeder
Hi, I wonder why Haskell only allows the unary minus on the left side of an expression (lexp in the grammar). There should be no problem to uniquely recognize an unary minus right beside an operation symbol (qop). Does the grammar allow two consecutive qops in other cases? This would allow 1

Re: Exhaustive Pattern-Matching

2003-08-29 Thread Christian Maeder
GHC tries to do so, but sometimes gets it wrong. See the -fwarn-incomplete-patterns flag. We'd appreciate it if someone could overhaul this code - it's been on the wish list for a long time. Indeed, I always try to avoid all warnings in my sources by using the flag -Wall, because I consider

Re: User-Defined Operators (ad-hoc overloading)

2003-07-22 Thread Christian Maeder
Andrew J Bromage wrote: As a matter of interest, is there a known worst-case complexity for the precomputation required by Earley's algorithm to handle arbitrary CFGs? Earley's algorithm handles exactly arbitrary (in particular ambiguous) CFGs without precomputation. see i.e. Aho,Ullman, The

instance Typeable (Re: How do I create dynamic exceptions)

2003-07-22 Thread Christian Maeder
data MyException = MkExc Int String ... but now it seems I have to install this as an instance of Typeable, and I don't see how to do that. instance Typeable MyException where typeOf ? = ? import Data.Dynamic myExceptionTc = mkTyCon MyException instance Typeable MyExceptionBasicSpec where

Re: instance Typeable

2003-07-22 Thread Christian Maeder
Simon Peyton-Jones wrote: GHC 6.0 supports deriving( Typeable ), but for some strange reason it's not in the manual. It will be. Yes, I tried it before and gave up after a message: ../HasCASL/As.hs:24: Can't make a derived instance of `Typeable BasicSpec' (`Typeable' is not a derivable

Re: User-Defined Operators (ad-hoc overloading)

2003-07-21 Thread Christian Maeder
Mere overload resolution (over monomorphic types) is not NP-hard. (This is only a common misconception.) I can only repeat my above sentence. No, but as you note below, the interesting cases are. Most of the more interesting number-like types are polymorphic (e.g. Complex, Ratio). This kind of

Re: User-Defined Operators (ad-hoc overloading)

2003-07-18 Thread Christian Maeder
Andrew J Bromage wrote: Of course you could always allow overloading _without_ requiring module qualification (unless the overloading can't be resolved using type information). It'd make type checking NP-hard, but I seem to recall that it's already more complex than that. Mere overload resolution

Re: referring to deeply embedded definitions

2003-07-18 Thread Christian Maeder
Hal Daume wrote: Suppose I have: module M1 where import M2 foo = 'a' and module M2 where import M3 and module M3 where foo = True Now, inside M1, I want to write something like: bar = if M2.foo then M1.foo else 'b' M2 must reexport foo: module M2 (foo) where import M3

Re: User-Defined Operators

2003-07-17 Thread Christian Maeder
Johannes Waldmann wrote: I do think that self-defined operators make a programm less readable. I quite like most combinators from the pretty-printer or parsing libraries! And what's absolutely horrible (IMHO) is to allow the user to declare arbitrary precedence and associativity for his

Re: Haskell book recommendation?

2003-07-16 Thread Christian Maeder
bjkwak wrote: I have downloaded and read some tutorials from the Haskell home page, but most of them are incomplete and I decided to buy a book or two. Did you try http://www.isi.edu/~hdaume/htut/tutorial.ps ? Yet Another Haskell Tutorial by Hal Daume III et al. A tutorial for Haskell that is

Re: Reading/Writing Binary Data in Haskell

2003-07-09 Thread Christian Maeder
There isn't a standard mechanism for binary I/O. NHC98 contains the York Binary library. Can someone tell me if this is available for other Haskell systems? And didn't GHC also provide binary I/O? How does the GHC itself read/write binary data, since the interface files (*.hi) produced by GHC

haskell-mode and xemacs

2003-07-03 Thread Christian Maeder
Hi, whenenver I open a haskell file (*.hs) with my xemacs I get an annoying warning in a splitted window: (1) (error/warning) Error in `post-command-hook' (setting hook to nil): (void-variable imenu--index-alist) The modes (Haskell Font Ind Doc) seem to work, though. My xemacs has [version

Re: haskell-mode and xemacs

2003-07-03 Thread Christian Maeder
Sven Panne wrote: Christian Maeder wrote: whenenver I open a haskell file (*.hs) with my xemacs I get an annoying warning in a splitted window: (1) (error/warning) Error in `post-command-hook' (setting hook to nil): (void-variable imenu--index-alist) [...] Try adding (require

Re: Simple monads

2003-06-27 Thread Christian Maeder
not deeply understanding the use of Haskell extensions in the State source, I'm assuming Control.Monad.State's source in which case -no- extensions are used for -State- (well, at least I don't see any quickly glancing). Extensions are used for the -MonadState class-. The portable parts of

Re: Simple monads

2003-06-27 Thread Christian Maeder
The previous newtype Labeller a = Labeller (Int - (Int, a)) (the result tuple is reversed within Control.Monad.State) would simply become (untested): newtype Labeller a = State Int a newLabel = do { n - get; put (n + 1); return (Label n) } runLabeller l = execState l minBound it must be

language extensions ( Re: @-bindings broken in 6.0?)

2003-06-26 Thread Christian Maeder
I think lumping all these extensions under one switch is the problem. Yep, I agree. Would it be hard to split `-fglasgow-exts' up? I'd greatly appreciate a more fine-grained control here. The only difficulty is that we don't have an easy way to parameterise the parser, since it's generated from

<    4   5   6   7   8   9   10   >