[Haskell-cafe] Re: [Haskell] Re: Trying to install binary-0.4

2007-10-16 Thread Neil Mitchell
Hi I agree. = 1.0 isn't viable in the long term. Rather, a specific list, or bounded range of tested versions seems likely to be more robust. In general, if it compiles and type checks, it will work. It is rare that an interface stays sufficiently similar that the thing compiles, but then

Re: [Haskell-cafe] On the verge of ... giving up!

2007-10-14 Thread Neil Mitchell
Hi Then, I set out to learn Monads + Category Theory from a Math perspective. This is where you went wrong. I know none of this stuff and am perfectly happy with IO in Haskell. Read http://www.haskell.org/haskellwiki/Monads_as_Containers and then read lots of other Monad tutorials for Haskell.

Re: [Haskell-cafe] Re: On the verge of ... giving up!

2007-10-14 Thread Neil Mitchell
Hi main n = print . sum . map read . take n . reverse . lines = getContents Could someone describe succinctly how to compute the space complexity of this program, if there are m lines of input and m n? Many thanks. --PR The space complexity is the size of the file - i.e. of size m. reverse

Re: [Haskell] Fingerprints and hashing

2007-10-11 Thread Neil Mitchell
Hi Simon, We are all familiar with the idea of an MD5 checksum, which provides a reliable fingerprint for a file, usually 128 bits or so. If the file changes, the fingerprint is (almost) certain to do so too. There are lots of techniques: CRC, shar?, MD5, etc. I believe the basic

Re: [Haskell-cafe] Adding GLUT package to WinHugs

2007-10-11 Thread Neil Mitchell
Hi The file you have requested (http://www.cs.york.ac.uk/fp/cpphs-1.5-win32.zip) could not be found on this server. The slightly older version works: http://www.cs.york.ac.uk/fp/cpphs-1.2-win32.zip I'm unable to get SSH from this machine, so can't tell where that file has gone to. Malcolm

[Haskell-cafe] Re: [Haskell] Abstract syntax representation

2007-10-11 Thread Neil Mitchell
Hi In future questions like this are usually best directed to haskell-cafe, with haskell being left for annoucements. The standard full haskell representation is in Template Haskell (http://haskell.org/ghc/docs/latest/html/libraries/template-haskell/Language-Haskell-TH.html). If you want to work

Re: [Haskell-cafe] Adding GLUT package to WinHugs

2007-10-10 Thread Neil Mitchell
Hi Peter, Also typing runhugs Setup.hs configure fails with runhugs: Error occurred ERROR c:\program files\winhugs\packages\base\Text\ParserCombinators\ReadP.hs:156 - Syntax error in type expression (unexpected `.') This is because Cabal gets it wrong. You need to type runhugs -98 Setup

Re: [Haskell-cafe] Hugs, dotnet, C#...

2007-10-08 Thread Neil Mitchell
Hi Peter, There is a Dotnet tree in the Hugs source code files, which I believe is what supports dotnet. As far as I am aware, it probably won't work. A windows developer may be able to build it, but I've never tried. You might also be interested to know that Yhc supports --dotnet to generate a

Re: [Haskell-cafe] Extract source code from literate Haskell (LHS) files

2007-10-06 Thread Neil Mitchell
Hi Peter, This is of course very easy to do manually, but does a command line tool exist for extracting source code from literate Haskell files? Cpphs is the perfect tool to do this. Thanks Neil On 9/30/07, Peter Verswyvelen [EMAIL PROTECTED] wrote: Thanks, Peter

Re: [Haskell-cafe] GLFW for WinHugs

2007-10-06 Thread Neil Mitchell
Hi Peter, It sounds like the problem is that you need to convert it to Hugs, rather than WinHugs specific (which might put a few people off looking to see if they can help). Perhaps an email to the author of the library might help you find if they would be interested in doing a port to Hugs.

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Neil Mitchell
Hi show_system = unlines . zipWith (\l ms - Eq ++ show l ++ : ++ (concat $ intersperse + $ zipWith (\n x - x ++ x ++ show n) [1..] (init ms)) ++ = ++ last ms ) [1..] . map (map (take 8 . show)) And people complain that

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Neil Mitchell
Hi complex. The input is quite simple (it's a bunch of numbers), the output is quite simple (it's a neatly formatted string), but the process in the middle is... a mess. I'd like to find a more readable way of doing stuff like this. It's not just this specific function; any general hints

Re: [Haskell] Re: [Haskell-cafe] PROPOSAL: Rename haskell@ to haskell-announce@

2007-09-24 Thread Neil Mitchell
Hi Forgive me, but I would much prefer a newsgroup to a mailing list. True, I could unsubscribe now and just browse the mailman archives - but for posting, I'd have to temporarily re-subscribe, which is awkward. (Indeed that's the only reason I'm not doing it.) I believe you can post from

Re: [Haskell] Re: [Haskell-cafe] PROPOSAL: Rename haskell@ to haskell-announce@

2007-09-24 Thread Neil Mitchell
Hi Forgive me, but I would much prefer a newsgroup to a mailing list. True, I could unsubscribe now and just browse the mailman archives - but for posting, I'd have to temporarily re-subscribe, which is awkward. (Indeed that's the only reason I'm not doing it.) I believe you can post from

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Neil Mitchell
Hi Vimal, I was surprised to find out that the following piece of code: length [1..] 10 isnt lazily evaluated! The problem is that Int and Integer are both eager. It is possible to write a lazy peano number based data type, but I'm not aware of anyone who has - I have half the code (in

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Neil Mitchell
Hi In this world, use length (take 11 [1..]) 10... not (null (drop 10 [1..])) is surely faster (not tested...) Faster? There might be a few microseconds in it. Clearer? Possibly... ;-) lengthNat [1..] 10 Couldn't be clearer, and can be made to work perfectly. If anyone does want to

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Neil Mitchell
Hi lengthNat [1..] 10 Couldn't be clearer, and can be made to work perfectly. If anyone does want to pick up the lazy naturals work, I can send over the code (or write it yourself - its not hard!) Um... isn't a lazy natural just a list with no data, where the list length encodes a

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Neil Mitchell
Hi Pretty much, yes. So I just need to write newtype LazyNatural = LazyNatural [()] or data Nat = Zero | Succ Nat it's your choice really. and then add some suitable instances. ;-) Yes. Lots of them. Lots of instances and lots of methods. Hey, the length function would then just

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Neil Mitchell
Hi I'm guessing there's going to be fairly minimal performance difference. (Or maybe there is. My way uses a few additional pointers. But it also allows me to elegantly recycle existing Prelude list functions, so...) I think we can safely assume that people using peano numbers aren't actually

Re: [Haskell-cafe] what is f=f (not) doing ?

2007-09-23 Thread Neil Mitchell
Hi I'm not sure, but since it would require the detection of an evaluation that does not terminate, it comes down to the halting problem, which is not generally solvable. Maybe the experts can confirm my intuition? I think your intuition is off. This isn't the problem of detecting that a

[Haskell-cafe] Re: [Haskell] Math behind Haskell

2007-09-23 Thread Neil Mitchell
Hi The haskell-cafe@ mailing list is more appropriate for messages such as this. haskell@ is just for announcements (it should be called haskell-annouce@ !) * Lambda calculus - the basis of functional languages * Category theory - where all these mysterious things like monads, arrows, and

[Haskell-cafe] PROPOSAL: Rename haskell@ to haskell-announce@

2007-09-23 Thread Neil Mitchell
Hi I've just replied to another first poster with wrong list. Its entirely not their fault, but its also probably a bit off-putting that your very first post gets a (very polite) you got it wrong message. To steal the reasons and explanations from Ian: - pretty much what

Re: [Haskell-cafe] PROPOSAL: Rename haskell@ to haskell-announce@

2007-09-23 Thread Neil Mitchell
Hi I agree. Unless... do some people subscribe to haskell@ (not haskell-cafe@) and like the existing stuff that's sent there (not all announcements... I'm not sure if I'd call e.g. Oleg's occasional demonstrations announcements even)? There are four things sent to the haskell list@ 1)

Re: [Haskell-cafe] what is f=f (not) doing ?

2007-09-22 Thread Neil Mitchell
Hi f = f and then try to evaluate 'f' in GHCi, as one would expect, the interpreter never returns an answer. The funny thing is that, while it is stuck in an infinite loop, GHCi doesn't seem to use any CPU time at all. It's called a black hole. The runtime can detect that f directly

Re: [Haskell-cafe] GHC 6.7 on Windows / containers-0.1 package?

2007-09-21 Thread Neil Mitchell
All dependencies etc. have changed when going to 6.7/6.8 - you are probably better off using 6.6.1 for now. That's a petty. I really would like to experiment with the debugger :-) Me too! A proper release of GHC 6.8 is very nearby, so you should get your wish then. Thanks Neil

Re: [Haskell-cafe] help me ! who has vty ?

2007-09-19 Thread Neil Mitchell
Hi who has vty for haskell? I can't find the right one so who can mail one to me ? http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vty-3.0.0 hackage has a lot of packages, and is always a good place to start a search. Thanks Neil ___

Re: [Haskell-cafe] Why isn't pattern matching lazy by default?

2007-09-19 Thread Neil Mitchell
Hi Now why isn't pattern matching lazy by default? This seems odd for a newbie since everything else is lazy by default. f ~(x:xs) = rhs f ~[] = rhs' Now guess what f [] does... If you use a where binding then pattern matching is lazy. Thanks Neil

Re: [Haskell-cafe] (win)hipe for Haskell?

2007-09-19 Thread Neil Mitchell
Hi Peter, During a googling session, I can across (Win)HIPE, a visualization program for the functional language HOPE. See http://dalila.sip.ucm.es/~cpareja/winhipe IMHO a similar tool would be a nice for learning/teaching Haskell; does that exist, or something else that comes close?

Re: [Haskell-cafe] (win)hipe for Haskell?

2007-09-19 Thread Neil Mitchell
Hi Yes, Hat does this http://www.haskell.org/hat/ (if you can get it to work, I typically have little success) Thanks. WinHIPE uses graphics and animation. If briefly encountered Hat before, but I had the impression it did not visualize the graphs using graphics, only text. Is this

Re: [Haskell-cafe] GHC 6.7 on Windows / containers-0.1 package?

2007-09-19 Thread Neil Mitchell
Hi Peter, So I grabbed ghc-6.7.20070824 (=the latest one for Windows I could find) and the extra-libs, compiled and installed the GLUT package (which I needed), but when I compile my library, I get Could not find module `Data.Map': it is a member of package containers-0.1,

Re: [Haskell-cafe] Library Process (was Building production stable software in Haskell)

2007-09-18 Thread Neil Mitchell
Hi What is the process for the inclusion of modules / packages in ghc, hugs and other compilers interpreters? Propose to have the packaged added. There is a very low chance of this being accepted. The only packages to have recently been added were FilePath and ByteString, both of which were

Re: [Haskell-cafe] Library Process (was Building production stable software in Haskell)

2007-09-18 Thread Neil Mitchell
Hi I think there is a niche for a subset of the hackage libraries providing an officially sanctioned standard library collection. Currently, hackage includes, well, everything. As such, it is a useful resource, but it would be useful to have a partitioning into two levels, where the SLC

Re: [Haskell-cafe] unique id for data types

2007-09-18 Thread Neil Mitchell
Hi Barney, This may be of interest, since all types already have an Int associated with them: http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Typeable.html#v%3AtypeRepKey Thanks Neil On 9/18/07, Barney Hilken [EMAIL PROTECTED] wrote: In order to make my records system

Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-18 Thread Neil Mitchell
Hi okay, but this fails in some cases. i wrote a package to obtain financial quotes. yahoo changed the webservice url on me. i rolled out a change within a day. in your model, people suffer a broken service for two weeks. I don't think Yahoo will change the syntax or semantics of filepaths

Re: STG to JavaScript translation

2007-09-17 Thread Neil Mitchell
Hi Are you aware that Dimitry is still working on ycr2js - and has made great progress. There are details available in The Monad Reader, issue 7 (http://www.haskell.org/haskellwiki/The_Monad.Reader) Thanks Neil On 9/17/07, Victor Nazarov [EMAIL PROTECTED] wrote: Hello. I'm working on the

Re: STG to JavaScript translation

2007-09-17 Thread Neil Mitchell
Hi case e of b { pati - rhsi } * evaluates 'e', * binds the resulting value to 'b', * performs case analysis on the result to find which alternative to choose * binds the variables of the pattern to the components of the value The Yhc.Core translator converts this to: let b = e in case b

Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-17 Thread Neil Mitchell
Hi Would you care to explain why you have this aversion to libs that aren't bundled with ghc? They are less stable and have less quality control. It is also an additional burden for a user to install the library to get the program working. cabal-install should fix the second. Some useful

Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-17 Thread Neil Mitchell
Hi What's bad about stagnation is that nobody will bother to produce anything better (at least not as a fully polished publicly available open source project), precisely because they have little chance of achieving a user base exceeding 1 (at least not if the attitude of David and Neil is

Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-17 Thread Neil Mitchell
Hi They are less stable and have less quality control. Surely you jest? I see no evidence of this, rather the contrary in fact. No, dead serious. The libraries have a library submission process. Compare me changing my tagsoup library, to me changing my filepath library which comes bundled

Re: [Haskell-cafe] Re: [Haskell] question about a failure to generalize

2007-09-15 Thread Neil Mitchell
Hi Monomorphism restriction? Replacing fold with foldRegsUsed would work because there's a type signature for foldRegsUsed. That looks like it. Another solution would be: fold = foldRegsUsed becomes: fold x = foldRegsUsed x Now the monomorphism restriction doesn't kick in because fold

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-13 Thread Neil Mitchell
Hi Although I appluad the semantics of the safe package, I'm not delighted with the idea of replacing our concise elegant standard library names with uglyAndRatherLongCamelCaseNamesThatCouldBePerlOrEvenJava though. Conciseness of expression is a virtue. They aren't that long - merely an

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-13 Thread Neil Mitchell
Hi Similarly, I expect foo and foo' to be equivalent, except for strictness properties, but perhaps an underscore could be used for slightly different behaviors (interpretations, as it were)? tail_ or zip_, anyone? There are 4 variants of tail: tail :: [a] - [a] -- normal tailDef :: [a] -

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-13 Thread Neil Mitchell
Hi Is there a reason for not having tailM :: Monad m = [a] - m [a] which, at least for me, is much more useful? No, that probably is a much more sensible choice. Patches welcome :) Thanks Neil ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-13 Thread Neil Mitchell
Hi From the logical point of view tailMay is the right one. It pushes the error handling to the caller programm. tail = fromJust . tailMay The error messages suffer: tail [] = error: fromJust Nothing That's why I supplied tailNote, where tailNote foo broke its invariant! [] gives the

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-12 Thread Neil Mitchell
Hi A more serious point is that in some cases we might want take to underapproximate, or zip to truncate (or tail [] = [] ?). I don't think there's always a clear library choice here. I have a zipWithEq function I often use, which crashes if the zip'd lists aren't equal. I also have tailSafe

Re: [Haskell-cafe] Re: Is take behaving correctly?

2007-09-12 Thread Neil Mitchell
Hi The same should apply to head and tail. head or tail of [] should be []. What does the list think? Disagree, strongly. Its not even possible for head, since [a] - a. Wadler's theorems for free states that if head is given an empty list the _only_ thing it can do is crash. Thanks Neil

Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-11 Thread Neil Mitchell
Hi Peter, The way I see it as a newcomer, Haskell shifts the typical imperical programming bugs like null pointers and buffer overruns towards space/time leaks, causing programs that either take exponentially long to complete, stack overflow, or fill up the swap file on disc because they

Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-11 Thread Neil Mitchell
Hi Well, I actually meant more something like the imperative equivalences of code coverage tools and unit testing tools, hpc and HUnit cover these two things pretty perfectly. hpc will be in GHC 6.8, and its really cool :-) because I've read rumors that in Haskell, unit testing is more

Re: [Haskell-cafe] haskell and reflection

2007-09-11 Thread Neil Mitchell
Hi there is no runtime representation of type available for programmatic representation Data.Typeable.typeOf :: Typeable a = a - TypeRep there is no runtime representation of the type-inferencing or checking machinery Pretty much, no. The GHC API may provide some. there is no runtime

Re: [Haskell-cafe] WinHugs shortcut keys

2007-09-10 Thread Neil Mitchell
Hi Peter, It does not seem to have shortcut keys for reload, edit, etc... When do you use reload? WinHugs automatically reloads modified files, so I've never felt the need to reload things. Similarly for edit, typing just edit on its own isn't that useful unless you give it a module. However,

Re: [Haskell-cafe] WinHugs shortcut keys

2007-09-10 Thread Neil Mitchell
Hi Peter, Automatic reloading is of course THE best solution, and that's already in :-) Maybe it could help new users to display a simple message into the WinHugs statusbar like module XXX reloaded after external modification at HH:MM:SS) or something? But that's really minor. That would be

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Neil Mitchell
Hi I've never really understood what the benefit of this is... I mean, Google make the Google toolbar, but what's the point? Why not just click on the Google bookmark and type in your search? What benefits does installing a special addon provide? You can setup firefox so in the location

Re: [Haskell-cafe] Tiny documentation request

2007-09-09 Thread Neil Mitchell
Hi I have the following page bookmarked: http://haskell.org/ghc/docs/latest/html/libraries/ Just bookmark: http://haskell.org/hoogle It's not perfect, but it probably solves lots of your problems. A tip is to use Firefox's search as you type feature if you know the module name. This

Re: [Haskell-cafe] Speed of character reading in Haskell

2007-09-09 Thread Neil Mitchell
Hi (Some list operations are too expensive with ByteString but for most string processing it's perfectly fine and much faster than String). I'm sure it's true, but it's quite irrelevant to my question, which is why is using getChar so much slower than using getContents? Buffering, blocks

Re: Consistency of reserved operators and bang patterns

2007-09-08 Thread Neil Mitchell
Hi Re ! as an operator: This caused a number of complexities in the parsing of stuff, including shift-reduce conflicts. Someone would need to look into this, and determine that the rules are completely unambiguous. Backwards compatibility requires that it be implicitly imported from Prelude

Re: [Haskell-cafe] Hackage and GHC 6.8

2007-09-08 Thread Neil Mitchell
Hi Neil, Given that GHC 6.8 is just around the corner and, given how it has re-organised the libraries so that the dependencies in many (most/all) the packages in the hackage DB are now not correct. Is there a plan of how to get hackage DB up to speed with GHC 6.8 ? I think whatever we go

Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-08 Thread Neil Mitchell
Hi * Create sophisticated GUIs. Gtk2hs. Could do with a nice wrapper on that, but Conal is doing some interesting stuff, and I've got PropLang on the back burner. People are thinking the right thoughts, it just needs time. * Read and write standard binary file formats. (Images, compressed

Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-08 Thread Neil Mitchell
Hi Data.Binary is the low level frameworks, now people can pick up the rest. Last time I checked, there's about half a dozen binary packages. All incompatible. All with different design. Seriously not obvious which one to use... Data.Binary is the answer,

Re: file name letters

2007-09-05 Thread Neil Mitchell
Hi Ouch, the well-known case-preserving but case-ignoring default behaviour of MacOS X's file system bites someone again. In short: Mac OS X's filesystem ignores case when opening a file, but preserves case when creating. FWIW, Windows has exactly the same behaviour. Technically you can

Re: [Haskell-cafe] Hawiki articles

2007-09-03 Thread Neil Mitchell
Hi Bring back HaWiki! I couldn't agree more! We built up an incredible array of articles, by fantastic authors with stunning content - which we then deleted... I learnt much from the old wiki, and it would be a shame if others didn't get that opportunity. Of course it should be static only,

Re: [Haskell-cafe] Hawiki articles

2007-09-03 Thread Neil Mitchell
Hi There are two entirely separate issues in this thread - let's not confuse them. 1) The old HaWiki content is good and unavailable. I want it made available, in whatever form is appropriate. Please :-) 2) Licensing - the old content cannot be dumped onto the new wiki. My personal view is who

Re: Derived instances

2007-08-31 Thread Neil Mitchell
Hi I have just discovered Generics in Haskell and, writing some code with GHC, I wondered about the portability of my code. If you use Data.Generics, your code is not portable - no other Haskell implementation supports the necessary bits. I can use the -fgenerics to automatically derive

Re: hello

2007-08-29 Thread Neil Mitchell
Hi hello thanks for my new subscription, do I need to pay a fee or is it free to join ? This is a mailing list. Its totally free, and for the purpose of discussing future improvements to the Haskell standard. If you just wait, you'll find interesting discussions flowing into your inbox. If

Re: [Haskell-cafe] defining mapPairs function

2007-08-29 Thread Neil Mitchell
Hi Alexteslin, I just came across with this question on the exam and can not think of implementing it. mapPair :: (a - a - a) - [a] - [a] such that mapPairs f [x1, x2, x3, x4...] = [f x1 x2, f x3 x4,...] I would implement this using direct recursion. As a starting point, the standard

Re: [Haskell-cafe] defining mapPairs function

2007-08-29 Thread Neil Mitchell
Hi mapPairs :: (a - a - a) - [a] - [a] mapPairs f [x] = [x] mapPairs f [] = [] mapPairs f (x:xs) = f x (head xs) : mapPairs f (tail xs) It looks like it works, but you can get a better version by changing the last line: mapPairs f (x:y:zs) = ... - left as an exercise, but no need for head

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Neil Mitchell
Hi - Blogging software. (Because there isn't enough of it in the world yet.) Hope (google: Haskell Hope) - A wiki program. (Ditto.) Flippi (google: Haskell Flippi) - A general CMS. Hope - An interactive function plotter. (GNUplot is nice, but it can't plot recursive functions...) None

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Neil Mitchell
Hi Flippi (google: Haskell Flippi) ...and yet haskell.org uses WikiMedia? (Which is written in something bizzare like Perl...) Yes, but WikiMedia is a result of years of work, Flippi is a lot less. Wikipedia uses WikiMedia - its a tried and proven solution. - A graphical programming

Re: [Haskell-cafe] Haskell on the Playstation 3? :-)

2007-08-25 Thread Neil Mitchell
Hi Another option would be to port the yhi bytecode interpreter to run on PalmOS. I tried this, but I ran into three problems: 1. libgmp dependency This is no longer an issue, we now have a flag to not require libgmp, which makes type Integer = Int 2. build system requires Python

[Haskell-cafe] Re: [Haskell] Issue about use of WinHugs

2007-08-24 Thread Neil Mitchell
Hi I'm new to WinHugs, what's wrong with isUpper of my WinHugs? Nothing. The book/tutorial you are going from is out of date. Before using the isUpper/isLower functions you first have to type :load Char: Hugs :load Char Hugs filter isUpper ABCDEfgh ABCDE The :load Char loads the Char module

Re: [Haskell-cafe] GHC optimisations

2007-08-23 Thread Neil Mitchell
Hi Its (==) isn't reflexive (is it transitive? probably, at least if there aren't too many optimizations, but floating-point transitive equality isn't very useful). It's not even referentially transparent in all cases. a == b may fail while the double's are in the high precision registers,

Re: [Haskell-cafe] Re: Graph reduction [Was: Where is StackOverflow on the Wiki?]

2007-08-23 Thread Neil Mitchell
Hi Yeah, the precise details may vary, even :) But for teaching, an automatic tool that does graph reduction would be great. I don't mind if it's sloppy (directly apply definitions pattern matching VS everything is a lambda abstraction) and only does simply typed lambda calculus (no

Re: [Haskell-cafe] GHC optimisations

2007-08-22 Thread Neil Mitchell
Hi Other rules that could be interesting are: forall a b. fromInteger a + fromInteger b = fromInteger (a + b) forall a b. fromInteger a * fromInteger b = fromInteger (a * b) This is wrong, since the class function can do what it wants. Imagine: instance Num String where (+) = (++)

Re: [Haskell-cafe] GHC optimisations

2007-08-22 Thread Neil Mitchell
Hi If Num obeys ring axioms, fromInteger is a perfectly fine ring-homomorphism. (It's also the first or second homomorphism taught.) Does Int obey these axioms? I'm thinking that assuming properties about things such as numbers is very likely to go wrong very quickly. Monads you might be able

Re: [Haskell-cafe] help understanding lazy evaluation

2007-08-22 Thread Neil Mitchell
Hi factors :: Int - [Int] factors n = [x | x - [1..n], n `mod` x == 0] prime :: Int - Bool prime n = factors n == [1, n] My vague intuition said we either need factors or we don't, we do because we need to perform the test, so we compute it. That's wrong, so a posteriori the

Re: [Haskell-cafe] GHC optimisations

2007-08-21 Thread Neil Mitchell
Hi Wait, you're saying that ghc can produce pure c-code, that doesnt contain any assembly code, and that runs as fast as ghc code that does contain assembly? No. It can produce pure C code (unregistered), but to get high performance it processes the output assembly afterwards (registered).

Re: [Haskell-cafe] Generic data constructor in pattern?

2007-08-21 Thread Neil Mitchell
Hi Peter, liftV1 f (V x y) = V (f x) (f y) liftV2 f (V x1 y1) (V x2 y2) = V (f x1 x2) (f y1 y2) liftM1 f (M x y) = M (f x) (f y) liftM2 f (M x1 y1) (M x2 y2) = M (f x1 x2) (f y1 y2) Both pairs of lift functions have almost identical implementations. Can I

Re: [Haskell-cafe] Re: Newbie question: Where is StackOverflow on the Wiki?

2007-08-21 Thread Neil Mitchell
Hi sum (enum 1 10) = sum' 0 (enum 1 10) = ... sum' 36 (9 : enum (9+1) 10) = (sum' $! (36+9)) (enum (9+1) 10) = sum' 45 (enum (9+1) 10) = sum' 45 [] = 45 (I need to find some way to automate making these trails

Re: [Haskell-cafe] is there a way to patch the build-depends line of a cabal file without breaking backwards compatibility?

2007-08-20 Thread Neil Mitchell
Hi Distribution/Simple/InstallDirs.hs:267:36: Not in scope: `dropDrive' [EMAIL PROTECTED]:~/installs/cabal-head/caballs -l `which ghc` lrwxrwxrwx 1 root root 31 2007-08-20 11:08 /usr/local/bin/ghc - /usr/local/bin/ghc-6.7.20070816 You'll need to upgrade the filepath library as well,

[Haskell-cafe] List comprehension desugaring

2007-08-19 Thread Neil Mitchell
Hi, The Haskell desugaring for list comprehensions is given in: http://haskell.org/onlinereport/exps.html#list-comprehensions All the rules seem to be left to right rewrites, apart from the second one, which seems to be right to left. Is there some deep reason for this, or is this accidental.

[Haskell-cafe] Re: List comprehension desugaring

2007-08-19 Thread Neil Mitchell
Hi Sorry for the noise, I've now realised they are a left to right rewrite system, the second rule is required to set up the base case. Thanks Neil On 8/19/07, Neil Mitchell [EMAIL PROTECTED] wrote: Hi, The Haskell desugaring for list comprehensions is given in: http://haskell.org

Re: [Haskell-cafe] ghc 6.7 /6.8

2007-08-19 Thread Neil Mitchell
Hi will 6.7 be released, or will only 6.8 be ? 6.7 is the HEAD branch, 6.8 will be released. -in that case, does the 6.8 branch means the freeze is on, and what would be the target for 6.8 ? Q3/2007 ? Q4 ? Soon, in the next month - according to latest targets/estimates. ( context: I am

Re: hyperlinked haskell 98 grammar

2007-08-16 Thread Neil Mitchell
Hi Peter, A nice application. One suggestion: I would have implemented it so that a maximum on one backward hyperlink menu could be visible at once - try clicking on two RHS's and you'll get too menus visible at the same time. You also might want to mail this out on haskell-cafe - which is more

Re: hyperlinked haskell 98 grammar

2007-08-16 Thread Neil Mitchell
Hi In addition, perhaps this should be relocated to haskell.org, if your server is not suitable for a large volume of users. I think it should also be integrated somewhere (perhaps a link from the HTML report, and certainly on the wiki) Thanks Neil On 8/16/07, Neil Mitchell [EMAIL PROTECTED

Re: [Haskell-cafe] Pattern matching articles/explanations

2007-08-16 Thread Neil Mitchell
Hi So what I noticed that A Gentle Introduction to Haskell mentioned that wild-cards are useful in constructors. For example: head (x:_) = x So, does that offer any performance benefits over: head (x:xs) = x No. They are exactly the same. _ simply means a new unique name. Or is it

Re: [Haskell-cafe] ANNOUNCE: Guihaskell and PropLang 0.1

2007-08-15 Thread Neil Mitchell
Hi Dougal, It's cross platform, and will use GHC and Hugs if they are already installed. Thanks Neil On 8/15/07, Dougal Stanton [EMAIL PROTECTED] wrote: On 15/08/07, Asumu Takikawa [EMAIL PROTECTED] wrote: == GuiHaskell Guihaskell is a graphical REPL using PropLang, a GUI combinator

Re: Unexpected boxing in generated code

2007-08-07 Thread Neil Mitchell
Hi Simon, OK this is an interesting one. Here's the smallest program that demonstrates the problem. foreign import ccall unsafe stdio.h getchar getchar :: IO CInt f56 :: State# RealWorld - Int - Int f56 s v2 = case (unIO getchar s) of (# s' , v6 #) - case v2 of

Re: [Haskell-cafe] Re: Navigating Haddock

2007-08-06 Thread Neil Mitchell
Hi a) use hoogle (haskell.org/hoogle). You can use hoogle to find functions by types. But I don't know haw to create a query such as ... - Document - ... Hoogle unfortunately doesn't do that very well, although that would be a great feature. Wait for version 4 :-) - I've added _ 's for

Re: [Haskell-cafe] Type without a data constructor?

2007-08-06 Thread Neil Mitchell
Hi I by mistake defined a type which did not specify a data constructor So the question is what are types with no constructors good for? A simple example would be appreciated. They are called phantom types, and can be used for ensuring properties at the type level. I wrote about them in a

Re: [Haskell-cafe] How odd...

2007-08-04 Thread Neil Mitchell
Hi If you just use Catch (http://www-users.cs.york.ac.uk/~ndm/catch/): foo x | x 0 = ... | x == 0 = ... | x 0 = ... This gives an error. Something identical to this code is in Data.FiniteMap, and indeed, when using floats and NaN's (or just silly Ord classes) you can cause

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi Perhaps we need to cool this thread down a little bit, and refocus. I personally choose never to use ++ as anything but a statement, since my brain works that way. Other people find different things natural, so can pick what they choose. The one thing you can guarantee is that discussing it

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
do block, in left-to-right order. Monadic expressions in let statements are allowed. Outside a do block, monadic subexpressions are banned. Despite all these complications, it's still a great idea, and would be lovely to have! Thanks Neil and Tom On 8/3/07, Neil Mitchell [EMAIL PROTECTED

Re: [Haskell-cafe] Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi Can you combine let and do? do let x = (- a) f x Right. In effect, as a matter of fact, the notation x - a would become equivalent to let x = (- a) Hmm, interesting. Consider: let x = 12 let x = (- x) Currently, in let x = ... the x is in scope on the right hand

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi do { do { a; b}; c } is still the same as do { a; do { b; c } } yes? no? perhaps? sometimes? how long did it take you? I'm not entirely sure I understand the point here. The monad laws are defined in terms of = and return. They have never had anything to do with do,

Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi let x = 12 let x = (- x) Okay, so the desugaring process wouldn't terminate in that case! One could either: (a) try to retain the equivalence in theory, but make it illegal to use x in a monadic subexpression when defining x; (b) we could abandon my claim that they are equivalent.

Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi if you write : let x = (-a):x is it possible that is desugars into : temp -a let x = temp:x that would'nt work ? That would work, since 'a' doesn't refer to 'x'. I can't think of a real example where it becomes an issue, but the scope within 'a' has changed. Also : do case x of

Re: [Haskell-cafe] Re: Re: Re: monad subexpressions

2007-08-03 Thread Neil Mitchell
Hi do case x of [] - return 1 (y:ys) - g y = \temp - f temp See the rule about always binding to the previous line of a do block. This case then violates that. I assumed that the example was equivalent to : do case x of [] - return 1 (y:ys)

Re: [Haskell-cafe] positive Int

2007-08-02 Thread Neil Mitchell
Hi Catch (www.cs.york.ac.uk/~ndm/catch) can infer that certain uses of numbers fit into the {Neg, Zero, One, Pos} abstraction - so for example it can infer that length returns {Zero, One, Pos}, but not Neg. If you then do: xs !! length ys It will detect that length ys is natural, and will be

Re: [Haskell-cafe] Perfect example

2007-08-02 Thread Neil Mitchell
Hi I know that Audrey Tang (the Pugs project) has used hamming numbers for this, see http://www.perl.com/lpt/a/959 Thanks Neil On 8/2/07, Jon Harrop [EMAIL PROTECTED] wrote: Any suggestions for a perfect example that uniquely demonstrates the benefits of the Haskell language compared to

Re: [Haskell-cafe] monad subexpressions

2007-08-02 Thread Neil Mitchell
Hi Chris, I've heard Simon (Peyton-Jones) twice now mention the desire to be able to embed a monadic subexpression into a monad. I think this is a fantastic idea, please do so! $( expr ) -- conflicts with template haskell ( - expr ) -- makes sense, and I think it's unambiguous

Re: [Haskell-cafe] positive Int

2007-08-02 Thread Neil Mitchell
Hi It will detect that length ys is natural, and will be safe. However, if you pass any arbitrary value as the index to !! it will warn of a possible pattern match error. I hope catch doesn't actually think that's safe, because it's not - set ys = xs = [1,2,3,4,5], you'll get an index

<    2   3   4   5   6   7   8   9   10   11   >