Re: [Haskell-cafe] Very Basic IO question

2007-03-03 Thread Lennart Augustsson
Well, C stdio has this nice thing that if you read from stdin then stdout is automagically flushed first (maybe only if both are ttys). I think Haskell should have that too. -- Lennart On Mar 3, 2007, at 07:10 , Bryan O'Sullivan wrote: Joe Olivas wrote: However, changing

Re: [Haskell-cafe] Implementation of Dynamic datatype

2007-03-03 Thread Lennart Augustsson
Why would there be an extra function? The type data Dynamic = forall a . Dynamic TypeRep a is simply a pair. And so is data Dynamic = forall a . (Typeable a) = Dynamic a I think the latter is the most natural representation for Dynamic. -- Lennart On Mar 2, 2007, at 23:55 , Stefan

Re: [Haskell-cafe] Implementation of Dynamic datatype

2007-03-03 Thread Stefan O'Rear
On Sat, Mar 03, 2007 at 09:18:00AM +, Lennart Augustsson wrote: Why would there be an extra function? The type data Dynamic = forall a . Dynamic TypeRep a is simply a pair. And so is data Dynamic = forall a . (Typeable a) = Dynamic a I think the latter is the most natural

Re: [Haskell-cafe] Proposal: simple interface to libraries Haddock

2007-03-03 Thread David House
On 03/03/07, Claus Reinke [EMAIL PROTECTED] wrote: it doesn't do much more than encode a qualified name into a haddoc-url, but anyway.. Again, the problem with this script is that it requires you know the package name for the function you're looking up. I see this as an over-burdenous

Re: [Haskell-cafe] Literate haskell format unclear (implementation and specification inconsistencies)

2007-03-03 Thread Ross Paterson
On Fri, Mar 02, 2007 at 01:46:38AM +, Ian Lynagh wrote: On Wed, Feb 28, 2007 at 05:48:09PM -0500, Isaac Dupree wrote: Trying to implement literate haskell[*], I realized several ways in which the correct behavior for unliterating (especially with regard to errors) was unclear. I have

Re: [Haskell-cafe] Implementation of Dynamic datatype

2007-03-03 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Stefan O'Rear wrote: On Sat, Mar 03, 2007 at 09:18:00AM +, Lennart Augustsson wrote: Why would there be an extra function? Because the compiler can't statically prove that the typeRep field of the dictionary doesn't depend on its argument.

Re: [Haskell-cafe] Literate haskell format unclear (implementation and specification inconsistencies)

2007-03-03 Thread Douglas Philips
On 2007 Mar 3, at 7:43 AM, Ross Paterson indited: but oddly doesn't seem to have been clarified in the report. We should definitely make sure that Haskell' does so! Or perhaps we should get rid of \begin{code} and \end{code}, before someone proposes code and /code. UGH. Since the text

[Haskell-cafe] MPTCs and rigid variables

2007-03-03 Thread David House
class Foo a b | a - b instance Foo Int String bar :: Foo Int b = b bar = rargh Is there any reason why that shouldn't work? GHC gives one of its silly b is a rigid variable errors (aside: that's a really confusing error; I'd prefer something like Hugs's Infered type is not general enough). --

[Haskell-cafe] ANN: HSH 1.2.0

2007-03-03 Thread John Goerzen
Hi, I'm pleased to announce HSH 1.2.0. Since version 1.0.0 was announced a few days ago, there have been some improvements: * run is now a function with a polymorphic return type. Depending on the value expected, it can return to you a String representing all output, an exit code, a list

[Haskell-cafe] Re: ANN: HSH 1.0.0

2007-03-03 Thread John Goerzen
On 2007-03-01, David Roundy [EMAIL PROTECTED] wrote: On Thu, Mar 01, 2007 at 01:47:38PM -0600, John Goerzen wrote: The input to this function is never read. Shouldn't this be called echo? Or just let people use the preexisting function const, which does the same thing? catFromS just seems

[Haskell-cafe] An HSH case study

2007-03-03 Thread John Goerzen
Some of you may be interested in my recent blog post[1], where I discuss porting hg-buildpackage[2] from a set of shell scripts to a set of Haskell programs that use HSH. To my surprise, I achieved a 20% *reduction* in source lines of code, while doing the exact same tasks. I guess I have to

[Haskell-cafe] Re: ANN: HSH 1.2.0

2007-03-03 Thread dfeustel
I just tried to make HSH 1.2 but it needs Cabal, which I apparently don't have installed. I also don't have runghc installed (referenced at cabal homepage). Using ghc instead failed as follows: Setup.lhs:2: Failed to load interface for `Distribution.Simple': *** Deleting temp files Deleting:

Re: [Haskell-cafe] ANN: HSH 1.2.0

2007-03-03 Thread David Roundy
On Sat, Mar 03, 2007 at 08:38:57AM -0600, John Goerzen wrote: I'm pleased to announce HSH 1.2.0. Since version 1.0.0 was announced a few days ago, there have been some improvements: How about -||- as an alias for something like `catch` $ \_ - ? Or I'm not sure the best design, in the sense of

Re: [Haskell-cafe] MPTCs and rigid variables

2007-03-03 Thread David House
On 03/03/07, Bryan Burgers [EMAIL PROTECTED] wrote: As far as I know, you should be defining the type of bar in the class declaration for Foo, not in an instance declaration. I think I over-reduced my problem. Here's a more complex issue that can't be resolved by moving bar to be a method of

Re: [Haskell-cafe] ANN: HSH 1.2.0

2007-03-03 Thread Paul Moore
On 03/03/07, John Goerzen [EMAIL PROTECTED] wrote: I'm pleased to announce HSH 1.2.0. Since version 1.0.0 was announced a few days ago, there have been some improvements: I've had a little look, and it looks nice. However, as a mainly Windows user, I'd be interested to know - does it work on

Re: [Haskell-cafe] Literate haskell format unclear (implementation and specification inconsistencies)

2007-03-03 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Isaac Dupree wrote: we don't have standards-quality wording yet Okay, here's a first attempt at formalizing it. It's really messy yet, and doesn't incorporate narrative material from the Haskell 98 literate comments section yet. Feedback so far?

[Haskell-cafe] instance Eq Exception??

2007-03-03 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 It seems the Exception datatype is currently an instance of Eq, that does not even satisfy reflexivity (for Dynamic exceptions). Does anybody use this? What is it good for? Why is it there? What if we delete the instance because it doesn't make sense?

Re: [Haskell-cafe] Re: ANN: HSH 1.2.0

2007-03-03 Thread Duncan Coutts
On Sat, 2007-03-03 at 15:19 +, [EMAIL PROTECTED] wrote: I just tried to make HSH 1.2 but it needs Cabal, which I apparently don't have installed. I also don't have runghc installed (referenced at cabal homepage). Using ghc instead failed as follows: Setup.lhs:2: Failed to load

Doc.vim - Haddocks from Vim (Re: [Haskell-cafe] Proposal: simple interface to libraries Haddock)

2007-03-03 Thread Claus Reinke
Again, the problem with this script is that it requires you know the package name for the function you're looking up. I see this as an over-burdenous requirement on the user. okay. sometimes i know/guess the module i'm looking for, but not the item. sometimes i recall the item i'm looking for,

[Haskell-cafe] RE: MPTCs and rigid variables

2007-03-03 Thread C Rodrigues
{-# OPTIONS_GHC -fglasgow-exts #-} class Foo a b | a - b where foo :: Foo b c = a - Maybe c instance Foo String () where foo _ = Nothing instance Foo Int String where foo 4 = Just (); foo _ = Nothing There appears to be a type-safe way to use unsafeCoerce# for this: import

Re: [Haskell-cafe] Literate haskell format unclear (implementation and specification inconsistencies)

2007-03-03 Thread Ian Lynagh
On Sat, Mar 03, 2007 at 12:18:44PM -0500, Isaac Dupree wrote: Here are some (String - Bool) to test lines during parsing. I haven't looked at your definitions in detail, but I think they might be easier to follow (and, ultimately, include in the report) if they were written in a BNF style like

Re: [Haskell-cafe] Re: Code and Perf. Data for PrimeFinders(was:Genuine Eratosthenes sieve)

2007-03-03 Thread Thorkil Naur
Hello all felllow primefinders, I have followed this discussion of Haskell programs to generate small primes with the greatest interest. The thing is, I have been running my Haskell implementation of the so-called Elliptic Curve Method (ECM) of factoring for a number of years. And that method

Re: [Haskell-cafe] RE: MPTCs and rigid variables

2007-03-03 Thread David House
On 03/03/07, C Rodrigues [EMAIL PROTECTED] wrote: class Foo a b | a - b where foo :: a - FooBox b data FooBox b = forall c. Foo b c = FooBox (Maybe c) Existential boxes is indeed the method I've used to tackle this in practice. However, it's kind of annoying, hence my email asking whether

Re[2]: [Haskell-cafe] ANN: HSH 1.2.0

2007-03-03 Thread Bulat Ziganshin
Hello Paul, Saturday, March 3, 2007, 8:06:16 PM, you wrote: I've had a little look, and it looks nice. However, as a mainly Windows user, I'd be interested to know - does it work on Windows (alternatively, is portability to Windows a goal)? It might be worth mentioning up front, if it's

Re: [Haskell-cafe] Implementation of Dynamic datatype

2007-03-03 Thread Lennart Augustsson
I have no idea what function you are talking about. I must be missing your point. Here's a version of Dynamic that seem to compile and work fine. {-# OPTIONS_GHC -fglasgow-exts #-} module Dyn(Dynamic, toDyn, fromDyn) where import GHC.Base(unsafeCoerce#) import Data.Typeable data Dynamic =

[Haskell-cafe] is there already a function that does this?

2007-03-03 Thread Jared Jennings
-- Sort the [a]'s by the [b]'s. sortByKeys :: (Ord b) = [b] - [a] - [a] sortByKeys keys values = map snd $ sortBy compareFst (zip keys values) where compareFst x y = compare (fst x) (fst y) -- Sort a list by an IO-returning compare function. sortByM :: (Monad m, Ord b) = (a - m b) - [a] - m

Re: [Haskell-cafe] is there already a function that does this?

2007-03-03 Thread Lennart Augustsson
Those both look roughly like what I would do. -- Lennart On Mar 3, 2007, at 21:35 , Jared Jennings wrote: -- Sort the [a]'s by the [b]'s. sortByKeys :: (Ord b) = [b] - [a] - [a] sortByKeys keys values = map snd $ sortBy compareFst (zip keys values) where compareFst x y = compare

Re: [Haskell-cafe] ANN: HSH 1.2.0

2007-03-03 Thread John Goerzen
On Sat, Mar 03, 2007 at 05:06:16PM +, Paul Moore wrote: On 03/03/07, John Goerzen [EMAIL PROTECTED] wrote: I'm pleased to announce HSH 1.2.0. Since version 1.0.0 was announced a few days ago, there have been some improvements: I've had a little look, and it looks nice. However, as a

Re: [Haskell-cafe] ANN: HSH 1.2.0

2007-03-03 Thread John Goerzen
On Sat, Mar 03, 2007 at 11:58:42PM +0300, Bulat Ziganshin wrote: path-handling functions are not windows aware, at least i always thought that Haskell (probably, hugs) is a great shell scripting tool but it lacks filename/file processing libraries. with help of Filepath library by Neil and

Re: [Haskell-cafe] is there already a function that does this?

2007-03-03 Thread Henk-Jan van Tuyl
On Sat, 03 Mar 2007 22:35:00 +0100, Jared Jennings [EMAIL PROTECTED] wrote: -- Sort the [a]'s by the [b]'s. sortByKeys :: (Ord b) = [b] - [a] - [a] sortByKeys keys values = map snd $ sortBy compareFst (zip keys values) where compareFst x y = compare (fst x) (fst y) You can simplify that

[Haskell-cafe] Lambdabot on Windows?

2007-03-03 Thread Iain Alexander
Does anyone know of a standalone version of lambdabot which will run on Windows? (When I try to configure lambdabot-4.0, I get Setup.hs: cannot satisfy dependency unix-any.) -- Iain Alexander [EMAIL PROTECTED] ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] ANN: HSH 1.2.0

2007-03-03 Thread Neil Mitchell
Hi FilePath is indeed quite nice. You might also want to look at System.Path and its submodules in MissingH (API docs at [1]). I've got some stuff that FilePath doesn't, namely making paths absolute, wildcard matching/globbing, and also a function that converts a POSIX wildcard into a regexp.

Re: [Haskell-cafe] is there already a function that does this?

2007-03-03 Thread Matthew Brecknell
Jared Jennings: -- Sort the [a]'s by the [b]'s. sortByKeys :: (Ord b) = [b] - [a] - [a] sortByKeys keys values = map snd $ sortBy compareFst (zip keys values) where compareFst x y = compare (fst x) (fst y) Henk-Jan van Tuyl: You can simplify that to: sortByKeys :: (Ord b) = [b] -

Re: [Haskell-cafe] ANN: HSH 1.2.0

2007-03-03 Thread John Goerzen
On Sat, Mar 03, 2007 at 10:19:38PM +, Neil Mitchell wrote: I've got some stuff that FilePath doesn't, namely making paths absolute, wildcard matching/globbing, and also a function that converts a POSIX wildcard into a regexp. FilePath did have a function that made paths absolute, but it

Re: [Haskell-cafe] ANN: HSH 1.2.0

2007-03-03 Thread Neil Mitchell
Hi There are a couple of things about that function... First, I did see it, but its description is rather vague on what it does. From the description, it sounds like it is possible that it would not return an absolute path; I read it more as expanding symlinks. If it does indeed return an

[Haskell-cafe] Non-exported type classes?

2007-03-03 Thread Roberto Zunino
What is the effect of declaring a class in a module and not exporting it? Would that prevent to add more instances to that class other than those already defined in the module? More in detail, consider this module: === module Peano (Z,S,C) where data Z data S a -- Not exported class Peano b

Re: [Haskell-cafe] Non-exported type classes?

2007-03-03 Thread Stefan O'Rear
On Sun, Mar 04, 2007 at 01:03:45AM +0100, Roberto Zunino wrote: What is the effect of declaring a class in a module and not exporting it? Would that prevent to add more instances to that class other than those already defined in the module? More in detail, consider this module: === module

Re: [Haskell-cafe] Non-exported type classes?

2007-03-03 Thread Lennart Augustsson
Yes, as far as I can tell, C would be limited to Z and S. Nice trick! -- Lennart On Mar 4, 2007, at 00:03 , Roberto Zunino wrote: What is the effect of declaring a class in a module and not exporting it? Would that prevent to add more instances to that class other than those already

Re: [Haskell-cafe] Lambdabot on Windows?

2007-03-03 Thread Tim Newsham
Does anyone know of a standalone version of lambdabot which will run on Windows? (When I try to configure lambdabot-4.0, I get Setup.hs: cannot satisfy dependency unix-any.) The darcs repo version of lambdabot does run on windows. you'll need to remove the unix dependency from the .cabal file.

Re: [Haskell-cafe] Lambdabot on Windows?

2007-03-03 Thread Neil Mitchell
Hi The darcs repo version of lambdabot does run on windows. you'll need to remove the unix dependency from the .cabal file. At least 2 people have had it working. Anyone have some binaries they want to share? I keep some binaries at http://www-users.cs.york.ac.uk/~ndm/projects/windows.php