[Haskell-cafe] Announce: Blip, a bytecode compiler for Python 3 (implemented in Haskell)

2013-04-17 Thread Bernie Pope
): https://github.com/bjpop/blip/wiki/Not-yet-implemented-features Wiki for more information: https://github.com/bjpop/blip/wiki Cheers, Bernie Pope. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell-cafe] On the purity of Haskell

2011-12-28 Thread Bernie Pope
On 29 December 2011 10:51, Steve Horne sh006d3...@blueyonder.co.uk wrote: As Simon Baron-Cohen says in Tackling the Awkward Squad... I think you've mixed up your Simons; that should be Simon Peyton Jones. Cheers, Bernie. ___ Haskell-Cafe mailing

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-16 Thread Bernie Pope
On 16 May 2011 19:56, Simon Marlow marlo...@gmail.com wrote: On 13/05/2011 21:12, Bernie Pope wrote: Could you please point me to more information about the sequential consistency of IORefs? I was looking for something about this recently but couldn't find it. I don't see anything

Re: [Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-13 Thread Bernie Pope
On 13 May 2011 19:06, Simon Marlow marlo...@gmail.com wrote: As far as memory consistency goes, we claim to provide sequential consistency for IORef and IOArray operations, but not for peeks and pokes. Hi Simon, Could you please point me to more information about the sequential consistency of

Re: [Haskell-cafe] help with dynamic load

2011-03-25 Thread Bernie Pope
On 26 March 2011 05:57, Rob Nikander rob.nikan...@gmail.com wrote: I'm trying to use the 'plugins' package.  Since I already posted to stackoverflow I'll just link to that.  I posted a simple program that I thought would work, but mostly doesn't.   Any pointers, appreciated.

Re: [Haskell-cafe] Byte Histogram

2011-02-06 Thread Bernie Pope
On 6 February 2011 02:40, Andrew Coppin andrewcop...@btinternet.com wrote: Then again, if you could actually single-step through a Haskell program's execution, most strictness issues would become quite shallow. You can single-step through a Haskell program's execution with the GHCi debugger.

Re: [Haskell-cafe] [ANNOUNCE] haskell-mpi-1.0.0

2010-12-13 Thread Bernie Pope
Done. Cheers, Bernie. On 14 December 2010 13:13, Thomas Schilling nomin...@googlemail.com wrote: Could you please add your package to the wiki section at http://haskell.org/haskellwiki/Applications_and_libraries/Concurrency_and_parallelism#MPI ?

Re: [Haskell-cafe] Regression test utility suggestions?

2010-10-22 Thread Bernie Pope
On 22 October 2010 08:38, Peter Schmitz ps.hask...@gmail.com wrote: I am seeking suggestions for a regression test utility or framework to use while developing in Haskell (in a MS Windows environment). [snip] For this kind of task I use shelltestrunner

Re: [Haskell-cafe] An interesting paper from Google

2010-10-16 Thread Bernie Pope
On 17 October 2010 11:25, Dan Doel dan.d...@gmail.com wrote: On Saturday 16 October 2010 7:04:23 pm Ben Millwood wrote: On Fri, Oct 15, 2010 at 9:28 PM, Andrew Coppin andrewcop...@btinternet.com wrote: I'm still quite surprised that there's no tool anywhere which will trivially print out

Re: [Haskell-cafe] Thunks

2010-10-15 Thread Bernie Pope
On 15 October 2010 07:53, Mihai Maruseac mihai.marus...@gmail.com wrote: Hi, Is there a way to determine the order in which thunks are created and expanded/evaluated in Haskell (GHC)? I'm looking mainly at some existing interface but if there is only something in the GHC source it will

Re: [Haskell-cafe] Re: Shared thunk optimization. Looking to solidify my understanding

2010-09-24 Thread Bernie Pope
On 25 September 2010 07:58, David Sankel cam...@gmail.com wrote: Thanks everyone for your responses. I found them very helpful. This is my current understanding, please correct me where I am wrong: When using Launchbury's Natural Semantics (LNS) as an operational model, this optimization is

Re: [Haskell-cafe] cabal problem on OS X

2010-09-19 Thread Bernie Pope
On 10 June 2010 01:08, Gregory Collins g...@gregorycollins.net wrote: Jeroen Weijers jeroenweijers+haskellc...@gmail.com writes: Hi, For me it turned out to be some problem with MacPorts, removing MacPorts (with all its installed ports) solved the problem regarding ZLib. I assume that a

Re: [Haskell-cafe] Actors and message-passing a la Erlang

2010-07-25 Thread Bernie Pope
On 26 July 2010 06:55, Yves Parès limestr...@gmail.com wrote: I've been studying Erlang and Scala, and I was wondering if someone has already implemented an actors and message passing framework for concurrent and distributed programs in Haskell. I've recently been working on MPI bindings for

[Haskell-cafe] How to set a GHC option for a single module and a specific version of GHC?

2010-06-07 Thread Bernie Pope
Hi, I'm looking for a way to set a GHC compile option on a specific module (not every module in the program) but only for a specific version of GHC. Ideally within the confines of cabal, and in a portable way. GHC provides the OPTIONS_GHC pragma, but it does not appear to provide a way for the

[Haskell-cafe] Announce: berp, an implementation of Python 3, in Haskell

2010-06-01 Thread Bernie Pope
I'm pleased to announce the first public release of berp, version 0.0.2. Berp is (the beginnings of) an implementation of Python 3, written in Haskell. It provides a compiler and an interpreter. In both cases the input Python program is translated into Haskell code. The compiler turns the Haskell

Re: [Haskell-cafe] Getting used and available memory

2010-04-27 Thread Bernie Pope
On 27 April 2010 17:55, Don Stewart d...@galois.com wrote: We could bind to Rts.c in the GHC runtime, and get all the stats programmatically that you can get with +RTS -s A long time ago I made a simple binding which has been packaged for cabal by Gwern Branwen. The package is called

Re: [Haskell-cafe] multi-ghc: Managing Multiple GHC Distributions

2010-04-08 Thread Bernie Pope
On 8 April 2010 19:00, Sean Leather leat...@cs.uu.nl wrote: I created a few tools to help me manage multiple GHC distributions in a Bash shell environment. Perhaps it's useful to others.   http://github.com/spl/multi-ghc Feedback welcome. I'd also like to know if something similar exists.

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Bernie Pope
On 27 March 2010 04:46, Rafael Cunha de Almeida almeida...@gmail.com wrote: During a talk with a friend I came up with two programs, one written in C and another in haskell. snip The Haskell version: real    0m45.335s user    0m45.275s sys     0m0.004s against the C version: real    

Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-24 Thread Bernie Pope
On 22 March 2010 11:05, Carter Schonwald carter.schonw...@gmail.com wrote: apparently sometimes even though cabal can figure out the dependencies for a package you want, it gets confused (or something) when it needs to figure out the transitive dependencies (that which needs to be installed for

Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-24 Thread Bernie Pope
On 25 March 2010 14:23, Ivan Miljenovic ivan.miljeno...@gmail.com wrote: On 25 March 2010 12:21, Bernie Pope florbit...@gmail.com wrote: Yes, I tried that, but unfortunately it falls over with: Language/Haskell/TH/Quote.hs:31:12:    Not in scope: data constructor `CharConstr' cabal: Error

Re: [Haskell-cafe] ANN: Salvia-1.0.0

2010-03-21 Thread Bernie Pope
On 22 March 2010 03:05, Sebastiaan Visser sfvis...@cs.uu.nl wrote: Straight from Zurihac: I'm very pleased to announce the 1.0.0 release of the Salvia web server. Salvia is a feature rich web server and web application framework that can be used to write dynamic websites in Haskell. From

Re: [Haskell-cafe] Proposal: Australian Hackathon

2010-03-16 Thread Bernie Pope
On 16 March 2010 16:28, Ivan Miljenovic ivan.miljeno...@gmail.com wrote: Would other Australians be interested in having our own Hackathon (why should all those northerners have all the fun)?  I'm thinking about organising it to be in the July break between university semesters. Yes, I am

Re: [Haskell-cafe] Alex Lexer: Trying to get rid of Alex

2010-02-23 Thread Bernie Pope
On 23 February 2010 20:15, Amit Deshwar amit.desh...@gmail.com wrote: Hi Haskell-cafe My problem:  I'm trying to obtain the current position of the lexer once it reaches the end of the file (line and row number). I'm trying to do this in a function: getEndPosition = do   (a,b,c) -

Re: [Haskell-cafe] haskell-src type inference algorithm?

2010-02-11 Thread Bernie Pope
On 12 February 2010 10:13, Niklas Broberg niklas.brob...@gmail.com wrote: Anyone know of a type inference utility that can run right on haskell-src types? or one that could be easily adapted? This is very high on my wish-list for haskell-src-exts, and I'm hoping the stuff Lennart will

Re: [Haskell-cafe] parallel and distributed haskell?

2010-02-11 Thread Bernie Pope
On 17 December 2009 06:21, Scott A. Waterman tswater...@gmail.com wrote: I feel there is quite a bit of latent interest in the subject here, but relatively little active development (compared to erlang, clojure, etc.) Can anyone involved give a quick overview (or pointers to one)? It would be

Re: [Haskell-cafe] getting data through foreign layer without marshalling

2009-12-13 Thread Bernie Pope
2009/12/14 Donn Cave d...@avvanta.com: I'm working with a C++ application library, of the sort where you instantiate a subclass of the library object and it dispatches your functions on receipt of various events.  With multiple OS threads, by the way. This works all right so far, with some

Re: [Haskell-cafe] Is anyone reading Pattern Calculus by Barry Jay?

2009-12-06 Thread Bernie Pope
2009/12/7 Duane Johnson duane.john...@gmail.com: I just bought a copy of Pattern Calculus [1] by Barry Jay and I would like to discuss the lambda- and pattern-calculus with anyone who is interested.  Is there anyone else here who is reading the book and would like to discuss here (if it is

[Haskell-cafe] Announce: language-python version 0.2 now available

2009-11-04 Thread Bernie Pope
I'm pleased to announce that version 0.2 of the language-python package is now available on hackage: http://hackage.haskell.org/package/language-python language-python provides lexical analysis and parsing for Python. Major features of this release: - Support for versions 2.x and 3.x of

Re: [Haskell-cafe] Announce: language-python version 0.2 now available

2009-11-04 Thread Bernie Pope
2009/11/5 Tom Tobin korp...@korpios.com: On Wed, Nov 4, 2009 at 7:03 AM, Bernie Pope florbit...@gmail.com wrote: I'm pleased to announce that version 0.2 of the language-python package is now available on hackage:   http://hackage.haskell.org/package/language-python language-python provides

Re: [Haskell-cafe] Announce: language-python version 0.2 now available

2009-11-04 Thread Bernie Pope
2009/11/5 Deniz Dogan deniz.a.m.do...@gmail.com: 2009/11/4 Bernie Pope florbit...@gmail.com: Main shortcomings of this release:   - Support for Unicode is limited (waiting on Unicode support in Alex). There was an announcement a while back on this list from Jean-Philippe Bernardy about

Re: [Haskell-cafe] ANNOUNCE: graphtype — A simple tool to illustrate dependencies between Haskell types

2009-08-24 Thread Bernie Pope
2009/8/24 Max Desyatov explicitc...@googlemail.com: graphtype was developed to visualise type declarations in you Haskell source files.  It produces .dot-file for subsequent processing with graphviz. Anyway, graphtype is fairly usable.  Leave here your questions, suggestions and have fun

[Haskell-cafe] ANNOUNCE: ministg-0.2, an interpreter for STG operational semantics

2009-08-20 Thread Bernie Pope
I'm pleased to announce the first public release of Ministg. Ministg is an interpreter for a high-level, small-step, operational semantics for the STG machine. The STG machine is the abstract machine at the core of GHC. The operational semantics used in Ministg is taken from the paper Making a

Re: [Haskell-cafe] Keeping an indexed collection of values?

2009-08-19 Thread Bernie Pope
2009/8/19 Job Vranish jvran...@gmail.com: My first hacked up attempt is as follows: data IndexedCollection a = IndexedCollection {     nextKey        :: Int,     availableKeys :: [Int],     items                :: (IntMap Int a) } deriving (Show) emptyIndexedCollection ::

Re: [Haskell-cafe] unsafeDestructiveAssign?

2009-08-11 Thread Bernie Pope
2009/8/12 Job Vranish jvran...@gmail.com: Does anybody know if there is some unsafe IO function that would let me do destructive assignment? Something like: a = 5 main = do   veryUnsafeAndYouShouldNeverEveryCallThisFunction_DestructiveAssign a 8   print a 8 I doubt you will be able to

[Haskell-cafe] A voyage of undiscovery

2009-07-17 Thread Bernie Pope
2009/7/17 Andrew Coppin andrewcop...@btinternet.com: I've been working hard this week, and I'm stumbled upon something which is probably of absolutely no surprise to anybody but me. Consider the following expression:  (foo True, foo 'x') Is this expression well-typed? Astonishingly, the

Re: [Haskell-cafe] How i use GHC.Word.Word8 wit Int ?

2009-05-19 Thread Bernie Pope
2009/5/20 z_a...@163.com z_a...@163.com: Hi, friends rollDice :: Word8 - IO Word8 rollDice n = do   bracket (openFile /dev/random ReadMode) (hClose)       (\hd - do v -  fmap B.unpack (B.hGet hd 1)                  let v1 =  Data.List.head v                  return $ (v1 `mod` n) + 1)

Re: [Haskell-cafe] Writing a compiler in Hakell

2009-05-06 Thread Bernie Pope
2009/5/6 Rouan van Dalen rvda...@yahoo.co.uk I know about Happy.  Is that a good tool to use? Alex and Happy are used in (at least) these two packages:    http://hackage.haskell.org/cgi-bin/hackage-scripts/package/language-python    

Re: [Haskell-cafe] Few Alex questions

2009-05-01 Thread Bernie Pope
2009/5/1 Dimitry Golubovsky golubov...@gmail.com snip Can beginning of line (caret) be recognized by Alex? You can match the start of a line using a (left) context on a rule. See the docs here: http://www.haskell.org/alex/doc/html/alex-files.html#contexts Where it says: The left context

Re: [Haskell-cafe] Recommending Design concepts in programming languages

2009-04-29 Thread Bernie Pope
2009/4/30 Eugene Kirpichov ekirpic...@gmail.com Hi. To all those people who are in any sense interested in PL theory I'd like to recommend the book Design concepts in programming languages, because I am extremely impressed with it and because I, surprisingly, have not heard much about it.

Re: [Haskell-cafe] ghci debugger problem with :continue. is it broken, or is it me?

2009-04-28 Thread Bernie Pope
to modify your code style for the sake of the debugger, but I guess that is inevitable with procedural debuggers anyway. 2009/4/26 Bernie Pope florbit...@gmail.com: 2009/4/25 Thomas Hartman tphya...@gmail.com In the program below, can someone explain the following debugger output to me

Re: [Haskell-cafe] Question about implementing an off-side rule in Parsec 2

2009-04-28 Thread Bernie Pope
2009/4/28 Bas van Gijzel neneko...@gmail.com I'm doing a bachelor project focused on comparing parsers. One of the parser libraries I'm using is Parsec (2) and I'm going to implement a very small subset of haskell with it, with as most important feature the off-side rule (indentation based

Re: [Haskell-cafe] ghci debugger problem with :continue. is it broken, or is it me?

2009-04-26 Thread Bernie Pope
2009/4/25 Thomas Hartman tphya...@gmail.com In the program below, can someone explain the following debugger output to me? After :continue, shouldn't I hit the f breakpoint two more times? Why do I only hit the f breakpoint once? Is this a problem in the debugger?

Re: [Haskell-cafe] Is there a way to see the equation reduction?

2009-03-31 Thread Bernie Pope
2009/4/1 Daryoush Mehrtash dmehrt...@gmail.com I am trying to write out the execution of the recursive calls in mkDList examplehttp:/http://www.haskell.org/haskellwiki/Tying_the_Knot/www.haskell.org/haskellwiki/Tying_the_Knotfor different size lists. Is there a way in ghc, or ghci where for

[Haskell-cafe] Announce: language-python

2009-03-18 Thread Bernie Pope
Language-python provides a parser (and lexer) for Python written in Haskell. Currently it only supports version 3 of Python (the most recent version), but it will support version 2 in the future. The parser is implemented using Happy, and the lexer is implemented using Alex. Web page:

Re: Operational semantics. Was: [Haskell-cafe] What unsafeInterleaveIO is unsafe

2009-03-17 Thread Bernie Pope
On 17/03/2009, at 1:13 PM, Jonathan Cast wrote: [Totally OT tangent: How did operational semantics come to get its noun? The more I think about it, the more it seems like a precís of the implementation, rather than a truly semantic part of a language specification.] I haven't followed the

Re: [Haskell-cafe] Need an overview of FP-related research topics

2009-03-17 Thread Bernie Pope
On 17/03/2009, at 10:59 PM, Yitzchak Gale wrote: I would like some links that would give such a person a nice overview of the various active areas of FP-related research these days, leaning towards Haskell. I want to give him a fairly broad view of what is interesting and exciting, why various

Re: [Haskell-cafe] jhc speed

2009-02-25 Thread Bernie Pope
On 23/02/2009, at 2:22 AM, Luke Palmer wrote: By the way, coming up pretty soon, I will need a desugared annotated Haskell for Dana. If anybody has something like this in the works, I'd love to help with it. If it does not exist by the time I need it, I will make it, so if anyone is

Re: [Haskell-cafe] Memory

2009-02-16 Thread Bernie Pope
On 17/02/2009, at 3:56 PM, Jeff Douglas wrote: Hello All, The kind people at #haskell suggested I come to haskell-cafe for questions about haskell performance issues. I'm new to haskell, and I'm having a hard time understanding how to deal with memory leaks. I've been playing with some

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Bernie Pope
On 10/02/2009, at 4:45 AM, Tillmann Rendel wrote: A Haskell runtime system is a somewhat vaguely specified interpreter for (IO a) values. While it would be nice to a have a better specification of that interpreter, it is not part of the semantics of the language Haskell. While not

Re: [Haskell-cafe] Question re: denotational semantics in SPJ's Implementation of FPLs book

2009-02-01 Thread Bernie Pope
On 01/02/2009, at 8:49 PM, Devin Mullins wrote: I'm reading SPJ's The Implementation of Functional Programming Languages, and on page 32, it defines the multiplication operator in its extended lambda calculus as: Eval[[ * ]] a b = a x b Eval[[ * ]] _|_ b = _|_ Eval[[ * ]] a _|_ =

Re: [Haskell-cafe] Compilers

2008-11-26 Thread Bernie Pope
On 27/11/2008, at 8:35 AM, Andrew Coppin wrote: Jake McArthur wrote: Andrew Coppin wrote: Don Stewart wrote: Noteworthy, * lhc-20081121: “Lhc Haskell Compiler” Interesting. I can't find out any information about this... It is a fork of the JHC compiler, which should be

Re: [Haskell-cafe] Garbage collection as a dual of laziness?

2008-11-23 Thread Bernie Pope
On 23/11/2008, at 9:18 PM, Robin Green wrote: It occurs to me that garbage collection can be seen as some kind of dual of laziness. Laziness means deferring the creation of values until later in the future (or even never). A program optimisation might also have the same effect (of

Re: [Haskell-cafe] the ghc reflection thing?

2008-10-12 Thread Bernie Pope
Hi Vasili, Perhaps you are looking for GHC as a library: http://www.haskell.org/haskellwiki/GHC/As_a_library Cheers, Bernie. On 13/10/2008, at 2:26 PM, Galchin, Vasili wrote: hello, Several months ago I saw on the wiki or maybe it was a discussion on mechanism to get the ghc

Re: [Haskell-cafe] Laziness leaks

2008-06-04 Thread Bernie Pope
On 04/06/2008, at 10:12 AM, Ronald Guida wrote: I would ask, how do I examine the evaluation order of my code, but the answer is already available: use a debugger. Haskell already has debugging tools that do exactly what I need. (http://www.haskell.org/haskellwiki/Debugging) In particular,

Re: [Haskell-cafe] monadic debugging

2008-04-15 Thread Bernie Pope
On 16/04/2008, at 10:16 AM, Thomas Davie wrote: On 16 Apr 2008, at 00:04, Bulat Ziganshin wrote: Hello Vasili, Wednesday, April 16, 2008, 2:53:32 AM, you wrote: I have an Linux executable of my Haskell library and test case. I see there are several debuggers, e.g. Buddha, Hat, etc.

Re: [Haskell-cafe] retrospective on 'seq' - 'unsafeSeq' ?

2008-04-14 Thread Bernie Pope
to work with the standard types. Actually, Bernie Pope wrote some code for this [1, see GHC Heap Printing library] some time ago, although with the new primitives and changes made for :print in GHC 6.8, this would be way easier nowadays. No need to use StablePtrs, no need to turn on profiling

Re: [Haskell-cafe] help understanding pj-lester-book

2008-04-12 Thread Bernie Pope
On 13/04/2008, at 12:09 AM, minh thu wrote: Hi! I don't understand something in there : pj-lester-book : Implementing functional languages: a tutorial by Simon Peyton Jones and David Lester, available at http://research.microsoft.com/~simonpj/Papers/pj- lester-book/ eval/apply : Making a

Re: [Haskell-cafe] coerce (safe!)

2008-03-02 Thread Bernie Pope
On 03/03/2008, at 8:30 AM, Luke Palmer wrote: 2008/3/2 Roman Cheplyaka [EMAIL PROTECTED]: * Krzysztof Skrzętnicki [EMAIL PROTECTED] [2008-03-02 01:21:42 +0100] Well, it is simply coerce :: a - b coerce _ = undefined so coerce is simply empty function. But still, it is possible to

[Haskell-cafe] Announce: Melbourne Functional Programming Union

2008-02-11 Thread Bernie Pope
is under construction. At the moment, talks are held on Fridays, 1-2pm, in the ICT Building at Melbourne Uni. Contact Bernie Pope if you are interested in participating in the FPU. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] Somewhat random history question - chicken and egg

2007-11-11 Thread Bernie Pope
On 12/11/2007, at 4:32 AM, Neil Mitchell wrote: Hi bear no resemblence to any machine-level constructs, and it seems unthinkable that you could possibly write such a compiler in anything but Haskell itself. Hugs is written in C. Really? :-. Really :-) (Seriously, how big is

Re: [Haskell-cafe] Somewhat random history question - chicken and egg

2007-11-11 Thread Bernie Pope
On 12/11/2007, at 9:26 AM, [EMAIL PROTECTED] wrote: But... tell me please, ANYONE, who takes part in this inspiring exchange: How many COBOL programs have you written in your life? How many programs in Cobol have you actually SEEN? I saw a lot of COBOL when I worked for a stock broking

Re: [Haskell-cafe] Somewhat random history question - chicken and egg

2007-11-11 Thread Bernie Pope
On 12/11/2007, at 4:08 PM, Michael Vanier wrote: Bernie Pope wrote: If I remember correctly, the early versions of the Clean compiler were written in C. Then at some stage they re-wrote it in Clean. You could say they cleaned it up. It was a dirty job, but now it is self cleaning

Re: [Haskell-cafe] About Fibonacci again...

2007-11-08 Thread Bernie Pope
You can make it pretty short too, if you allow yourself fix: rs=1:fix(\f p n-n++f(p++n)p)[1][0] I came up with this on the train home, but then I realised it was the same as your solution :) On 08/11/2007, at 12:57 PM, Alfonso Acosta wrote: How about this, infiniteRS :: [Int]

Re: [Haskell-cafe] About Fibonacci again...

2007-11-07 Thread Bernie Pope
Is this what you are looking for: mrs = [0] : [1] : zipWith (++) (tail mrs) mrs then you can get the one you want with: mrs !! index given a suitable value for index It seems I didn't read the question carefully - you want the infinite list. You can recover the solution from mrs

Re: [Haskell-cafe] Re: Why can't Haskell be faster?

2007-10-31 Thread Bernie Pope
On 01/11/2007, at 2:37 AM, Neil Mitchell wrote: My guess is that the native code generator in Clean beats GHC, which wouldn't be too surprising as GHC is currently rewriting its CPS and Register Allocator to produce better native code. I discussed this with Rinus Plasmeijer (chief designer

Re: [Haskell-cafe] Function Types

2007-10-22 Thread Bernie Pope
I have implemented a reasonably simple language and interpreter called baskell. The language is essentially a very small subset of Haskell. It was designed to show students how type checking works. You can find it here: http://www.cs.mu.oz.au/~bjpop/code.html Cheers, Bernie. On 23/10/2007,

Re: [Haskell-cafe] will the real quicksort please stand up? (or: sorting a million element list)

2007-10-22 Thread Bernie Pope
On 23/10/2007, at 8:09 AM, Thomas Hartman wrote: (Prelude sort, which I think is mergesort, just blew the stack.) GHC uses a bottom up merge sort these days. It starts off by creating a list of singletons, then it repeatedly merges adjacent pairs of lists until there is only one list

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-08 Thread Bernie Pope
On 08/10/2007, at 8:54 PM, Thomas Conway wrote: I just had a conversation today that seems relevant to this thread. I was chatting with a friend who is working in the academic sector, and I was observing that Melbourne Uni (my old school), is switching in the new year from teaching Haskell as

Re: [Haskell-cafe] isWHNF :: a - IO Bool ?

2007-09-27 Thread Bernie Pope
Hi Tristan, I've implemented it for earlier versions of GHC, by calling some C code which then peeps at the internal representation of a value. From memory, I needed to pass a stable pointer to the value to the C code, so that it can be polymorphic, without having to make it a primitive

Re: [Haskell-cafe] Perfect example

2007-08-02 Thread Bernie Pope
That's a tough one, If I want a small example to show to people I usually use zipWith. It is higher-order and lazy, and I include a discussion of lists as loops, which means zipWith is a loop combiner. When my audience is C programmers I ask them to implement it in C, which is always

Re: [Haskell-cafe] Very freaky

2007-07-10 Thread Bernie Pope
On 11/07/2007, at 9:02 AM, Brandon S. Allbery KF8NH wrote: On Jul 10, 2007, at 15:59 , Andrew Coppin wrote: I find myself wondering... A polymorphic type signature such as (a - b) - a - b says given that a implies b and a is true, b is true. But what does, say, Maybe x - x say?

Re: [Haskell-cafe] folds with escapes

2007-07-04 Thread Bernie Pope
On 05/07/2007, at 10:08 AM, Michael Vanier wrote: Can you do dropWhile in terms of foldr? I don't see how. Mike I considered that very question in an article I wrote for the Monad.Reader magazine: http://www.haskell.org/sitewiki/images/1/14/TMR-Issue6.pdf If you are really keen,

RE: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Bernie Pope
Hi Joel, You may like to check out my mini-interpreter called (cheekily) baskell: http://www.cs.mu.oz.au/~bjpop/code.html It has type inference, and it is pretty straightforward. I wrote it for teaching purposes. First, I pass over the AST and generate a set of typing constraints. They are

RE: [Haskell-cafe] Application of iterate

2007-03-23 Thread Bernie Pope
It is :- my_sqrt t = last (take 20 (iterate (\n - n/2 + t/(2 * n)) t)) It is a bit crude though. 20 iterations is a bit arbitrary. I don't suppose there is a easy way to iterate until the results stop changing. Here's something for you to play with: my_sqrt t = fix (\n - n/2 + t/(2

RE: [Haskell-cafe] Newbie: Is'type' synonym hiding two much?

2007-03-22 Thread Bernie Pope
Dmitri writes: Now, in the 17.5 section of a book one may see the following declarations: succeed :: b - Parse a b *Before looking at 'succeed' function definition* one may think that 'succeed' is a function of *one* argument of type 'b' that returns object of type 'Parse a b'. Yet,

RE: [Haskell-cafe] Partial Evaluation

2007-03-21 Thread Bernie Pope
I think you are confusing partial application and partial evaluation. Though they are conceptually related. The former is what happens when you apply a function of arity N to M arguments, where M N. In Haskell the partially applied function is suspended, pending the rest of its arguments. The

Re: [Haskell-cafe] Strange memory consumption problems in something that should be tail-recursive

2007-02-13 Thread Bernie Pope
Duncan Coutts wrote: On Tue, 2007-02-13 at 15:27 -0500, Jefferson Heard wrote: Hi, I am running the following code against a 210 MB file in an attempt to determine whether I should use alex or whether, since my needs are very performance oriented, I should write a lexer of my own. I

Re: [Haskell-cafe] Strange memory consumption problems in something that should be tail-recursive

2007-02-13 Thread Bernie Pope
Creighton Hogg wrote: On 2/13/07, *Duncan Coutts* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Tue, 2007-02-13 at 15:27 -0500, Jefferson Heard wrote: Hi, I am running the following code against a 210 MB file in an attempt to determine whether I should use alex or

Re: [Haskell-cafe] Foldr tutorial, Inspired by Getting a Fix from a Fold

2007-02-12 Thread Bernie Pope
Nicolas Frisby wrote: Guess this is a tricky choice for a foldr intro, since it requires a paramorphism (see bananas lenses wires etc.) para :: (a - [a] - b - b) - b - [a] - b para f e [] = e para f e (x:xs) = f x xs (para f e xs) -- note that the original tail of the list (i.e. xs and not

Re: [Haskell-cafe] Foldr tutorial, Inspired by Getting a Fix from a Fold

2007-02-12 Thread Bernie Pope
Lennart Augustsson wrote: Sure, but we also have para f e xs = snd $ foldr (\ x ~(xs, y) - (x:xs, f x xs y)) ([], e) xs Nice one. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ANNOUNCE: The Monad.Reader - Issue 6

2007-02-01 Thread Bernie Pope
David House wrote: It was a great article though, seeing fix's definition in terms of foldr was one of those mind-bending moments which makes learning Haskell what it is. It's nice to see so many new solutions posted in the cafe. The great thing about Haskell is that it keeps on giving :)

Re: [Haskell-cafe] Stupid newbie question

2007-01-05 Thread Bernie Pope
On 06/01/2007, at 12:58 PM, Jeremy Shaw wrote: Because you never demand the value of any element in the list, Haskell never bothers to calculate it. So you have a list that looks like: [ i, i - 1, (i - 1) - 1, ((i - 1) - 1 - 1), .. ] So, by the time you get up to some big numbers, you have

Re: [Haskell-cafe] Newbie question

2006-12-29 Thread Bernie Pope
On 30/12/2006, at 1:33 PM, Pieter Laeremans wrote: Hi, I'm reading the Haskell school of expression by Paul Hudok. Great book. Hudak. And I concur, a great book. However I would like some feedback about a solution to an exercise The problem is quite simple : define f1 and f2 (using

Re: [Haskell-cafe] Efficient way to break up a lazy bytestring

2006-12-29 Thread Bernie Pope
On 30/12/2006, at 1:32 PM, Matthew Brecknell wrote: In my (limited) Haskell experience, I was continually being surprised by inexplicable stack blowouts until I spent a little time doing some focussed experiments, mainly involving folds over large lists. If you haven't done that, I would

Re: [Haskell-cafe] Haskell Side Effect

2006-12-20 Thread Bernie Pope
I thought this email might be interesting for the Spanish speaking part of the Haskell community, so I have written it in Spanish for them: (Since learning Haskell, I can now count in Spanish! See: one in Spanish, two in Spanish, three in Spanish, four in Spanish.. -- Ashley Yakeley)

Re: [Haskell-cafe] Reversing a string of words: C# v Perl V Ruby v Haskell

2006-12-11 Thread Bernie Pope
On 12/12/2006, at 11:13 AM, Brandon S. Allbery KF8NH wrote: On Dec 11, 2006, at 18:48 , Steve Downey wrote: the typical good solution to this problem in c or c++ is to use a string reverse function on the entire buffer, then re-reverse each word. this leaves multiple spaces correctly

Re: [Haskell-cafe] Re: Beginner: IORef constructor?

2006-12-05 Thread Bernie Pope
On 05/12/2006, at 1:00 PM, Benjamin Franksen wrote: Bernie Pope wrote: If you want a global variable then you can use something like: import System.IO.Unsafe (unsafePerformIO) global = unsafePerformIO (newIORef []) But this is often regarded as bad programming style (depends who

Re: [Haskell-cafe] How to get subset of a list?

2006-11-30 Thread Bernie Pope
On 01/12/2006, at 12:47 PM, Huazhi (Hank) Gong wrote: Like given a string list s=This is the string I want to test, I want to get the substring. In ruby or other language, it's simple like s [2..10], but how to do it in Haskell? If your indices are in ascending order, and unique, then

Re: [Haskell-cafe] Beginner: IORef constructor?

2006-11-30 Thread Bernie Pope
On 01/12/2006, at 6:08 PM, TJ wrote: First of all, sorry if this is a really silly question, but I couldn't figure it out from experimenting in GHCi and from the GHC libraries documentation (or Google). Is there an IORef consturctor? Or is it just internal to the Data.IORef module? I want

[Haskell-cafe] Very Small Program

2006-11-02 Thread Bernie Pope
On 02/11/2006, at 9:56 PM, [EMAIL PROTECTED] wrote: G'day all. Quoting Bernie Pope [EMAIL PROTECTED]: This is a weird example of a pattern binding, and it is surprising (to me) that the syntax is valid. Maybe. But you wouldn't balk at this: numzeroes xs = sum [ 1 | 0 - xs

Re: [Haskell-cafe] Very Small Program

2006-11-01 Thread Bernie Pope
On 02/11/2006, at 4:45 PM, Jason Dagit wrote: Hello, I just found it (in ghci and hugs) that this is a valid haskell program: let 0 = 1 in 0 This program evaluates to 0 (to my surprise). This is a weird example of a pattern binding, and it is surprising (to me) that the syntax is

Re: [Haskell-cafe] instance of String illegal

2006-09-28 Thread Bernie Pope
On 29/09/2006, at 12:44 PM, Donald Bruce Stewart wrote: Alternatively, use -fglasgow-exts :) instance Foo String where mkFoo = id $ ghci -fglasgow-exts A.hs *Main mkFoo foo foo And just to follow up what Don said, this feature of GHC is described here:

Re: [Haskell-cafe] Re: [Haskell] MR details (was: Implicit type of numeric constants)

2006-09-26 Thread Bernie Pope
My understanding of the MR is heavily influenced by the work I did on Hatchet, which is based directly on Mark Jones' paper (and code) Typing Haskell in Haskell. I thought I would go back to that paper and see how he defines simple pattern bindings and the MR. I now quote directly from the

[Haskell-cafe] Re: [Haskell] MR details (was: Implicit type of numeric constants)

2006-09-23 Thread Bernie Pope
On 23/09/2006, at 4:33 AM, Christian Sievers wrote: Hello, I don't take my advice to go to haskell-cafe :-) I will take your advice :) The discussion continued outside the mailing list, and now I have two questions myself: 1. Why do the rules of the monomorphism restriction explicitly

Re: [Haskell-cafe] Re: [Haskell] MR details (was: Implicit type of numeric constants)

2006-09-23 Thread Bernie Pope
On 24/09/2006, at 1:46 AM, Michael Shulman wrote: On 9/23/06, Bernie Pope [EMAIL PROTECTED] wrote: If a pattern binding is not simple, it must have a data constructor on the lhs, therefore it cannot be overloaded. So the (dreaded) MR only applies to simple pattern bindings. I thought