Re[2]: [Haskell-cafe] Re: [Haskell] Google Summer of Code 2009

2009-02-11 Thread C.M.Brown
Hi Jamie, As a side note - I'd be very interested to see a Haskell implementation of H264 decoding. I'm currently having to use the ffmpeg library in C, and it's notoriously buggy with memory leaks left right and centre. A haskell solution would be very much welcome! Regards, Chris. On Wed, 11

Re: [Haskell-cafe] Haskell and Java interaction

2009-02-09 Thread C.M.Brown
Hi Silviu, There's the GCJNI: http://www.haskell.org/gcjni/ Which is basically a greencard-ed JNI interface for Haskell. I'm not sure it's still suported but may be worth a shot. Regards, Chris. On Mon, 9 Feb 2009, Silviu ANDRICA wrote: Hello, I was wondering if there is a way to call

Re: [Haskell-cafe] Haskell and Java

2008-09-09 Thread C.M.Brown
Hi, The only thing I can think of is GCJNI: http://www.haskell.org/gcjni/ This makes use of the FFI and a Greencarded Java JNI interface. It does allow you to call Java programs from Haskell. However, I'm not sure if it is still supported. hth, Chris. On Tue, 9 Sep 2008, [ISO-8859-1]

Re: [Haskell-cafe] Re: Haskell stacktrace

2008-09-09 Thread C.M.Brown
Or define your own ghead and gtail: ghead msg [] = error ghead ++ msg ++ [] ghead _ (x:xs) = x gtail msg [] = error gtail ++ msg ++ [] gtail msg (x:xs) = xs and you can call them with a name of a function to give you an idea where the error is occurring: myHead = ghead myHead [] Chris.

Re: [Haskell-cafe] Haskell symbol ~

2008-08-27 Thread C.M.Brown
Hi, I may be wrong here, but I don't belive it's just let-patterns that have this property. I.e. what's the difference between... (Just x) = _|_ f = x vs. f = let (Just x) = _|_ in x vs. f = x where (Just x) = _|_ I believe Haskell uses Normal Order Reduction in all these cases. Why is it

Re: [Haskell-cafe] Haskell symbol ~

2008-08-27 Thread C.M.Brown
, Jonathan Cast wrote: On Wed, 2008-08-27 at 20:14 +0100, C.M.Brown wrote: Hi, I may be wrong here, but I don't belive it's just let-patterns that have this property. I.e. what's the difference between... (Just x) = _|_ f = x vs. f = let (Just x) = _|_ in x vs. f

Re: [Haskell-cafe] Haskell Propeganda

2008-08-24 Thread C.M.Brown
to resolve. regards, Chris. On Sat, 23 Aug 2008, Brandon S. Allbery KF8NH wrote: On 2008 Aug 23, at 17:29, C.M.Brown wrote: I wonder whether seg faults are the true analogue to errors such as error: head empty list. or pattern match errors. Not really; while laziness does introduce a certain

Re: [Haskell-cafe] Haskell Propeganda

2008-08-23 Thread C.M.Brown
I guess I didn't express my point very clearly... That C programmers apparently don't realise that a type system that's sound will give them something -- i.e. their programmer won't ever segfault. I wonder when we try to advertise Haskell if we should be saying we can give you programs that

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread C.M.Brown
Andrew, [...] For the record, I have no problem with modules depending on each other, so long as they only depend on their well-defined interfaces. Finally, as chris suggests, if separate compilation is important to you, why not have a flag in ghc -frequire-hi-boot or something? Well,

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-13 Thread C.M.Brown
Andrew, But isn't this exactly the point I was trying to make!? The whole point, to me, in functional programming, is that we shouldn't have to worry about the underlying implementation. It is not exposing an underlying implementation detail to mandate that modules should have

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-12 Thread C.M.Brown
Andrew, Thanks very much for your reponse. It was very helpful; this makes a lot of sense! Regards, Chris. On Mon, 11 Aug 2008 [EMAIL PROTECTED] wrote: G'day all. Quoting C.M.Brown [EMAIL PROTECTED]: Yes, I saw that, thanks! I guess this is because it's hard to compile a mutually

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-12 Thread C.M.Brown
I'm not sure that it does make a lot of sense -- we allow (mutually) recursive functions, even though they come with an efficiency penalty. Why should we not allow (mutually) recursive modules, even though they too come with an efficiency penalty. This is even an example where the

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-12 Thread C.M.Brown
The problem is not mutually recursive modules. Plenty of statically typed languages support mutually recursive modules. The problem is that it's impossible in general to say what the interface of a module is by examining the module alone. This is a very unusual property as real-world

[Haskell-cafe] Cyclic Inclusions

2008-08-11 Thread C.M.Brown
Hi, I have a question about cyclic inclusions. It appears in the Haskell 98 report that mutually recursive modules are allowed, however GHC complains at any Haskell project that has cyclic inclusions (implicit or explicit). Am I right in thinking that this is a GHC limitation?

Re: [Haskell-cafe] Cyclic Inclusions

2008-08-11 Thread C.M.Brown
Hi Don, GHC provides a mechanism to support mutually recursive modules, but you must break the cycle manually, via a boot file. http://www.haskell.org/ghc/docs/latest/html/users_guide/separate-compilation.html#mutual-recursion Yes, I saw that, thanks! I guess this is because it's

Re: [Haskell-cafe] Trouble with non-exhaustive patterns

2008-07-21 Thread C.M.Brown
Hi Fernando, I hope you don't mind, but I've moved this over to the Haskell-beginners mailing list, where I think this kind of question will be more appropriate. In Haskell, it helps to think of functions in terms of an input and an output, that is, what is the thing that is going into the

Re: [Haskell-cafe] Re: Call Graph Tool?

2008-06-27 Thread C.M.Brown
Hi Ivan, Assuming I get it included, is there any features in particular you'd want to see in there? Note that if I do have it produce visualisations, they'll be static images as part of an analysis report rather than being interactive. I'd basically like to see a graph of the overall

Re: [Haskell-cafe] Call Graph Tool?

2008-06-27 Thread C.M.Brown
Hi Jno, I suggest that you have a look at HaSlicer, a (visual) Haskell slicing tool available online from http://labdotnet.di.uminho.pt/ HaSlicer/HaSlicer.aspx , developed by Nuno Rodrigues ([EMAIL PROTECTED]). Oh excellent, yes I'd forgotten about this, thanks. Chris.

[Haskell-cafe] Call Graph Tool?

2008-06-26 Thread C.M.Brown
Hi, I have approx. 100+ source files and I was wondering if anyone has a tool that would let me see a visual call graph for the source files; i.e. a visual hierarchy of which module is imported by what, and so forth. Kind regards, Chris. ___

Re: [Haskell-cafe] Re: ANN: haskell-src-exts 0.3.2

2008-03-18 Thread C.M.Brown
Hi Nikolas, I supppose you're talking about HaRe, that Thomas Schilling linked to. I have no idea how that system is built so I can't answer your question. But in principle I don't see why not. :-) In principle it would actually be quite difficult. HaRe is Haskell 98, built upon the

Re: [Haskell-cafe] Re: ANN: haskell-src-exts 0.3.2

2008-03-18 Thread C.M.Brown
I believe that the limitation is that they use Programatica's parser to get an AST to run their refactorings on. I think they've looked several times at using ghc's apis to do this, but hit various problems. I think that the main problem is that no other parser preserves things like code

Re: [Haskell-cafe] Refactoring status

2008-01-03 Thread C.M.Brown
Hi Peter, Is any work being done on Haskell refactoring support, like HaRe or others? HaRe is still very active and is due for a new release very soon. There are probably in excess of 40 refactorings for HaRe in total now, and I intend to add more! Sadly, I am currently the only maintainer left

RE: [Haskell-cafe] Refactoring status

2008-01-03 Thread C.M.Brown
Cool! I'll check it out. However, I'm using some GHC extensions, so that is indeed a show stopper :) Which extensions are you using that are not Haskell 98? I would be very interested to know what users would generally require from a refactorer. You mean a syntax-directed editor, right?

Re: [Haskell-cafe] Refactoring status

2008-01-03 Thread C.M.Brown
Hi Bulat, i don't use type signatures at all - this creates some problems when i wrote large portion of code and try to make it compile, but nothing more I believe type signatures are the very essence of Haskell documentation! I'd much rather see a program with type signatures for functions

RE: [Haskell-cafe] Refactoring status

2008-01-03 Thread C.M.Brown
Currently, I'm trying to learn arrows and Yampa (mainly to see how well it compares to my own dataflow/reactive stuff that was written in C#, C++ and assembler) Arrows won't work with HaRe at the moment, therefore Yampa won't either; which is a shame. First of all, let's see if I get the

RE: [Haskell-cafe] Refactoring status

2008-01-03 Thread C.M.Brown
Furthermore, IMHO, type signatures alone are not enough, a good parameter name says at least as much as the type. Yes! A very good point! :) E.g. what does a function Int - Int - Bool do? I have no idea. A good function name helps, e.g. isDivisible:: Int - Int - Bool. But then I still

Re: [Haskell-cafe] Refactoring status

2008-01-03 Thread C.M.Brown
Hi, A possible first goal would be, to add extensions that are definitely in Haskell prime, see: http://hackage.haskell.org/trac/haskell-prime/wiki/Status'#definitely-inProposalStatus Oh great! Thanks for the link, I think the main issue is moving over to a platform that is heavily

Re[2]: [Haskell-cafe] Refactoring status

2008-01-03 Thread C.M.Brown
On Fri, 4 Jan 2008, Bulat Ziganshin wrote: Hello Peter, Thursday, January 3, 2008, 11:03:58 PM, you wrote: Okay, but when using a syntax directed editor, type signatures can be automatically provided because the types are known. the same is possible for Haskell - it's possible to add to

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-18 Thread C.M.Brown
If however, you *really* want to keep your shapes as being seperate types, then you'll want to invoke the class system (note, not the same as OO classes). class Shape a where area :: a - Int newtype Circle = C Int instance Shape Circle where area (C r) = pi * r^2 newtype

Re: [Haskell-cafe] let vs. where

2007-11-14 Thread C.M.Brown
Hi David, A let clause would work fine here: someFunction ls a b c = let listLen = length ls someAuxFunction x y = ... listLen ... someOtherFunction x y = ... listLen ... in ... listLen

Re: [Haskell-cafe] let vs. where

2007-11-14 Thread C.M.Brown
Hi Neil, Why not: exp = let blah = g 1000 in (fst blah, snd blah) Yes, fair enough. Where's always get desugared to let's, so where's are never more efficient. Interesting. I'm thinking a where-to-let refactoring and its converse may make useful routine refactorings for HaRe.

[Haskell-cafe] Strange Type Inference

2007-11-05 Thread C.M.Brown
Hi, I was given a quandary this evening, suppose I have the following code: module Test1 where import qualified Data.Map as Map testFunction :: Ord a = Map.Map a b - Map.Map a b - a - (Maybe b, Maybe b) testFunction m0 m1 k = (lookup0 k, lookup1 k) where

Re: [Haskell-cafe] Strange Type Inference

2007-11-05 Thread C.M.Brown
Yes, using a ghc extension of scoped type variables. In the signature of testFunction, if you explicitly quantify all your variables with forall, then they are visible in the where clause (and elsewhere in the function). Perfect! But how come if I have: testFunction :: forall a b. Ord a =

Re: [Haskell-cafe] Strange Type Inference

2007-11-05 Thread C.M.Brown
I get: Test1.hs:6:34: parse error on input `=' Is the syntax incorrect? Scrap that, I forgot to enable the glasgow extensions. It's been a long day. *sigh* :) Chris. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

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

2007-09-19 Thread C.M.Brown
Hi Peter, Mmm, yes of course... blush... But shouldn't f ~(x:xs) = rhs give a compile-time error since neither x nor xs is used in the right hand side, and hence nothing will ever get pattern matched when this function is called, which clearly indicates a mistake? That is, if I

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

2007-09-19 Thread C.M.Brown
f ~(x:xs) = x + 2 f ~[] = 42 Then f [] would give a complie error: Irrefutable pattern failed for pattern (x : xs) Sorry, that should be *runtime* error! Chris. Hope that gives some insight. Chris. Oh well, the way it is now is also easy to get used to, one just has to know

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

2007-09-19 Thread C.M.Brown
It seems GHC does give a warning at compile-time about it, so you did get it right the first time :-) Well the warning happens at compile time certainly. But the irrefutable pattern error only occurs at runtime. cmb21$ ghc --make Main.hs [1 of 1] Compiling Main ( Main.hs, Main.o )

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

2007-09-19 Thread C.M.Brown
Hi Miguel, See, in let or where constructs you don't have a choice; you can't do different things depending on whether some value is Just x or Nothing. Therefore, there is no need to perform pattern matching strictly. This is not entirely true. This is actually one of those niches in Haskell

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

2007-09-19 Thread C.M.Brown
Hi Isaac or f x = let g (Just x) = x g Nothing = error Nothing in g x That's interesting, thanks! Chris. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

RE: [Haskell-cafe] Ideas

2007-08-25 Thread C.M.Brown
I tried vital, and at first sight it is very nice, but they only support a very limited subset of Haskell, perform no type checking at all, don't support the indent rule, etc... Anyway it is an amazing piece of work. I believe that type-sensitive manipulation was certainly being investigated;

RE: [Haskell-cafe] Ideas

2007-08-25 Thread C.M.Brown
Definitely! It's really cool stuff. But something like that for real Haskell (e.g. GHC) would be even better :) I could be an offline downloadable application. It would be a very nice tool: create postscript (or PDF, or LaTex, whatever rich text format) documents with Haskell boxes inside.

Re: [Haskell-cafe] Order of evaluation

2007-07-26 Thread C.M.Brown
Hi Jon, On Thu, 26 Jul 2007, Jon Harrop wrote: If you have a boolean-or expression: a || b will a be evaluated before b in Haskell as it is in other languages? Yes, I believe it is defined thus: True || _= True _|| True = True _|| _= False Therefore it is strict in

Re: [Haskell-cafe] newbie question on Parsers from Programming In Haskell

2007-06-04 Thread C.M.Brown
Hi Juozas, - type Parser a = String - [(a, String)] return :: a - Parser a return v = \inp - [(v, inp)] failure :: Parser a failure = \inp - [] item :: Parser Char item = \inp - case inp of [] - [] (x:xs) - [(x, xs)] parse

Re: [Haskell-cafe] Poor first impression

2007-04-27 Thread C.M.Brown
Hi Fernando, [EMAIL PROTECTED] ghc-6.6.1]# ghc /usr/local/lib/ghc-6.6.1/ghc-6.6.1: error while loading shared libraries: libreadline.so.4: cannot open shared object file: No such file or directory # So, I conclude that Haskell is not ready for prime time, if it cannot install itself

[Haskell-cafe] Strange behaviour with writeFile

2007-02-04 Thread C.M.Brown
Hi, I am observing some rather strange behaviour with writeFile. Say I have the following code: answer - AbstractIO.readFile filename let (answer2, remainder) = parseAnswer answer if remainder == answer2 == then do AbstractIO.putStrLn $ completed else do AbstractIO.putStrLn

Re: [Haskell-cafe] Strange behaviour with writeFile

2007-02-04 Thread C.M.Brown
= if x==x then x else x Seems to do the trick. Thanks! Chris. On 04/02/07, C.M.Brown [EMAIL PROTECTED] wrote: Hi, I am observing some rather strange behaviour with writeFile. Say I have the following code: answer - AbstractIO.readFile filename let (answer2, remainder

Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread C.M.Brown
Hi, It's true that this is the typical way of learning Haskell, but I for one think it's a bad way of learning Haskell. Very few real world programs get by without the impure stuff, so if you give the newbie the impression that it isn't there (by postponing it) there's a chance he'll run

Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread C.M.Brown
Hi, On the contrary, I think it's an excellent way of learning Haskell. I'm writing a lot of useful Haskell code with only one IO action (interact). I don't think I could reasonably construct an introductory problem that couldn't be solved with it, and I haven't yet found an application for