Re: [Haskell-cafe] Dynamic thread management?

2007-08-22 Thread Brandon Michael Moore
On Wed, Aug 22, 2007 at 04:07:22AM +0100, Hugh Perkins wrote: > On 8/21/07, Andrew Coppin <[EMAIL PROTECTED]> wrote: > > I highly doubt that automatic threading will happen any time this decade > > - but I just learned something worth while from reading this email. ;-) > > That's an interesting ob

Re: [Haskell-cafe] Syntax for lambda case proposal could be "\of"

2007-08-15 Thread Brandon Michael Moore
On Wed, Aug 15, 2007 at 11:06:36AM -0700, Stefan O'Rear wrote: > On Wed, Aug 15, 2007 at 06:58:40PM +0100, Duncan Coutts wrote: > > On Wed, 2007-08-15 at 10:50 -0700, Stefan O'Rear wrote: > > > > > OTOH, your proposal provides (IMO) much more natural syntax for > > > multi-pattern anonymous functi

Re: [Haskell-cafe] Re: towards a new foundation for set theory with atoms

2007-08-11 Thread Brandon Michael Moore
On Fri, Aug 10, 2007 at 03:54:23PM -0700, Greg Meredith wrote: > Haskellians, > > A quick follow up. If you look at the code that i have written there is a > great deal of repeated structure. Each of these different kinds of sets and > atoms are isomorphic copies of each other. Because, however, o

Re: [Haskell-cafe] a regressive view of support for imperative programming in Haskell

2007-08-09 Thread Brandon Michael Moore
On Thu, Aug 09, 2007 at 11:52:17AM -0700, David Roundy wrote: > On Thu, Aug 09, 2007 at 02:08:20PM +0100, Jules Bean wrote: *snip* > > A third example is with nested dos: > > > > do x <- bar y > >baz > >something $ do foo x > > > > is not the same as > > > > do baz > >something $

Re: [Haskell-cafe] Re: monad subexpressions

2007-08-03 Thread Brandon Michael Moore
> Also, note, if you use the operators in Control.Applicative, then: > > return $ foo $(bar1) $(bar2) $(bar3) ... > > can be: > > return foo <*> bar1 <*> bar2 <*> bar3 ... > > or: > > foo <$> bar1 <*> bar2 <*> bar3 > > I don't (personally) see how that's any more cryptic than placing

Re: Re : [Haskell-cafe] Indentation woes

2007-07-27 Thread Brandon Michael Moore
On Thu, Jul 26, 2007 at 05:34:32PM -0400, anon wrote: > 2007/7/26, Stefan O'Rear <[EMAIL PROTECTED]>: > >As for "why", it's just a matter of Haskell Committee taste. Nothing > >too deep, just an arbitrary set of rules. > That's not much of an explanation, is it? I imagine someone must have > given

Re: [Haskell-cafe] Minim interpreter

2007-07-20 Thread Brandon Michael Moore
On Fri, Jul 20, 2007 at 10:10:58PM +0200, Hugh Perkins wrote: > Newbie question: why does the following give "Not in scope 'c'" for the last > line? I assume you meant > string :: Parsec.Parser String > string = do c <- Parsec.letter > do cs <- string >return c:cs >

Re: [Haskell-cafe] problem with IO, strictness, and "let"

2007-07-13 Thread Brandon Michael Moore
On Thu, Jul 12, 2007 at 09:22:09PM -0700, Michael Vanier wrote: > I stumbled across a problem with IO and strictness that I could fix, but I > can't understand why the fix works. I've compressed it down into a program > which simply computes the number of lines in a file. Here is a version > t

[Haskell-cafe] Parsing and Coding

2007-07-07 Thread Brandon Michael Moore
On Sat, Jul 07, 2007 at 06:49:25PM +0100, Andrew Coppin wrote: > Dave Bayer wrote: > >I was beginning to accept that I might die before clearing my pipeline > >of research projects I want to code up. > > ...so it's *not* just me! > > >Haskell has given me new hope. > > Indeed. ;-) > > > Today

Re: [Haskell-cafe] Re: Class Interfaces in OOHaskell?

2007-07-06 Thread Brandon Michael Moore
On Fri, Jul 06, 2007 at 06:11:42PM -0400, Scott West wrote: > I conquered the below problem, but now I have another question: > > How can one have two interface-classes that reference each other? For > example, > > type Inter1 = Record ( > MkFoo :=: Inter2 -> IO () > :*: HNil ) > > type Inter

Re: [Haskell-cafe] Best idiom for avoiding Defaulting warnings with ghc -Wall -Werror ??

2007-06-25 Thread Brandon Michael Moore
On Mon, Jun 25, 2007 at 08:53:18AM -0700, Dave Bayer wrote: > It continues to appear to me that "ghc -Wall -Werror" doesn't support > small Int constants without a per-use penalty, measured in code length. Why not use "ghc -Wall -Werror -fno-warn-defaulting", maybe with default(Int)? It removes

Re: [Haskell-cafe] Re: Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread Brandon Michael Moore
On Thu, Jun 21, 2007 at 04:37:20PM +0200, Tom Schrijvers wrote: > That wouldn't make a difference. If, from the pure Haskell point of view > we can't tell the difference between two expressions that denote the same > function, then operations in the IO monad should not be able to do so > either.

Re: [Haskell-cafe] What puts False before True?

2007-06-06 Thread Brandon Michael Moore
On Wed, Jun 06, 2007 at 02:50:12AM +0100, PR Stanley wrote: > > >PR Stanley wrote: > >>What do the ??? symbols represent? > > > >I see you are still stuck in ISO-8859-1 and > >deprived of international characters and > >symbols. (And this reply in ISO-8859-1 too > >accordingly; normally I use U

Re: [Haskell-cafe] What puts False before True?

2007-05-31 Thread Brandon Michael Moore
On Thu, May 31, 2007 at 10:03:05AM +0100, PR Stanley wrote: > > >> What is the basic philosophy for Bool being a member of Ord? I hear two questions, why is Bool a member of Ord at all, and why was it ordered with False before True. If I'm reading the reports correctly, the Ord instance was actu

Re: [Haskell-cafe] Monads and constraint satisfaction problems (CSP)

2007-05-31 Thread Brandon Michael Moore
On Thu, May 31, 2007 at 10:42:57AM -0700, Greg Meredith wrote: > All, > > All this talk about Mathematica and a reference to monadic treatments of > backtracking reminded me that a year ago i was involved in work on a > Mathematica-like widget. At the time i noticed that a good deal of the > struc

Re: [Haskell-cafe] where do I point the type annotations

2007-05-18 Thread Brandon Michael Moore
On Fri, May 18, 2007 at 02:39:48AM -0400, Alex Jacobson wrote: > I am playing with using SYB to make generic indexed collections. The > current code is this: > >data Syb = Syb [Dynamic] -- list of [Map val (Set a)] > >empty item = Syb $ gmapQ (toDyn . emp item) item >where >

Re: [Haskell-cafe] Indenting with PPrint

2007-05-08 Thread Brandon Michael Moore
On Tue, May 08, 2007 at 07:39:15AM +0100, Joel Reymont wrote: > > >If you happen to be formatting C I've also worked out how to get > >nice argument > >lists out of both pretty printers. > > I'm formatting C# but I'll certainly take your arg list tips. These narrow like foo (a, b) foo (a,

Re: [Haskell-cafe] QuickCheck invariants for AST transformations

2007-05-08 Thread Brandon Michael Moore
On Tue, May 08, 2007 at 10:06:32AM +0100, Joel Reymont wrote: > I'm looking for suggestions on how to create invariants for the > following AST transformation code. Any suggestions are appreciated! > > I asked this question before and Lennart suggested abstract > interpretation as a solution.

Re: [Haskell-cafe] Indenting with PPrint

2007-05-07 Thread Brandon Michael Moore
On Mon, May 07, 2007 at 10:38:19PM +0100, Joel Reymont wrote: > Folks, > > Are you using UU.PPrint [1]? Can you tell me how to print stuff like > this? > > { > blah > blah > } > > I tried the following which sort of works but doesn't return the > closing brace to the indentation le

Re: [Haskell-cafe] First order Haskell without Data

2007-04-18 Thread Brandon Michael Moore
On Thu, Apr 19, 2007 at 02:47:30AM +0100, Neil Mitchell wrote: > Hi, > > I've been wondering what is essential to Haskell and what isn't. Not > from a point of view of what could be removed from the language, but > what could be removed from a Core language. > > Given the features of higher-order

Re: [Haskell-cafe] Re: Release plans

2007-04-18 Thread Brandon Michael Moore
On Tue, Apr 17, 2007 at 11:39:03PM -0700, Brandon Michael Moore wrote: > On Tue, Apr 17, 2007 at 12:50:48PM +0200, Doaitse Swierstra wrote: > > Just to show what kind of problems we are currently facing. The > > following type checks in our EHC compiler and in Hugs, but not i

[Haskell-cafe] Re: Release plans

2007-04-17 Thread Brandon Michael Moore
On Tue, Apr 17, 2007 at 12:50:48PM +0200, Doaitse Swierstra wrote: > Just to show what kind of problems we are currently facing. The > following type checks in our EHC compiler and in Hugs, but not in the > GHC: > > module Test where > > data T s = forall x. T (s -> (x -> s) -> (x, s, Int)) >

Re: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-11 Thread Brandon Michael Moore
On Wed, Apr 11, 2007 at 02:21:41PM +0100, Will Newton wrote: > On 4/11/07, kynn <[EMAIL PROTECTED]> wrote: > > > >Perl is a large, ugly, messy language filled with quirks and > >eccentricities, > >while Haskell is an extremely elegant language whose design is guided by a > >few overriding ideas.

Re: [Haskell-cafe] Weaving fun

2007-04-10 Thread Brandon Michael Moore
On Wed, Apr 11, 2007 at 12:13:10AM +0200, Bas van Dijk wrote: > Hello, > > For my own exercise I'm writing a function 'weave' that "weaves" a > list of lists together. For example: > > weave [[1,1,1], [2,2,2], [3,3]] ==> [1,2,3,1,2,3,1,2] > weave [[1,1,1], [2,2], [3,3,3]] ==> [1,2,3,1,2,3,1] >

Re: [Haskell-cafe] Profiling makes memory leak go away? Is Haskell a practical language?

2007-04-10 Thread Brandon Michael Moore
On Tue, Apr 10, 2007 at 11:03:32AM -0700, Oren Ben-Kiki wrote: > On Tue, 2007-04-10 at 12:14 +0200, apfelmus wrote: > >Oren Ben-Kiki wrote: > >> The code is in http://hpaste.org/1314#a1 if anyone at all is willing > >> to take pity on me and explain what I'm doing wrong. > > > >There is an importan

Re: [Haskell-cafe] [Beginner's Question] How to read filenames from a DirStream

2007-04-09 Thread Brandon Michael Moore
It looks like all you can do with DirStream is get the filename, not look at any other fields of the dirent - actually, it seems name is the only standard field. You might as well use getDirectoryContents, unless you have a directory so huge that a list of all the filenames takes too much memory!

Re: [Haskell-cafe] Lazy IO and closing of file handles

2007-03-14 Thread Brandon Michael Moore
On Wed, Mar 14, 2007 at 06:05:31PM -0700, David Brown wrote: > Greg Fitzgerald wrote: > > > What we need is a library for a readonly filesystem. That is, all > > the same functions but pure. I believe you could make this readonly > > library by wrapping each readonly I/O function with > > 'unsaf

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

2007-03-13 Thread Brandon Michael Moore
On Mon, Mar 12, 2007 at 05:14:57PM -0500, John Goerzen wrote: > On 2007-03-06, Simon Marlow <[EMAIL PROTECTED]> wrote: > > John Goerzen wrote: > >> possible to create a pipe going directly from program A to program B. > > > > You certainly can pipe directly from one process to another: > > That on

Re: [Haskell-cafe] How to implement `amb' operator?

2004-04-07 Thread Brandon Michael Moore
Keith is talking about a "comitted choice" style of nondeterminism, where one of the arguments is picked and the computation continues from there. If you want a computation with backtracking, or a list of all possibly results then you should use the list monad, or another monad that supports nonde

Re: [Haskell-cafe] matching constructors

2004-03-05 Thread Brandon Michael Moore
On Fri, 5 Mar 2004, Vadim Zaliva wrote: > Hi! > > I am new to Haskell, but I have background in various programming > languages (including Lisp) > > I have very basic question, if there is a way to match algebraic types > constructors besides > use of pattern matching. I wrote today code like th

Re: Multiple functions applied to a single value

2003-12-09 Thread Brandon Michael Moore
Control.Monad.Reader defines instances of Monad and MonadReader for ((->) r). Strangely enough, the documentation claims the Monad instance comes from Control.Monad, which is untrue. Here's the relevant chunk of the file. It looks like you came up with exactly the same code (modulo names). -- -

Functional Code Generation

2003-11-19 Thread Brandon Michael Moore
I think I remeber seeing a paper about techniques for writing code generators in Haskell targeting stack based bytecodes that encoded bytecode sequences in a way that the typechecker could give you some sanity guarantees, and then talked a bit about using dynamic programming for optimizing bytecode

RE: automaticly create the ana, cata, hylomorphisms

2003-11-08 Thread Brandon Michael Moore
On Fri, 7 Nov 2003, Marta Isabel Oliveira wrote: > Ok, i read the page but i'm still stuck. > > I'm reading some papers about cata, ana and hylomorphisms but i need to know where > to start putting it to code. > > So, > > 1. in order to have a pre-processor, i need to have a module with ALL da

Re: determining if a int is a power

2003-11-08 Thread Brandon Michael Moore
Are you looking for numbers that are squares, or any power (probably any power at least two)? If it's the latter you need something more interesting that sqrt. An alternative to squaring the number agagin is to use properFraction. Brandon On Fri, 7 Nov 2003, Hamilton Richards wrote: > Also not

RE: Type tree traversals [Re: Modeling multiple inheritance]

2003-11-06 Thread Brandon Michael Moore
On Wed, 5 Nov 2003, Simon Peyton-Jones wrote: > | More overlapping: > | Allow any overlapping rules, and apply the most specific rule that > | matches our target. Only complain if there is a pair of matching > | rules neither of which is more specific than the other. > | This follow the spirit o

RE: Type tree traversals [Re: Modeling multiple inheritance]

2003-11-04 Thread Brandon Michael Moore
On Tue, 4 Nov 2003, Simon Peyton-Jones wrote: > > | We really should change GHC rather than keep trying to work around > stuff > | like this. GHC will be my light reading for winter break. > > Maybe so. For the benefit of those of us who have not followed the > details of your work, could you sum

Re: Type tree traversals [Re: Modeling multiple inheritance]

2003-11-03 Thread Brandon Michael Moore
Thanks for the clever code Oleg. I've tried to extend it again to track the types of methods as well as just the names, giving a functional dependancy from the class, method, and to result type. I can't get the overlapping instances to work out, so I'm handing it back to a master, and the rest of t

Re: Type Class Magic [Re: Type tree traversals]

2003-10-22 Thread Brandon Michael Moore
One part of the solution that I didn't like is that the constraint on a method had to explicitly list all the classes that declared that method. That hampers generating the binding a class at a time, so I fixed it. I still don't match the type of the method against the types declared, but that sho

Re: Type tree traversals [Re: Modeling multiple inheritance]

2003-10-22 Thread Brandon Michael Moore
This seems to work. The type checker picks one rule to use at each point so you can't get backtracking, but you explicitly build the sequence of base classes, and use the overloading resolution to stop if we find our goal. This is clever. It looks like prolog could be interesting. My first introdu

Re: "listProduct" -- is this a standard function?

2003-10-17 Thread Brandon Michael Moore
Somehow I managed to overlook about five replies. Sorry. I'll try to say something more useful than "sequence" here, my advice for finding functions. > > I observe this seems to be a recurring problem for me... there are so many > very generic and useful data handling functions in Haskell, it's d

Re: "listProduct" -- is this a standard function?

2003-10-17 Thread Brandon Michael Moore
I'm pretty sure this is sequence. Brandon ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Using field selectors in a type constructor

2003-10-14 Thread Brandon Michael Moore
On Mon, 13 Oct 2003, Graham Klyne wrote: > I've run across a minor coding niggle on a couple opf accosions when using > a type constructor with field selectors. The full code of my test case is > below. The value 'test2' evaluates to True. > > The function that niggles me is this: > > [[ > joinV

Re: constructor name clashes

2003-10-08 Thread Brandon Michael Moore
On Wed, 8 Oct 2003 [EMAIL PROTECTED] wrote: > Hi, all. > > I'm a newbie to Haskell so please bear with me if my questions sound silly. > > In coding Haskell, I feel very inconvenient that the name of data > constructors for different types have to be different. > > Also, when declaring named fiel

Re: Modeling multiple inheritance

2003-09-27 Thread Brandon Michael Moore
On Fri, 26 Sep 2003 [EMAIL PROTECTED] wrote: > > Brandon Michael Moore wrote regarding the first solution: chain of > super-classes: > > > I'm worried about large class hierarchies. If it works on the > > java.* classes I should be fine. Have you used this approach

Re: Modeling multiple inheritance

2003-09-26 Thread Brandon Michael Moore
On Thu, 25 Sep 2003 [EMAIL PROTECTED] wrote: > > Brandon Michael Moore wrote: > > > So I defined a class to model the inheritance relationships > > > class SubType super sub | sub -> super where > > upCast :: sub -> super > > > Now I can define a d

Re: lexer puzzle

2003-09-25 Thread Brandon Michael Moore
Note I've replied to haskell-cafe. This post is a bit chatty and low on solid answers. On Thu, 25 Sep 2003, Sean L. Palmer wrote: > > >>A... should be split into "A.." and "." > > >I found a compromise: let's make it a lexing error! :-) > > At least that agrees with what some Haskell compilers im

Re: Modeling multiple inheritance

2003-09-24 Thread Brandon Michael Moore
On Thu, 25 Sep 2003 [EMAIL PROTECTED] wrote: > On 25/09/2003, at 7:22 AM, Brandon Michael Moore wrote: > > > I'm trying to build a nicer interface over the one generated by > > jvm-bridge. I'm using fancy type classes to remove the need to mangle > > method

Modeling multiple inheritance

2003-09-24 Thread Brandon Michael Moore
I'm trying to build a nicer interface over the one generated by jvm-bridge. I'm using fancy type classes to remove the need to mangle method names. I would like methods to be automatcially inherited, following an inheritance hierarcy defined with another set of type classes. My basic classes look

Re: How to detect finite/infinite lists?

2003-09-18 Thread Brandon Michael Moore
On Thu, 18 Sep 2003, Juanma Barranquero wrote: > Extremely-newbie questions: > > Is there any way to know if a list is finite or infinite, other than > doing: > > length l > > and waiting forever? :) > > I ask because I was learning Haskell by writing some pretty naive > implementation of surrea

Re: An IO Question from a Newbie

2003-09-14 Thread Brandon Michael Moore
On Sun, 14 Sep 2003, Glynn Clements wrote: > > Brandon Michael Moore wrote: > > > Hal was pretty terse, so I'll explain why switching to putStrLn will help. > > > > stdout is line buffered. > > > > At least by default (see hSetBuffering). That means o

Re: An IO Question from a Newbie

2003-09-14 Thread Brandon Michael Moore
Hal was pretty terse, so I'll explain why switching to putStrLn will help. stdout is line buffered. At least by default (see hSetBuffering). That means output will only be flushed to the screen once a newline is written. Your prompt wasn't printed because it didn't have a newline, so it was buffe

Re: Debugging

2003-08-28 Thread Brandon Michael Moore
On Tue, 26 Aug 2003, Konrad Hinsen wrote: > My Haskell experiments have reached a size in which debugging tools would be > more than welcome, so I looked around, and was very disappointed. I tried > Hood, which is a pain to use (lots of editing of the code required), I looked > at Buddha but didn'

Re: More type design questions

2003-08-18 Thread Brandon Michael Moore
I think what you want are functional dependencies. On Mon, 18 Aug 2003, Konrad Hinsen wrote: > On Monday 18 August 2003 09:25, Bernard James POPE wrote: > > > The kinds are there to help the compiler check whether types are well > > formed (including such things as instance declarations). > > > >

Re: IO Bool -> Bool

2003-08-14 Thread Brandon Michael Moore
On Thu, 14 Aug 2003, Wolfgang Jeltsch wrote: > On Thursday, 2003-08-14, 17:05, CEST, Kevin S. Millikin wrote: > > On Wednesday, August 13, 2003 11:20 PM, Tn X-10n > > [SMTP:[EMAIL PROTECTED] wrote: > > > is it possible to convert IO Bool to Bool? > > > > Sure. Which Bool do you want? True? >

Re: Newbie Design Question

2003-08-06 Thread Brandon Michael Moore
On Tue, 5 Aug 2003, Thomas L. Bevan wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > I don't see that the contibutors files are fundementally different. > - From what I understand, it should be possible to write a > generic function, > > importCSV :: FilePath -> IO [ (String,Stri

Lazy Parsing

2002-02-27 Thread Brandon Michael Moore
I'm wondering if there are any libraries out there for creating parsers that lazily build up their result. I know I could thread the remaining input through a parser by hand, but it seems like someone should have already done it. I'd like to be able to turn a stream of XML into a lazy tree of tag