Re: [Haskell-cafe] Haskell vs Ruby as a scripting language

2007-02-10 Thread Neil Mitchell

Hi


 Also, I recommend looking into embedding YHC. I have not had a
 chance to use
 it yet, but it looks like it is a better fit to an interpreter-only
 embedding situation than GHC--with GHC, you are getting a lot more
 than you
 seem to be asking for.

I would want to compile code as well. Compile bits of code 100 lines
at a time and load them back into my app for execution. Does YHC
compile and how efficiently?


Yhc can happily compile code and run it. You'll probably pay a factor
of 2-8 times slower than GHC, depending on what the code does. The
entire Yhc binary distribution on Windows is 8Mb, of which 6Mb is the
compiler.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Monolithic module tool

2007-02-08 Thread Neil Mitchell

Hi Chad

I think what you are after is Haskell All-In-One:

http://www.cs.utah.edu/~hal/HAllInOne/index.html

As it happens, since that date Yhc has moved on to the point where:


yhc Main.hs -linkcore
loadCore Main.yca = writeFile Main.hs . coreHaskell


Will get you a similar result - but with desugaring applied as well.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Portable implementation of unsafeCoerce

2007-02-06 Thread Neil Mitchell

Hi Alfonso,


Reading the sources of Lava (a Haskell Hardware Description DSL) I run
into this definition ...


unsafeCoerce :: a - b



Is this actually equivalent to the infamous unsafeCoerce# ?


Yes, see the comment in the haddock documentation for unsafePerformIO:

http://haskell.org/ghc/docs/latest/html/libraries/base/Foreign.html#v%3AunsafePerformIO

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] External Core

2007-02-06 Thread Neil Mitchell

Hi Ricky,


For the last year I've been working on a program to translate between
Haskell and Java.  Originally this was for my third year dissertation to
contribute towards my Masters in computer science at Sheffield University,
UK.

I have been given the opportunity to continue this project and have become
interested in using the Core representation as an intermediary language.


You might be interested in Yhc.Core - its like GHC's Core, but is
simpler, untyped and (in my opinion) better supported.

http://haskell.org/haskellwiki/Yhc/API/Core

We already have a Haskell - Javascript convertor written using this,
so your type of application is certainly doable using what we have
already. There are quite a few users of Yhc.Core already, and everyone
has had nice things to say about it :)

If you have any specific Yhc.Core questions feel free to ask away

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] how to calculate the sum of list of lists?

2007-02-05 Thread Neil Mitchell

Hi Miranda,


How to calculate the sum of list of lists in Haskell?


What do you mean by this? What is the value of a list?

If you mean sum the numbers such that [[1,2],[3,4]] = 1+2+3+4 then you
are able to ask two alternative questions - how do i convert a list of
lists to a list, and how do i sum a list.

Both can be answered by Hoogle:

http://haskell.org/hoogle/?q=%5BInt%5D%20-%3E%20Int

The list of lists to a list is a bit easier so I'll leave you to solve
that one :)

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to remove all numbers from a list that are divisible by an integer

2007-02-05 Thread Neil Mitchell

Hi Miranda,


Now I need to know how to remove all numbers that are divisable by an
integer.


Is this a homework problem? Is there some bigger goal you are trying to achieve?


I tried to use some zipWith...filter and other predefined functions..but I
can't really find the right solution :(


Can you perhaps show us some of the solutions you tried, so we can see
what direction you were going in? It's easy enough to give you the
answer, but it's probably beneficial to you if we help you learn these
things for yourself.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to remove all numbers from a list that are divisible by an integer

2007-02-05 Thread Neil Mitchell

Hi Miranda,


filter :: (a - Bool) - [a] - [a]
filter p [] = []
filter p (x:xs) = if p 'mod' x
   then x : filter p xs
   else filter p xs
I tried this, but it doesn't work


You are mixing a few things together. First point, mod should be `mod`
and not 'mod' - ' means character, ` means infix operator as a name.

Second point you can only if test on a Bool, mod returns an Int.

Third, filter is an already defined function, if you look up it's
source you'll see how you can use this in your program.

If you were to hop onto Haskell IRC I'm sure you could get these
problems resolved quickly - http://haskell.org/haskellwiki/IRC_channel
- you seem to have roughly the basic idea behind the algorithm, its
just lots of little details. Perhaps working through a Haskell
tutorial would help you clarify these things.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] nested maybes

2007-02-04 Thread Neil Mitchell

Hi


This is true.  Some time ago I swore off the use of fromRight and
fromLeft in favor of maybe, and have been forgetting about the other
functions in Data.Maybe ever since.


I think you mean you swore off fromJust. Unfortunately when people
started to debate adding fromLeft and fromRight they decided against
logic and consistency, and chose not to add them...

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Boost equivalent

2007-02-01 Thread Neil Mitchell

Hi John,


Does the Haskell community have an equivalent to C++ community's Boost
project with the aim of writing libraries for the eventual inclusion into
Haskell?


We have:

1) MissingH - a nice staging ground for things that may end up in the
base library

2) Library submission process, to add things to the base libraries

3) Hackage - anyone can write a library that anyone can use.

I think that covers most uses.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Circular programming (aka time-travel) resources?

2007-02-01 Thread Neil Mitchell

Hi Justin,


A quick google search turned up a couple of blogs and some papers -
but is there more out there?


http://news.cs.york.ac.uk/ftpdir/pub/colin/jfp97lw.ps.gz

Laziness, circularity and prime numbers all in one :)

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is Excel the most used -- and fucntional -- programming lanuage on Earth?

2007-01-30 Thread Neil Mitchell

Hi Alexy,


Heard that statement recently -- that Excel is a functional
programming language, and the most used one -- of any programming
languages -- on Earth!  Is it true?  Are there good examples of
typical FP style in Excel?


You can't define functions in Excel, hence its not really a functional
language. I'd go as far as saying its an expression-based programming
language, but that's it. It also has mutable state (if you use
circular references) so its not pure.

That said, the quote almost certainly comes from this paper (in the
title): http://research.microsoft.com/~simonpj/Papers/excel/index.htm

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple HTTP lib for Windows?

2007-01-29 Thread Neil Mitchell

Hi


 My standard solution was to invoke wget, but a Haskell solution would
 be nicer. For my purpose following redirects etc. isn't required, so
 thanks very much for your help. I will be releasing this function as
 part of a library shortly, so will be giving you credit for your help!



Good god, no! The code was merely meant to illustrate how a really basic
HTTP GET might work. It certainly doesn't deal with a lot of the
additional cases, like redirects and resource moves, and
non-standards-compliant HTTP servers. I'm no HTTP expert, so for all I
know this example code is likely non-standards-compliant too. It really
only works for a very straightforward text file GET, and there's no
exception or error handling, or any of the more interesting cases.


But at the same time its the best solution available without going to
much pain and C libraries. I would love something more robust and
equally simple, but haven't found it.

The library I am writing is one to parse and extract information from
HTML documents, the fact that I can now download web pages merely
makes the examples I give more interesting - its not the fundamental
essence of the library.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple HTTP lib for Windows?

2007-01-29 Thread Neil Mitchell

Hi


 So yes, we need to fix it. There's people to do it. Now we just need
 social factors to kick in and make it happen!


We really do! The inability to get a file off a website is quite
depressing given that the hard bit should be designing an API, but
that anyone could do that for openURL in about 5 minutes.


is there a mailing list


haskell-cafe@


or twiki to direct these efforts?


http://haskell.org/haskellwiki/Http

Haskell already has all the infrastructure to run this project, all it
needs is the people with the time. I have no time to help, but really
want to use the end result :) Where is the http strike team when you
need them? ;)

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC-Cygwin

2007-01-29 Thread Neil Mitchell

Hi Daniil


My desire is simple. I want GHC-Cygiwn.


Why? I find Cygwin really really horrible and avoid it where possible.
I was just wondering what advantages you get from having GHC-Cygwin?

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: binary: high performance, pure binary serialisation

2007-01-29 Thread Neil Mitchell

Hi Conrad,


If the data header stores the alignment/size/endianness, then there's
no reason for the data to be unportable. The normal get* instances
(not get*host) could suffice for reading.


That requires the stream to have a header. Which means that any
arbitrary slice within the ByteString is not equal - the first one
contains essential information which isn't available anywhere else. It
seems like a lot of complexity, defining multiple parameterised file
types, when the simple case is probably neater and cheaper in terms of
both runtime and developer time.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] proposal: HaBench, a Haskell Benchmark Suite

2007-01-28 Thread Neil Mitchell

Hi


What about using darcs as a benchmark? I heard people say it's slow.
The undercurrent is that it's slow because it's written in Haskell.


Its slow because some algorithms are O(stupid value). Some operations
(I've been told) would take 100's of years to terminate. That has
nothing to do with Haskell.

Also its not written in Haskell, its written in GHC-Haskell. This
benchmark suite should try where possible to be a Haskell benchmark.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple HTTP lib for Windows?

2007-01-28 Thread Neil Mitchell

Hi Daniel,



Adding in
 hPutStrLn h (Connection: close\r\n)
or
  hPutStrLn h (Connection: keep-alive\r\n)
as appropriate should sort that.


Works like a charm.


This is responding with a 302, the resource has been found but is temporarily
at another location indicated in the responses Location header.
So, now you'll have to start parsing responses.
In this case the Location header is www.cs.york.ac.uk/public.php


I didn't get as far as getting the 302, but it works now.


The cheap and cheerful solution might be to invoke cURL.


My standard solution was to invoke wget, but a Haskell solution would
be nicer. For my purpose following redirects etc. isn't required, so
thanks very much for your help. I will be releasing this function as
part of a library shortly, so will be giving you credit for your help!

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Numeric Class Problem

2007-01-28 Thread Neil Mitchell

Hi Dennis,

(/) :: Fractional a = a - a - a
div :: Integral a = a - a - a

Basically, use / on Float/Double like things, and div on Int/Integer
like things:

If you do want to use double like things throughout, then using
fromInteger around the place will help:

floor (fromInteger j * (fromInteger n / fromInteger p2n))

This converts easy value from an Integer to a number thing, which will
allow you to treat it like a Double/Float thing. If you are using Int
(rather than Integer) you might need fromInteger (toInteger x) around
the place.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Converting Types to Terms

2007-01-28 Thread Neil Mitchell

Hi,

I have got loads of requests to allow Hoogle to do this, usually
something like if you search [Bool] - [Bool] it should suggest map
not, or something - combining functions into the one you want.

Unfortunately the search space would be huge for even the smallest
library. Worse still, the second you allow id :: a - a, you have an
infinite number of matching terms.

Some work I have seen which seems related to what you are asking is:
http://www.cs.ioc.ee/tfp-icfp-gpce05/tfp-proc/14num.pdf Systematic
search for lambda expressions by Susumu Katayama.

Thanks

Neil


On 1/28/07, Stefan O'Rear [EMAIL PROTECTED] wrote:

On Sun, Jan 28, 2007 at 09:11:33PM +0100, Klaus Ostermann wrote:
 I would like to have a program that can synthesize programs for a
 given type, composing only functions from a given library.

 For example, suppose my library has

 isZero :: Int - Bool
 map :: (a - b) - [a] - [b]
 and :: Bool - Bool - Bool
 fold :: (a - b - a) - a - [b] - a
 True :: Bool
 (.) :: (b - c) - (a - b) - a - c

Why just (.) ?  I also assume your logic has modus ponens (curry howard: 
application)

 then I want to ask, say, for a program of type

  [Int] - Bool

 and get as answer

 (fold and True) . (map isZero)

 However, with none of these approaches I managed to do anything with list
 functions.

 What else is available (besides Djinn and De-Typechecker)? Are lists a
 problem? In general, what are the practical and theoretical limits of these
 program synthesizers? Are there any overview papers for this topic?

A system (with the full axioms of intuitionist logic) would be much more likely
to answer your query with \_ - True .  Not very helpful, eh?

Lists are recursive types, and it is very easy for a list calculus to lose 
strong
normalization.  Without strong normalization, any nontrivial query will be 
answered
with 'undefined'.  Not helpful.

The only other system I know of is my short theorem prover (on the wiki); it 
has no
architectural reason to not allow list functions, but it has many shallow 
reasons -
slow, obfuscated, doesn't currently track proofs, doesn't currently support 
higher
kinds.  Not likely to be usable.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What is the best way to understand large programs?

2007-01-28 Thread Neil Mitchell

Hi


Haddock generates interface documentation. That's only appropriate for
libraries, isn't it?


Wrong, its very useful for normal programs as well. That along with a
nice HsColour generated source links with Haddock and you can navigate
the code just a bit quicker. Having a Hoogle database for a large
program is also handy for figuring out where things are and what they
do - especially when the program has introduced new custom data types.

Some sort of module dependancy graph would also be handy, but I'm not
sure any program can yet produce that kind of information.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple HTTP lib for Windows?

2007-01-27 Thread Neil Mitchell

Hi Alistair,


 Is there a simple way to get the contents of a webpage using Haskell on a
 Windows box?

This isn't exactly what you want, but it gets you partway there. Not
sure if LineBuffering or NoBuffering is the best option. Line
buffering should be fine for just text output, but if you request a
binary object (like an image) then you have to read exactly the number
of bytes specified, and no more.


This works great for haskell.org, unfortunately it doesn't work as
well with the rest of the web universe.

With www.google.com I get: Program error: handle: IO.hGetChar:
illegal operation

With www.slashdot.org I get: 501 Not Implemented returned

www.msnbc.msn.com works fine.

Any ideas why? Are there any alternatives to read in a file off the
internet (i.e. wget but as a library)

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple HTTP lib for Windows?

2007-01-27 Thread Neil Mitchell

Hi Daniel


Note that I haven't tried this, or the rest of Alistair code at all, so the
usual 30 day money back guarantee doesn't apply.  It certainly won't handle
redirects.


Thanks, it certainly gets more things, but has a nasty habit of taking
a very long time in Hugs on certain URLs:

research.microsoft.com/, www.cs.york.ac.uk/

And on some urls, ie http://research.microsoft.com/~simonpj/, it still
ends up with IO.hGetChar: illegal operation

Any ideas why?

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: binary: high performance, pure binary serialisation

2007-01-27 Thread Neil Mitchell

Hi


 I also fear that the existing script does not handle types with more than
 256 constructors correctly. While uncommon, those are not unrealistic.

Feel free to send in a patch. All it needs to do is check if there are
more than 2^8 constructors and if so encode the tag in a Word16 rather
than Word8.


I've already fixed this and sent some new code to you. As long as you
have less than 4 billion constructors you should be fine now.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] basic field questions

2007-01-25 Thread Neil Mitchell

Hi


sq = squishiness $ Table {colour = Black, weight=1, height= 2}
main = putStr $ show sq


squishiness is just translated to:

squishiness :: Furniture - Double
squishiness (Chair _ _ x) = x
squishiness _ = error doh


main: No match in record selector Main.squishiness


Hence this is a pattern match error (runtime), not a type error
(compile time). There are people working on extending the types to
catch this kind of thing, and also people working on static checkers
to catch patter match errors [1] and people working on annotations to
get this kind of thing [2].

It's not a solved problem yet, but certainly I have a demo checker
that would have spotted this easily.

Thanks

Neil

[1] http://www-users.cs.york.ac.uk/~ndm/projects/catch.php

[2] http://www.cl.cam.ac.uk/~nx200/research/escH-hw.ps
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Haskell] [Fwd: Re: Computer Language Shootout]

2007-01-25 Thread Neil Mitchell

Hi


I have to disagree with this. That is, I don't object to Don's
explanation of why the shootout entries degraded in this particular
case, but I do think that Andrzej was right to point this out:
Perhaps making a collective effort towards benchmarking Haskell programs and
analyzing the results in some methodic way could prove helpful?
and I think that he *is* pointing out a fundamental issue here.


We have the nofib suite, it could do with some attention, but it is
(or was) a pretty good performance tester.


Maybe it's just me, but as someone who has some amount of experience
with implementing optimizations for Haskell, I find it nearly
impossible to precisely understand and measure exactly how those
optimizations improve (or degrade) program performance.


The problem is that something like GHC is very complex, with lots of
transformations. When transformations are firing other
transformations, which in turn fire other transformations, it doesn't
take a great deal to disrupt this flow of optimisation and end up with
a result which doesn't accurately reflect the particular change you
made. Better knowledge of the end effects on a program isn't
necessarily going to translate to better knowledge of the
optimisations effect.

Maybe if we had a greater number and variety of optimising compilers
we'd be able to more freely experiment with optimisation techniques in
different settings. At the moment GHC is all there is (with Jhc not
ready for mainstream use yet)

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Haskell] [Fwd: Re: Computer Language Shootout]

2007-01-25 Thread Neil Mitchell

Hi


Sorry for being unclear. I agree with your comments on GHC, and one
thing I was suggesting was that somebody should think about profiling
tools for improving our understanding of how those transformations
interact with each other, not just profiling tools for understanding
the end result.


That would be very neat. Another neat trick would be generalising
optimisations so that there are fewer and more independant passes,
this would make it easier to understand (and is what I was working on
for Yhc).


I agree that there should be more diversity in compilers, but I think
even sticking to GHC, there's a lot that could be done when it comes
to improving understanding of just what the optimizer is doing.
Anything better than staring at intermediate code would be an
improvement, since time spent staring at intermediate code usually is
time spent narrowing down the 2 lines out of 1000 that are relevant.


Yhc has intermediate code that is substantially more Haskell like, and
with the command:

loadCore file.ycr = writeFile file.html . coreHtml

You can generate an active Html document that lets you explore the
Core in a more interactive way - including hyperlinks for function
names, syntax hilighting etc.

i.e: http://www.cs.york.ac.uk/fp/yhc/Roman.html

All of these things make playing with Yhc Core much more fun than
playing with GHC Core. There is absolutely no reason you couldn't add
all these things to GHC Core, then perhaps you'd save some time when
it does come to the examine core level.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: A function for Maybes

2007-01-25 Thread Neil Mitchell

Hi Alan,


Usually, when I have a question like this, I try Hoogle first:
http://www.haskell.org/hoogle/?q=%28a+-%3E+b%29+-%3E+Maybe+a+-%3E+Maybe+b

Unfortunatly, the right answer (fmap) is on the second page of results.


The reason for this is that Hoogle 3 doesn't understand higher-kinded
type classes, i.e. Monad and Functor, which means that fmap doesn't
match as closely as it should do. Hoogle 4 would give fmap as the
first result, I'm pretty sure.


(I am really excited for the new version of Hoogle, its supposed to be
pretty close to release)


Me too, but you'll probably have to wait a few more months yet - but
the various components are coming together nicely.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Haskell] [Fwd: Re: Computer Language Shootout]

2007-01-25 Thread Neil Mitchell

Hi


 Yhc has intermediate code that is substantially more Haskell like, and
 with the command:



Wow, the core looks really cool! One look and you see it all. I would
even rename the local variables to single letters like a,b,c because the
cryptic numbers are quite hard to track. This is something coreHtml can
do. Also, I'd add more color, like making punctuation marks grey, but
that's a very personal taste.


Yhc.Core is a big library of useful things to do with Yhc Core. One
of them is:

uniqueBoundVarsWith :: [String] - CoreExpr - CoreExpr

Which replaces the free variables with a list you pick. This means
that the transformation you want is a single line:

applyBodyCore (uniqueBoundVarsWith (map (:[]) ['a'..]))

That will transform a whole Core program, giving you the variables you
requested. That's one of the things I like about Yhc.Core, it is a
very nice library to use.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Haskell] [Fwd: Re: Computer Language Shootout]

2007-01-25 Thread Neil Mitchell

Hi


Although there may not be a lot of optimizing Haskell compilers, there are
compilers for languages similar to Haskell that consistently perform well.
One could point to O'caml or others in the ML family, or even more
interesting is the case of Clean, whose syntax heavily borrows from Haskell.


ML is strict, this makes a big difference. Things that Haskell
compilers do easily (inlining) are harder in a strict language. Things
that strict languages do easily (unboxing) are harder in Haskell.
There are enough differences to make it not a same thing issue.

Clean on the other hand is just Haskell with a different syntax. The
Hacle project [1] showed that if you convert Haskell to Clean, you can
sometimes beat the performance of Haskell code.


What do the Clean folks do that has made their compiler so consistently
competitive?  Is it the abc machine?  Frankly I'm amazed that a three stack
based virtual machine can be translated into such efficient machine code in
register centric CPU architecture.


The 3 stacks give a nice computational model of unboxed operations.
Maybe this is the thing that allows more effient CPU layout.


Supposedly someone is working on a Haskell compiler
that will use the clean compiler back end.


The Clean team are (or were) working on a Haskell front end for Clean.
The Yhc team is working on a Clean back end.


I can't believe that Clean is so
fundamentally different, even with uniqueness types, that it has an edge in
compiler optimization.


Uniqueness types does give some extra optimisation potential, such as
destructive updates if you can guarantee a variable is only referred
to once. But even with that, the language that has impressed me most
on the shootout is Clean. Where the Haskell community spends
significant time they can beat Clean, but generally the Clean does
very well and looks much more idomatic FP than the Haskell.

Thanks

Neil

[1] google hacle
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] No Derived Read for Unboxed Arrays

2007-01-25 Thread Neil Mitchell

Hi,


I was trying to convert some code from ordinary boxed array to unboxed
arrays for performance reasons.



However my code ultimately failed because
I load a large array saved as a text file using the derived Read, Show
mechanism.


I found that Read was maybe 30 times slower than the slowest binary
serialisation method I could possibly think of. If performance matters
to you, and the array is more than a few elements long, switching away
from Read/Show should be the first step - before going for unboxed
arrays.

(But of course, having Read/Show defined for UArray may well be
useful, and sounds a good idea)

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] No Derived Read for Unboxed Arrays

2007-01-25 Thread Neil Mitchell

HI Don


 (But of course, having Read/Show defined for UArray may well be
 useful, and sounds a good idea)

There's also an instance Binary for UArray. That might be useful?


Is there an instance Binary in a released library?

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] IO is not a monad (and seq, and in general _|_)

2007-01-23 Thread Neil Mitchell

Hi


That's not quite what I was trying to say.  (p^~p)-q is equivalent
to _|_ in the sense that once you derive/compute (respectively) it,
the world in which it exists breaks.


I think thats a bit overly harsh view of _|_ to take. The world does
not break once you compute _|_ - a _|_ value doesn't allow you to
prove/compute anything you couldn't before. While removing _|_ from
the language does make some things nicer to reason about, there aren't
many corners where _|_ really gets in the way that much - seq being
one of those few corners.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] IO is not a monad (and seq, and in general _|_)

2007-01-23 Thread Neil Mitchell

Hi


 prove/compute anything you couldn't before. While removing _|_ from
 the language does make some things nicer to reason about, there aren't
 many corners where _|_ really gets in the way that much - seq being
 one of those few corners.

But that is exactly the problem:  `seq` forces _|_ to get into the
way, when it normally doesn't.  So I'm not clear that trying to fit
`seq` into a formalization of Haskell's semantics is the way to go.


Agreed, that was the point I was trying to make :)

You seemed to be suggesting _|_ was evil (for want of a more precise
term) in its behaviour with Haskell. As you seem to say now (and I
agree), _|_ is a perfectly useful value, just seq gets in the way.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Strings in Haskell

2007-01-22 Thread Neil Mitchell

Hi Alexy,


Now I'm reading a
Haskell book which states the same.  Is there a more efficient Haskell
string-handling method?  Which functional language is the most
suitable for text processing?


There are the Data.ByteString things, which are great, and have much
less overhead.

But remember that Haskell is lazy. If you are thinking well I have to
process a 50Mb file, remember that Haskell will lazily read and
process this file, which substantially reduces the memory requirements
so only a small portion will ever be in memory at a time.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Article review: Category Theory

2007-01-19 Thread Neil Mitchell

Hi Brian,


I've often wondered why seq is the primitive and not $!
Would this solve the problem?
Is there any solution that would allow excess laziness to be removed from a
Haskell program such that Hask would be a category?


class Seq a where
   seq :: a - b - b

Then you have a different seq based on the types, and it doesn't go
wrong. You would probably want deriving Seq support.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple HTTP lib for Windows?

2007-01-18 Thread Neil Mitchell

Hi,

I've often wondered the same as the above poster. Something like
readWebPage (in the same style as readFile) would be a really handy
function. Do no libraries provide this?

(if not, can one start providing it? MissingH?)

Thanks

Neil

On 1/18/07, Alistair Bayley [EMAIL PROTECTED] wrote:

 I'd like to write a very simple Haskell script that when given a URL, looks
 up the page, and returns a string of HTML. I don't see an HTTP library in
 the standard libs, and the one in Hackage requires Windows machines have GHC
 and MinGW to be installed and in the PATH.

 Is there a simple way to get the contents of a webpage using Haskell on a
 Windows box?

This isn't exactly what you want, but it gets you partway there. Not
sure if LineBuffering or NoBuffering is the best option. Line
buffering should be fine for just text output, but if you request a
binary object (like an image) then you have to read exactly the number
of bytes specified, and no more.

Alistair

module Main where

import System.IO
import Network

main = client www.haskell.org 80 /haskellwiki/Haskell

client server port page = do
  h - connectTo server (PortNumber port)
  hSetBuffering h NoBuffering
  putStrLn send request
  hPutStrLn h (GET  ++ page ++ \r)
  hPutStrLn h \r
  hPutStrLn h \r
  putStrLn wait for response
  readResponse h
  putStrLn 

readResponse h = do
  closed - hIsClosed h
  eof - hIsEOF h
  if closed || eof
then return ()
else do
  c - hGetChar h
  putChar c
  readResponse h
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Article review: Category Theory

2007-01-18 Thread Neil Mitchell

Hi


Isn't _|_ = \x - _|_?


_|_ `seq` () = _|_
(\x - _|_) `seq` () = ()

Whether this is the fault of seq or not is your call...

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Article review: Category Theory

2007-01-16 Thread Neil Mitchell

Hi David,

For some reason, in Firefox printing those diagrams to a black and
white printer gives black for the background. It means that the arrows
and annotations are in black on black, not the most readable...

Any way to fix that? Perhaps uploading diagrams with white
backgrounds, instead of transparent (if that is currently the case)

Thanks

Neil



On 1/16/07, David House [EMAIL PROTECTED] wrote:

Hey all,

I've written a chapter for the Wikibook that attempts to teach some
basic Category Theory in a Haskell hacker-friendly fashion.

http://en.wikibooks.org/wiki/Haskell/Category_theory

From the article's introduction:

This article attempts to give an overview of category theory, insofar
as it applies to Haskell. To this end, Haskell code will be given
alongside the mathematical definitions. Absolute rigour is not
followed; in its place, we seek to give the reader an intuitive feel
for what the concepts of category theory are and how they relate to
Haskell.

I'd love comments from newcomers and experts alike regarding my
approach, the content, improvements and so on. Of course, it's on the
wikibook, so if you have anything to add (that's not _too_ substantial
otherwise I'd recommend discussion first) then go ahead.

Thanks in advance.

--
-David House, [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Pattern matching

2007-01-15 Thread Neil Mitchell

Hi Stefan,



myFunction x@(Constructor1 _*) = ...
myFunction x@(Constructor2 _*) = ...


myFunction x@(Constructor1 {}) =
myFunction x@(Constructor2 {}) =



myFunction2 (Constructor1 _* a _*) = ...

could be possible as long as the pattern is non-ambiguous (in this
case, only one variable with the type of a is present in this
constructor).


In this context a is not a type, but a value, and the non-ambiguous
constraint can get pretty confusing in a case like this. The answer is
to use records:

data Data = Constructor1 {field1 :: Bool, field2 :: Int, field3 :: Int}

myFunction (Constructor1 {field2=a}) = ...

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaskellForge?

2007-01-08 Thread Neil Mitchell

Hi


I.e. cabal + hackage + planet.haskell + weekly news ;)


Does hackage actually allow a user to setup a new darcs repo on a
remote server? That's about the only thing lacking - for everything
else people can just use code.google.com, which is way better than
anything any Haskell hacker would ever have time to come up with.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] readFile problem

2007-01-08 Thread Neil Mitchell

Hi Stefan,


I am writing a network server in haskell. Lately I seem to have
introduced a new bug. On Linux, when a client closes the connection to
the server, the server dumps core.


Are you using any calls to system? Any libraries which may do funky stuff?


application.exe: config.xml: openFile: does not exist (No such file or
directory)

I use readFile to read the config file. I tried to print out the
config file after it is read to make sure that it is completely read.
I only load this config file exactly once during program
initialization. The config is used long before the crash. I printed
the current working dir in the exception handler and there is
something interesting. Instead of the path to the application, it is
\C:\\WINDOWS\\system32.


What is the working directory at the begining? Is that really the
working directory? The \C at the start isn't the C drive, but some
bizare escape code, I think.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] trouble installing greencard -- -fno-prune-tydecls flag ( was Re: trivial function application question )

2007-01-07 Thread Neil Mitchell

Hi


In the meantime, how about the following:

In default non-verbose mode, silently memoize
the list of packages that were not found. Then,
only if something goes wrong, say something like:

The package failed to build. Perhaps the reason
is that one of the following packages was not found:


That doesn't seem that helpful. On error, give a list of maybe 25
things that are missing, only to find out that you're running GHC
6.4.1 on Windows which no one ever tried before. It's not really
narrowing the cause of the error too much anyway.

Something like scons does this much much better than Cabal does - it
only complains if it finds something you need but don't have. For
example, with Yhc you can compile the compiler with GHC, and the
runtime with GCC/Visual Studio. Lacking half those dependancies won't
give you an error message if you only try to do the right thing.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] trivial function application question

2007-01-04 Thread Neil Mitchell

Hi Brad,


i have a small problem that will be certainly trivial for almost
everyone reading this, i would appreciate a little help


If you have trivial problems, its often useful to ask on Haskell IRC
(http://www.haskell.org/haskellwiki/IRC_channel)


from which my intent is that a be replaced by Z, b by Y etc

i am sure there is an elegant way to apply replace to s for all of
these argument pairs without composing replace N times myself, but the
solution escapes me.


In your example all strings are one letter long, is that how this
works? If so, then you can simplify the problem significantly to use
Char's, and use the following library functions:

First off, if you want to apply the same transformation to each item
of a list, namely to either replace it or leave it the same. This
calls out for map.

Secondly you want to do lookups in some sort of table. The lookup
function can be very handy here. The lookup function works on
associative lists, so you'd need to zip patterns and replace into an
associative list.

If you really want to operate on strings, rather than characters, then
you have to be more clever. Also replace called multiple times
probably won't be enough, consider replacing 1 with 2, 2 with 3. If
you just call replace multiple times, 1 may well end up at 3, when 2
is more likely to be the right answer.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Composing functions with runST

2007-01-03 Thread Neil Mitchell

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 which I've needed more.


I think interact is a bit ugly. Most introductory problems are take a
small amount of data, do something. In that case using Hugs/GHCi with
:main arguments to give in the arguments, getArgs to read them and
putStrLn to show the results is a very beautiful and does about all
that you need. Very few programs are actually interactive - if they
are they should usually get a GUI.

As for beginner issues with rank-2 types, I've been learning Haskell
for years now, and have never felt the need for a rank-2 type. If the
interface for some feature requires rank-2 types I'd call that an
abstraction leak in most cases. It certainly means that you can't
properly Hoogle for it, can't compile it with Yhc, can't do full type
inference etc.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Mo' comprehensions

2006-12-30 Thread Neil Mitchell

Hi


I was solving some programming puzzles today[1], and found myself
pining for Map comprehensions.


[ ... (key,val) - fromList map, ... ]

It isn't really that much more than a straight comprehension would be on a map.

By default should a map comprehension let you inspect the values, or
the keys, or both?

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Combine list of sorted lists

2006-12-29 Thread Neil Mitchell

Hi


  f1 :: [Int] - [[Int]]
   f1 [] = []
  f1 (a:as) = [a] : f1 as


f1 is simply a map


  f3 la lb = let a = head la
  b = head lb
 in if sum a = sum b then
a : f3 (tail la) lb
 else
b : f3 la (tail lb)


Why not use pattern matching to split up la and lb, rather than head/tail?

I would have thought the whole function could be written as a nice
foldr merge, where merge :: [Int] - [Int] - [Int]. Thats only a
guess at the top of my head though, not worked out properly.

Is this homework? If so its useful to state when you post the question :)

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Combine list of sorted lists

2006-12-29 Thread Neil Mitchell

Hi Quan



I am not sure how to express f1 with map?  how do I say
(lambda (ls)
(map (lambda (x) (list x))
ls))
in Haskell?  map ([])  ?


map (:[]), :[] takes a single element and puts it into a list. Some
people refer to this as box

The final f3 clause can be made a bit neater:


f3 la@(a:as) lb@(b:bs) | sum a = sum b = a : f3 as lb

   | otherwise = b : f3 la bs

Additionally, if it was me I'd refer to a:as on the RHS, rather than
giving it a name with the @ pattern, but thats a personal question of
style.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Idiomatic Haskell equivalent of keyword arguments to functions

2006-12-29 Thread Neil Mitchell

Hi Paul,


To make things concrete, the example I'm really thinking of is a send
an email function, which would take a subject, a body, a list of
recipients, optional lists of cc and bcc recipients, an optional
mailserver (default localhost), an optional port (default 25), and
possibly optional authentication details.


Records are your friend.

data Email = Email {subject :: String, body :: String, to ::
[Address], cc = [Address], bcc = [Address], mailserver :: String, port
:: Int}

defaultEmail = Email{subject = No subject, body = , to = [], cc =
[], bcc = [], mailserver = localhost, port = 25}

The user can then go:

sendEmail defaultEmail{subject=Subject here, body = body here, to
= [haskell-cafe], mailserver = server.haskell.org}

Now things which are't specified (port) keep their default value.

The other alternative is:

data EmailParams = Body String
   | Port Int
   | Mailserver String
 ...

then:

sendEmail [Body body here, To haskell-cafe, Mailserver
server.haskell.org ...]

I prefer the first, but the second can also be done.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is there a printable copy of the (GHC) library references anywhere?

2006-12-27 Thread Neil Mitchell

Hi Paul,


You're right - if I think about it, I'm not really looking for the
documentation, but more a paper or article which is a tour of the
GHC standard library.


A tour of the Prelude:

http://undergraduate.csse.uwa.edu.au/units/230.301/lectureNotes/tourofprelude.html

Only a few of the standard libraries are useful unless you are doing
something specific. i.e. Data.Maybe is generally useful, but
Control.Monad.State is only useful if you are using a state monad.

If someone wrote a tour of Data.List/Data.Maybe as well as a few
common functions out of Control.Monad that would probably make a nice
companion to a tour of the prelude.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Getting my feet wet - not in Haskell though

2006-12-24 Thread Neil Mitchell

Hi


(There's still no good introduction to Monads, for example. One that's
understandable for a programmer who knows his Dijkstra well but no
category theory. And a few other things.)


I grasped this one first time round:
http://haskell.org/haskellwiki/Monads_as_containers

No category theory. A basic understanding of apples and boxes is all
that is required.

http://haskell.org/haskellwiki/Monad has a list of about 10, plus
pretty much every book/general tutorial introduces Monad's as well. If
there is really nothing out there that helps you understand, you might
want to prod some authors as to what isn't clear/understandable.

And Haskell let's you serialise thunks just fine (use Yhc), but really
if thats what you want to do, I think you are going to suffer a lot in
the long run... I have written client/server app's before, the whole
point is you want to decide what computation gets performed on which
side, not leave it up to the vagaries of lazy evaluation to come up
with a random solution.

Haskell is fun, Haskell is good, but its not the right answer to every
question. Just have fun doing whatever you do :) If at the end you
wrote up a little summary of your project, what you used, how it went,
what issues you ran into - then perhaps people can tell you (with the
benefit of hindsight) how Haskell might have been.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: How to serialize thunks?

2006-12-21 Thread Neil Mitchell

Hi


  All those libraries really force the data because they all are written
  in Haskell. If you want to serialize thunks then you will need some
  support from RTS.

 Good to hear that my conjectures aren't too far from reality.

 Does any Haskell implementation have that kind of RTS support?

Not yet. I ever don't know of anyone planning to do that.


Actually I think Yhc has exactly this kind of support, and you can
even ship these thunks over the wire and reconstruct them on a
different machine :)

http://darcs.haskell.org/yhc/src/packages/yhc-base-1.0/YHC/Runtime/API.hs

Poorly documented, but it does work. Use at your own risk!

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Versioning

2006-12-21 Thread Neil Mitchell

Hi


there are really no choices for real development. many libraries, language
extensions and techniques are for ghc only


I develop everything in Hugs, including the Yhc compiler itself. Hugs
is great. There are lots of extensions in GHC, but Haskell 98 is a
perfectly useable language!


 So have other compilers picked up SYB support yet?

SYB and Template Haskell are just examples of techniques that make GHC
obvious choice. although. SYB may be supported by Hugs too, i'm not sure


GHC is the only one with inbuilt SYB support. Hugs has deriving
Typeable (I think), but not Data.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Versioning

2006-12-21 Thread Neil Mitchell

Hi


In other words, you can program in Haskell just fine without
extensions.  But if you want that next level in type safety,
extensions is where it's at, at least for the kind of code I write.


What level of safety do these type extensions give you? The biggest
runtime crasher is probably pattern match failings, something that
most of these type extensions don't catch at all!

They do give you some safety, but not a massive amount, and not in the
places where it would be truely useful.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Versioning

2006-12-21 Thread Neil Mitchell

Hi


In other words, what on earth is good about gluing oneself to Haskell98?
Life's moved on...


If you stick to Haskell 98 you can:

* Convert your code to Clean (Hacle)
* Debug it (Hat)
* Run it in your browser (ycr2js)
* Document it (Haddock)
* Make a cross platform binary (yhc)
* Get automatic suggestions (Dr Haskell)
...

Sometimes you need a type extension, but if you don't, you do get benefits.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Versioning

2006-12-21 Thread Neil Mitchell

Hi


True, though it would be even better if the usual extensions were more
widely supported, though I suppose identifying what's useful and therefore
worth supporting is the point of the Haskell Prime process.


Exactly the reason for Haskell Prime.


As an aside I've often thought it would be better if the various components
of Haskell compilers/tools would be separated out so that people could
effectively build their own compiler tailored more specifically for their
needs.


http://neilmitchell.blogspot.com/2006/12/bhc-basic-haskell-compiler.html

I thought the same thing. Note that Yhc already has a lightweight API
for manipulating Yhc.Core files and one for Yhc.Bytecode files. Things
are moving in that direction slowly. There is also the GHC API
approach.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Versioning

2006-12-20 Thread Neil Mitchell

Hi Jo,

You seem to be describing SYB and not knowing it:
http://homepages.cwi.nl/~ralf/syb1/

That basically does exactly what you've requested, in terms of
traversing all items when only one matters. That said, serialisation
is still a hard problem - think long and hard before picking a data
format.

With Yhc.Core I used Drift to derve Binary instances, keep a version
tag, and if the version tags mismatch refuse to load the data.

Thanks

Neil

On 12/20/06, Joachim Durchholz [EMAIL PROTECTED] wrote:

As written in my other post, I will need to update data structures that
were marshalled to disk.

Now I'm wondering how to best prepare for the situation. E.g. one of the
common situations is that a single data item gets replaced by a list of
items.

Now assume that there's a SomeData type that's used across the game, and
which gets incompatibly updated SomeData1 (say, instead of containing
just a string it turns into a list of strings).
The update code would now have to unmarshall a blob of game data,
traverse it to find all instances of SomeData, wrap them in a
one-element list to turn them into SomeData1s, reconstruct the blob of
game data with the SomeData1 items, and marshall the result back out to
disk.
This sounds as if I'd have to write code for every single data type in
the update program just to update a single data type. Is that true, or
is there a way around this?

Regards,
Jo

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Getting my feet wet - small browser game

2006-12-20 Thread Neil Mitchell

Hi


Btw, if you're dumping large structures to disk, using Read/Show is a
bad idea :)


Just as a mention how bad it is, maybe 30 times at Show and 50 times
at Read. I used to use this approach, moving away from it and learning
how to use Drift was a good idea.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Versioning

2006-12-20 Thread Neil Mitchell

Hi


 With Yhc.Core I used Drift to derve Binary instances, keep a version
 tag, and if the version tags mismatch refuse to load the data.

Links?


http://repetae.net/~john/computer/haskell/DrIFT/

http://darcs.haskell.org/yhc/src/libraries/general/Yhc/General/Binary.hs

Thats Drift which can derive binary instances (pick GhcBinary), and
then a module which can work with the derived classes.

Warning, mild hacking was required to get it going on Windows.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Data.Generics question

2006-12-19 Thread Neil Mitchell

Hi Mark,


nested type, but to do that I seem to have to create a whole other
near-copy of the data declarations with slightly different names and the
occasional constructor missing. I wonder if there's a better way.


Instead of getting the type system to enforce it, you can write
annotations that capture this restricted type.

See:

http://www.cl.cam.ac.uk/~nx200/research/escH-hw.ps

http://www-users.cs.york.ac.uk/~ndm/projects/catch.php

Note that neither of these tools are publically available, but I
suspect both will be within a year or so. I'm hoping Catch will be
much sooner.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: A suggestion for the next high profile Haskell project [Was: Re: What is a hacker?]

2006-12-19 Thread Neil Mitchell

Hi Joachim,


 Why? In case the strictness analyzer was buggy?

 I'd be perfectly happy if that analysis were just a note saying run ghc
 with such-and-these options and inspect the intermediate code for
 function foo to see that the strictness analyzer determined it will
 always terminate.

I think you are asking too much from the strictness analyzer.


Why would you want strict code? Haskell's lazy semantics makes it much
more amenable to equational reasoning. If you keep this laziness you
can do all manner of proofs on the code.

If what you want is real-time guarantees then something like the Hume
project might be what you are after. Shoving a strictness analyser
over a piece of code only returns info about the WHNF, nothing deeper.
If you take it as anything more than an optimisation hint, it will
come back and bite you...

If what you do want is termination proofs, then you want this:
http://www-i2.informatik.rwth-aachen.de/giesl/papers/RTA06-distribute.ps

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: A suggestion for the next high profile Haskell project

2006-12-19 Thread Neil Mitchell

Hi


Obviously when

 Cost(Upgrade)  Cost(Optimisation)

for the customer. Those costs are

 Cost(Upgrade)  = Price of more memory or new PC which is fast enough.

 Cost(Optimisation) = Hours_spent * Fee_per_Hour / N


You are talking closed source commercial software for the masses. I
don't know anyone who distributes software like this written in
Haskell (although I'm sure there might be one or two)

Now imagine working for a single company, or for small volume
software. You ask them to upgrade, they turn around and say bye bye.

Now imagine you are working for a company, and have to convince people
to throw away C and move to Haskell. Haskell is too slow will often be
an initial argument, if its in any way right, that will be enough.

Now imagine you are writing an open source project. People will turn
around and use a Haskell compiler written in C (Hugs) instead of one
written in Haskell (GHC) because its 100 times faster to load the
program. Imagine you are writing a version control client, people will
complain because certain operations take 100's of years on their big
Haskell repo. [I use Hugs, and complain that darcs on the Yhc repo
sometimes goes into virtual non-termination - although I love both GHC
and darcs at the same time]

Speed is sometimes important. Let's not forget that and wheel out cost
of hardware arguments.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re : [Haskell-cafe] Re: A suggestion for the next high profile Haskell project [Was: Re: What is a hacker?]

2006-12-19 Thread Neil Mitchell

Hi minh thu,


Lazy semantics - equational reasoning ?
I thought that : lack of mutable state - equational reasoning.
For instance, I think to data flow variable in Oz (whcih I really
don't know much / never used) : if a (Oz managed) thread attemps to
read the value of an unbound (data flow) variable, it waits until
another thread binds it. But the equational reasoning (referential
transparency) remains (and the evaluation is eager by default).


Lack of mutable state, referentially transparent and laziness all help
with equational reasoning. Inlining is much easier in a lazy language
- and inlining is really handy for equational reasoning.

Imagine:

not_term = non_term
f x = 12

Now evaluating:

main = f non_term

In a lazy language the value is always 12, in a strict language its
always _|_. Now let's inline f:

main = 12

In a lazy language the value is still 12, in a strict language the
value has changed.

Note how in a strict language inlining is not as safe as it once was...

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A suggestion for the next high profile Haskell project

2006-12-19 Thread Neil Mitchell

Hi


I don't know if any actual language does this,


What, that is strict and would like to inline things for performance?
There is a reason they can't do this.


but your inlining problem can
be solved by letting _|_ = arbitrary behaivor.


So would you allow folding? (inlining = unfolding) i.e. replacing
defined behaviour with _|_?

And how many equational reasoning steps do you have to go, before your
program is totally different?

Equational reasoning is easier in a lazy language.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Showing the 1 element tuple

2006-12-19 Thread Neil Mitchell

Hi,

A weird question, what does the 1 element tuple look like?

() -- 0 element tuple
(,) a b -- 2 element tuple
(,,) a b c -- 3 element tuple

() a - meaningless
(a) - a in brackets

GHC has the 1 element unboxed tuple, (# a #), and all the other sizes
unboxed as well, but how would you visually represent the 1 element
boxed tuple?

As it happens, Yhc _does_ have the 1 element tuple, you just can't use
it from normal programs, its only created by desugarings of class
instances. I'd quite like to change this, and I also need to render
the 1 element tuple in some way, so wondered if anyone had any good
ideas (or if there is even some sort of convention)

I currently use ()1, but don't like that as it doesn't follow Haskell
rules - the () and 1 would be separate lexemes. My other thought is
(?), where ? is something appropriate - but all the appropriate things
I can think of would either not be a lexeme (i.e. 1), having an
existing meaning (i.e. . | etc) or seem wrong.

Thoughts?

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Showing the 1 element tuple

2006-12-19 Thread Neil Mitchell

Hi


Python uses the syntax (foo,) to denote a singleton tuple (that is an extra
comma at the end); quoting the python tutorial Ugly, but effective.


Yes, I thought of that, the issue is:

(a,b) is considered syntactic sugar for (,) a b
(a,) is syntactic sugar for...

And the place I'm displaying this is definately after desugaring!


Could tuples be implemented as an HList?
singleton = (`hCons` hNil)


Not in Yhc, no higher rank types :) Also tuples are really really
common, every class function has quite a few floating around - HList
is just too much overhead (I think).


Tuples represent dimensionality therefore a 1-element tuple is just a
1-dimensional value ie the value itself hence a == (a) == ((a)) == (((a)))


Tuples are a box you can put things in, in Haskell:

data Tuple a = Tuple a

Tuple (Tuple 1) /= 1

(either at runtime, at type time, or any other time)

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: A suggestion for the next high profile Haskell project

2006-12-18 Thread Neil Mitchell

Hi Bulat,


let's go further in this long-term discussion. i've read Shootout problems
and concluded that there are only 2 tasks which speed is dependent on
code-generation abilities of compiler, all other tasks are dependent on
speed of used libraries. just for example - in one test TCL was fastest
language. why? because this test contained almost nothing but 1000 calls to
the regex engine with very large strings and TCL regex engine was fastest


It's more than 2 tasks that are dependant on the code generated by the compiler.

And in my opinion, generally the Clean solution was the nicest in
terms of speed/performance. There is absolutely no reason Haskell
can't be as fast as Clean. Clean doesn't seem to go to the imperative
style in most of the benchmarks.

I think Bulat has a point, currently the speed of idiomatic Haskell
lags behind that of idiomatic C. But the two responses to that have to
be currently, but not forever. And idiomatic C is like pulling out
your own teeth with a pair of pliers - sometimes necessary, but never
fun.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: A suggestion for the next high profile Haskell project

2006-12-17 Thread Neil Mitchell

Hi,


Is that an intrinsic feature of the language, or could compilers'
optimisation plausibly get clever enough to do well without lots of seq
and explicit unboxings and suchlike?


I believe that compilers can get a lot cleverer - my hope is that one
day the natural Haskell definition will outperform a C definition.

Of course, lazy evaluation makes that hard work, but I think it can be
done eventually.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] I'd like start with Haskell, but...

2006-12-16 Thread Neil Mitchell

Hi Waldemar,


The final aim of the aproach is to get a tool in which there will be no
syntactic errors during modelling bussiness logic. Recently I've finished very
primary version of the tool (0.001:-).


Ah, now that sounds like Haskell might be good for :)

Haskell isn't great at writing a GUI and database combination, in my
experience. It certainly can, it just tends to be a bit of work.

Having said that, Haskell is _great_ for writing domain specific
libraries, for plugging together new applications and for modelling
business logic. It's likely that your business logic has some standard
set of operations, which you combine in some way - this is the thing
Haskell excels at - defining small things, and combining them in new
ways. The type system will help to ensure that the combinations are
good, which again helps reduce errors.


I do not know C#, but what was attracting me to Haskell is - as they say -
compact, clean and very functional way of programming.


Yes, a well designed Haskell program will give much better separation
of concerns. You can totally separate the logic from the user
interface gunk, and it will be more maintainable.



Maybe, but what is still unclear for me: Haskell is wrong for GUI/Database
application because of lack of good libraries or because of it's way of
programming???


The libraries for GUI programming are not great - they are
progressing, and can certainly be used to develop tools, but I don't
feel they are the good stuff yet. Maybe I'm just setting the bar
higher because the rest of Haskell is so nice.

The current style of GUI programming in Haskell tends to be in the IO
monad, and feel very much like imperative programming. Haskell is
perfectly capable of being an imperative programming language where
required, but its not as natural as something like C# in this respect.

So in answer to your question, I'd say a little of both, but with the
optimistic view that one day someone will figure out what a GUI
program in Haskell should look like and everyone wlil be happy :)

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Building the community

2006-12-14 Thread Neil Mitchell

Hi


*  Give tips on how to answer questions

+ Ok. we can put up an article here. Some suggestions:
- No questions are bad questions
- Code should come with examples of how to run it
- Solutions with unsafePerformIO should be discouraged (moreso 
;)
- Be polite! (we're good at this)


I'd say our worst feature is tending to give solutions which are not
simple Haskell, but make use of advanced features. When a beginner
asks a question, sometimes the answer requires GADT's, Template
Haskell, rank-2 types etc. However this is usually because they asked
the wrong question - thinking in an imperative frame of mind. Often it
would be better to peel back to the original problem, where the answer
is more likely to be pure neat Haskell.

I guess unsafePerformIO is just one instance of this.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: [Haskell] interpreter ouput in color

2006-12-14 Thread Neil Mitchell

Hi Walter,


Hi all. I was wondering if some people miss the colored output
of some applications, such like the IPython enhanced shell. I've
been googling for similar options for Haskell but I found nothing.


WinHugs already colours (to some degree) and hyperlinks error messages.

http://www-users.cs.york.ac.uk/~ndm/projects/winhugs.php (screenshot
on that page)

GuiHaskell does it a lot more, with full syntax colouring of error
messages and hyperlinks. Unfortunately it can't be used reliably at
the moment due to threading issues with Gtk+Gtk2Hs+GHC+Windows.

http://www-users.cs.york.ac.uk/~ndm/projects/guihaskell.php

GuiHaskell merely wraps GHCi (and Hugs and other stuff), so allows
syntax colouring to be implemented without diving into the GHC source
code.

Thanks

Neil

PS. The Haskell-cafe mailing list is better for this sort of question,
haskell tends to be more used for announcements, so i've sent the
follow up there.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Stack, Heap and GHC

2006-12-14 Thread Neil Mitchell

Hi


Did you compile with -O (optimisations). Sometimes this fixes things,
and its just good practice.


It's slower to compile, and might fix things in GHC Haskell, but other
compilers don't all have -O flags, so its generally best to make your
program at least have the right sort of time/space behaviour using
Haskell. If your code doesn't work without -O, then it probably won't
work in Hugs or Yhc.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell and .NET

2006-12-13 Thread Neil Mitchell

Hi

Yhc also has a .NET generating capability, just pass the -dotnet flag.

http://haskell.org/haskellwiki/Yhc

Thanks

Neil

On 12/12/06, Monique Monteiro [EMAIL PROTECTED] wrote:

Hi Justin,

  I've runned a research project about this topic (in fact, it was the
subject of my MSc dissertation).  Please see the Haskell.NET Project
(http://www.cin.ufpe.br/~haskell/haskelldotnet).  We have compiled a
subset of the Haskell language to .NET, but we still don't have an
available release (we don't support the full Haskell prelude yet).
The compiler is an extension to GHC.

  In the future, we intend to provide full interoperability with .NET
in this way.  There are some interesting references in the website
about our compilation strategies.

  If you need further information about the project's status, please
contact Prof. André Santos ([EMAIL PROTECTED]) and/or Guilherme Avelino
([EMAIL PROTECTED]).

Best regards,

--
_
Monique Monteiro, MSc
http://www.cin.ufpe.br/~mlbm
http://thespoke.net/blogs/moniquelouise/default.aspx
[EMAIL PROTECTED]
+55 81 34198137
Project Manager
Recife Microsoft Innovation Center
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Micro-contributions to MissingH

2006-12-13 Thread Neil Mitchell

Hi


 I'm wondering if I should submit this as a patch for MissingH. If so,
 where in the new hierarchy should this be placed?


I submitted 3 patches to missingh about a week ago, but have heard
nothing back since. Did they get spam filtered or something?

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell and .NET

2006-12-13 Thread Neil Mitchell

Hi Krasimir,


to produce code with reasonable performance. The major problem with
YHC is that it still doesn't have strictness analyzer.


It does, or rather Yhc.Core does (see Yhc.Core.Strictness -
http://www.cs.york.ac.uk/fp/yhc/snapshot/docs/Yhc-Core-Strictness.html).
This was only done a few weeks ago, so the .NET translator has no
benefit from it.

And strictness is not the biggest problem, a complete lack of any
optimisations is, but I'm working on that one too!

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell and .NET

2006-12-13 Thread Neil Mitchell

Hi


 And strictness is not the biggest problem, a complete lack of any
 optimisations is, but I'm working on that one too!

It is great to hear that. Of course an optimiser will be beneficial
too but I guess that even the benefit that the code generator can have
from the strictness analyzer will make huge difference.


In the GHC back end I seem to remember strictness gives a 10%
performance improvement, but let motion gives a 30% improvement - its
quite likely that .NET will benefit more from strictness, but still
the general optimisation is probably going to be a bigger win.

I think basic strictness information gained about 5% in the Javascript
Yhc backend, so not great amounts.

The optimiser does generalised deforestation, and loads of other cool
tricks, so I'm hoping for at least 50% over the normal Yhc code :)

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Request for a Simple Pretty Printing library

2006-12-13 Thread Neil Mitchell

Hi,

I've been using the HughesPJ pretty printing library, but I need a new
combinator:

wrap :: String - Doc - String - Doc
wrap prepend doc append = ...

The semantics of this would be that the text is prepended and appended
to the doc when rendered, but does not alter the pretty printing at
all. The idea of this is to support printing with HTML rendering:

wrap span class='keyword' (text case) /span

The HughesPJ library is 1000 lines long, so will be quite a lot of
work to change this to get it working properly. Is there a simpler
pretty printing library, with source code available somewhere? Ideally
using the same interface.

Of course, if anyone knows how to make this combinator using the
existing library, or using another existing library, I'd appreciate
it.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Request for a Simple Pretty Printing library

2006-12-13 Thread Neil Mitchell

Hi


Something like:

wrap prepend doc append =
zeroText prepend  doc  zeroText append
zeroText s = textBeside_ (Str s) 0 Empty


Thanks, that works great!

Is there likely to be any support for adding this to the standard
library? I'd rather not have to fork a version of HughesPJ to get this
feature.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Aim Of Haskell

2006-12-12 Thread Neil Mitchell

Hi


That's exactly the problem! For most people there *is* no difference.
You say functional programming to most people, even professional
programmers, and usually the only chance you have of getting them to
understand what what you mean is by asking so, have you heard of
Lisp, or Scheme?


Talking to professional programmers, if I tell anyone I program in
Haskell they nearly always say oh, Pascal, that's cool. No one knows
what functional programming is, Scheme/Lisp are the closest. Maybe we
should try and hijack the phrase functional programming - Haskell is
just too similar to Pascal.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Pretty printing HTML

2006-12-12 Thread Neil Mitchell

Hi,

I want to pretty print some text as HTML, using the standard HughesPJ
combinators. The problem is that I want the length of a text string
to be its textual context, not its character length.

For example, a keyword will display as case, but internally will be
the string span class='keyword'case/span

Is there any way to acheive this? I have come up with something, but
its not nice at all. It basically involves parsing the generated text
and inserting the extra HTML back in.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Refactoring recklessly

2006-12-12 Thread Neil Mitchell

Hi


I'd like to be able to reorganize my code and then verify that I didn't
change any functionality.  That is, the old and new code have precisely the
same meaning.

Also, I'd like to be able to change a function and verify that efficiency
was the only thing affected.

Are either of these possible in Haskell or any language?


They are possible in any language, just in some they might have a lot
of work to do the proofs. In Haskell they are pretty easy:

http://haskell.org/haskellwiki/Haskell_Equational_Reasoning_Assistant

(More one function at a time, not publically available, as far as I can tell)

http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html

(Global refactorings, a nice tool)

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] One question...

2006-12-09 Thread Neil Mitchell

Hi Waldmar,


Now my problem is connected with the non-update object feature.
I can't write variable instead object because - from the meaning of the word
( variable ) - it has the possibility to CHANGE its value.
Yes that my problem :-(



main = do
   username - read_info_from_user
   do_whatever_is_needed
   print username

Try not to think of this too hard. Once you start learning Haskell
you'll suddenly realise a lot of the problems just don't happen if you
think the Haskell way.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Download locations for former-base libraries?

2006-12-05 Thread Neil Mitchell

Hi


Of course, just saying download the latest version with darcs isn't
useful, either.  People that want to use my package shouldn't have to have
darcs, and they also shouldn't have to fight with broken development
software.

Or should I be telling people to download the GHC 6.6 extralibs source?
That doesn't seem quite right either; it's packaged as a tar.bz2, but what
would a Windows user with HUGS do?  That person probably couldn't even
unpack it.


I started doing some work towards this on windows:

http://www-users.cs.york.ac.uk/~ndm/projects/windows.php

I found that generally working out of the darcs repo's is both
horribly unreliable, but the easiest way to go about it, because its
more consistent.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GADT vs Arrows for parsers/FSMs/etc.

2006-12-05 Thread Neil Mitchell

Hi


It seems like Haskell has two emerging idioms for parsing and fsms:
GADTs and Arrows.


What about something else? If you limit yourself to the two things
that look new and cool (where emerging is another word for new, and
idiom seems to be the current Haskell word for cool), you miss out on
all the tried and tested stuff.


I am thinking about using one of these idioms to represent server
structure in a future version of HAppS but I'm not sure where to
start.  Why would one choose one or the other?


I would pick Arrows (over GADTs) because Arrows are Haskell, and are
supported by multiple Haskell compilers. Other than that (as far as I
was aware) these two things are massively different, so I wouldn't
have thought it was a one or the other choice usually.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] 2D Array

2006-12-03 Thread Neil Mitchell

Hi


unsuitable. It seems that a Map Int (Map Int a) is the most suitable
structure, but this seems cumbersome.


You might want to use IntMap, which is a version of Map specialised to
Int's, with better time bounds.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell source transformer?

2006-11-30 Thread Neil Mitchell

Hi Dimitry,


I know there is a Haskell syntax parser around (maybe, more than one).
Does anybody know of any utility based on such parser that does things
I need, or rather a library on top of the parser? I just would like to
avoid reinventing the wheel.


I have a Haskell parser here:
http://www.cs.york.ac.uk/fp/darcs/catch/src/Haskell/ - originally from
GHC but modified slightly by the Hacle project to work in Hugs and be
Haskell 98 (I think).

I am also intending to write a Yhc.Parser library, but haven't got
round to that yet.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] New Name for MissingH?

2006-11-30 Thread Neil Mitchell

Hi


The alternative I've been thinking of is something like Haskell Utility
Library (HUL).


Yuk. I like MissingH. MissingH suggests things that are missing from
the standard set and provided here. HsMissing would be my preferred
choice, but its not really important.

Haskell says which language its written in, library says its a
library, and utility tells me nothing (the word is too overloaded). By
the end I know its a Haskell library...

I think the problem isn't that the name is confusing, but that no one
knows it exists or what it does. Things like adding it to the Hoogle
database would probably help, along with greater there is a function
for that in MissingH posts to the haskell-cafe list as people ask.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: New Name for MissingH?

2006-11-30 Thread Neil Mitchell

Hi


I couldn't figure out how to add it to hoogle.  Does anyone have a pointer
for that?


Wait for Hoogle 4, and bug me. Hoogle 4 will allow additional
libraries to be searched. Once its ready I'll add MissingH.


 database would probably help, along with greater there is a function
 for that in MissingH posts to the haskell-cafe list as people ask.

True, too.  I didn't want to be too annoying, so I have tried to not do that
too much.  But since you asked, I'll try to step in more.


I think its a great way to both promote MissingH, and help newcomers
at the same time.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Building Binaries with Cabal

2006-11-30 Thread Neil Mitchell

Hi


let mydescrip = case System.Info.os of
  mingw32 - descrip
  _ - descrip {buildDepends =


Aghhh! To test if the operating system is windows you
compare against a hard coded string which _isn't_ an OS, but _is_ an
optional component by a 3rd party. It's required to build some Haskell
compilers, but for Yhc and Hugs its not required at any stage, and its
presence is optional!

I know this isn't your fault, it just scares me deeply that os could
return something that isn't an os! How about we add a cpu string,
which returns the amount of RAM installed. Or how about we add a
compiler string, which returns the users surname...

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Building Binaries with Cabal

2006-11-30 Thread Neil Mitchell

Hi


Your point is well-taken, but the distinction is useful.  If running on
cygwin, my platform is essentially POSIX, even though the OS is Windows.


Yes, but _my_ OS is reported as mingw32, even though its never been
installed on this computer...

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] generating javascript

2006-11-29 Thread Neil Mitchell

Hi Jeff,

It all depends how you want to write your code. The two options are
full Haskell (Yhc) or combinators (HSPClientSide).

Thanks

Neil

On 11/29/06, jeff p [EMAIL PROTECTED] wrote:

Hello,


 There's a Google SoC-project made by a friend of mine for JavaScript
 support in Haskell Server Pages:
 http://csmisc14.cs.chalmers.se/~bjornson/soc/

 It's a combinator library, but i'm not sure it's what you really need
 though. :)

This seems to contain just what I was looking for. Although I'm not
using HSP, it looks like the HSPClientside library can be used (in
conjunction with Text.XHtml) to generate webpages with embedded
scripts.

thanks,
  Jeff
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] generating javascript

2006-11-29 Thread Neil Mitchell

Hi


Anyway I encourage you to have a look at HSP as well :-)
It's quite nice to be able to use regular XML syntax within the Haskell
code.


I think it should be entirely possible to use Haskell with Yhc and HSX
(http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/), so you can
still write proper XML for your client side HTML.

This is the way Hoogle 4 is going to be written.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The Future of MissingH

2006-11-24 Thread Neil Mitchell

Hi John,


Should this all be one library?


No, several smaller libraries would be nice.


Should the module naming scheme be changed?


Yes, MissingH is not the place to put these things. You run the risk
of more name clashes, but thats ok.


Could, and should, any of this be integrated into the Haskell libraries
project?


Yes, some should, but only after careful review and being split up.
Assuming the Haskell libraries project is still something that should
be continued, once Hackage is up and running suddenly the distinction
becomes minimal.

A few of the functions should be picked out and moved into base, where
they truely are missing.



How could greater community participation be encouraged, while still
encouraging quality control?


Make sure more people know about it. I want to start using MissingH
but never got around to it, by continually telling me how great it was
I'm sure I would have started using it earlier. I have various bits of
general libraries strewn around the place, which I might contribute to
MissingH.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The Future of MissingH

2006-11-24 Thread Neil Mitchell

Hi


  How could greater community participation be encouraged, while still
  encouraging quality control?


It also took me quite a while to find the darcs repository, and as far
as I can see there is no web page on what MissingH has in it, other
than a textual readme and the GNU entry. If there was a single web
page which said what MissingH was and where it could be found, that
would help people.

The darcs repo I found was:
http://darcs.complete.org/missingh/

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Arrows tutorial

2006-11-19 Thread Neil Mitchell

Hi


Small arrows tutorial (sorta, I'm learning myself and trying to doc
as I go):

   http://www.thenewsh.com/~newsham/x/arrow.txt


Why not shove it on the wiki? Then everyone can find it, improve it,
and treasure it forever more.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wiki page for rewrite rules tips, types and tricks

2006-11-18 Thread Neil Mitchell

Hi


Great page, I especially like the phrase:
[...] changing a non-terminating program [...] into a much faster one [...]


And one important point:

In general its a bad idea for rules to change the semantics (meaning)
of your code in such a way. Consider someone using reverse . reverse
to demand strictness of an IO action (I've seen this in conjunction
with interact), this code would no longer work with the above rule.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] importing Distribution.Compat.FilePath fails

2006-11-18 Thread Neil Mitchell

Hi


How about using this instead:
http://www-users.cs.york.ac.uk/~ndm/projects/libraries.php#filepath

The only reason would be that it isn't in my GHC install by default (I'm
on Debian Sid).  However, I suppose I can look at this as an excellent
first experiment with Cabal and packaging Haskell libs for Debian :-)

Thanks for pointing it out.  Looks like a perfect fit for me!


I think someone is packaging this for Debian already, you might want
to email the debian haskell list to check and avoid duplicated work.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Debugging partial functions by the rules

2006-11-17 Thread Neil Mitchell

Hi


 How controversial would a proposal to {-# DEPRECATE fromJust #-} be, in
 favour of:

 Just _ = x  -- which will give you the precise line number



 It seems to me this is one cause of mysterious newbie errors we
 could easily discourage, with little harm.

Btw, I'm not seriously suggesting removing it ;)
It could be discouraged ever so slightly in the haddocks though.


I strongly disagree. If we are removing things that confuse newbies
why not start with higher rank types, MPTC's and GADT's ;)

fromJust is simple, useful and clear. What you mean is that
implementations aren't very good at debugging this. It seems unfair to
blame partial functions for the lack of a debugger. If a call stack
was automatically output every time a fromJust failed would this even
be something people complained about?

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Debugging partial functions by the rules

2006-11-15 Thread Neil Mitchell

Hi


I have always been wondering why error shouldn't always return a call
stack from the occurrance of fromJust up to the function I typed into
ghci (or up to main, for that matter).


yhi-stack (as yet unreleased) does exactly this, without requiring you
to recompile your code even.

hat-stack also does this.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Debugging partial functions by the rules

2006-11-15 Thread Neil Mitchell

Hi


Yes, these techniques are fairly well known now, and hopefully some of
the more experienced Haskellers are using them (I certainly use the
non-empty list tricks). Any anyone with more than 6 months Haskell knows
to avoid fromJust.


I'm not, I use fromJust all the time. Ditto for head, init, maximum, foldr1...


One solution would be to deprecate fromJust (we recently decided not to
add fromLeft/Right for the same reasons). Having a compiler warning is a
good way to encourage good behaviour :)


We didn't decide not to add fromLeft/fromRight, Russell decided to
defer it to a later patch. I am still very interested in them being
put in!

There seem to be two sides forming to this issue - use partial
functions or don't. I don't see why we should restrict the functions
available to the partial people, when the unpartial people can choose
not to use them.

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Debugging partial functions by the rules

2006-11-15 Thread Neil Mitchell

Hi


Should Haskell also provide unrestricted side effects, setjmp/
longjmp, missile launching functions, etc?  After all, people who
don't want to use them can just avoid them. :)


Fair point. But if you eliminate incomplete cases, and the error
function, you'd probably need to increase the power of the type
checker by introducing dependant types. It's a good research avenue,
and an interesting approach, but its not what Haskell is to me (but it
might be to others).


Every time I read code containing these functions, I have to
perform a non-local analysis to verify the invariant, or even to determine
the invariant.


If you use the Programmatica annotations, the ESC/Haskell annotations
or Catch then you can have these assertions checked for you, and in
the case of Catch even infered for you. Admitedly ESC/Haskell and
Catch aren't ready for use yet, but they will be soon!

Thanks

Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


<    3   4   5   6   7   8   9   10   >