Re: [Haskell-cafe] Monad for binary tree data structure

2011-07-22 Thread Ivan Lazar Miljenovic
2011/7/23 Александр : > Hello, > > I built binary tree with: > > data Tree a = Empty >               | Node a (Tree a) (Tree a) >               deriving (Eq, Ord, Read, Show) > How can i make Monad type class instance for this tree? And can i make it on > not? > > i try: > > instance Monad Tree whe

[Haskell-cafe] ANNOUNCE: dbus-core 0.9

2011-07-22 Thread John Millikin
D-Bus implementation for Haskell (dbus-core_0.9) This is the first significant release to dbus-core in a while, and it contains some significant improvements to both the API and implementation. Users

[Haskell-cafe] Monad for binary tree data structure

2011-07-22 Thread Александр
Hello, I built binary tree with: data Tree a = Empty                | Node a (Tree a) (Tree a)               deriving (Eq, Ord, Read, Show) How can i make Monad type class instance for this tree? And can i make it on not? i try: instance Monad Tree where     return x = Node x Empty Empty 

Re: [Haskell-cafe] file splitter with enumerator package

2011-07-22 Thread Eric Rasmussen
Hi Felipe, Thank you for the very detailed explanation and help. Regarding the first point, for this particular use case it's fine if the user-specified file size is extended by the length of a partial line (it's a compact csv file so if the user breaks a big file into 100mb chunks, each chunk wou

Re: [Haskell-cafe] file splitter with enumerator package

2011-07-22 Thread Felipe Almeida Lessa
There is one problem with your algorithm. If the user asks for 4 GiB, then the program will create files with *at least* 4 GiB. So the user would need to ask for less, maybe 3.9 GiB. Even so there's some danger, because there could be a 0.11 GiB line on the file. Now, the biggest problem your c

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Dan Doel
On Fri, Jul 22, 2011 at 4:11 PM, Serguey Zefirov wrote: > But "cpu" variable is the same in all places. If we don't dive into > CPUFunc reduction (to Int or whatever) we can safely match funcVars > argument and unify cpu. > > This is the case when we write generic functions over type family applic

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Serguey Zefirov
2011/7/22 Felipe Almeida Lessa : > On Fri, Jul 22, 2011 at 12:12 PM, Serguey Zefirov wrote: >> Why does GHC complains on the code below ? (I'll explain in a second a >> requirement to do just so) > > I don't why =(.  But you can workaround by using > >  class CPU cpu where >    data CPUFunc cpu >

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Serguey Zefirov
2011/7/22 Dan Doel : > On Fri, Jul 22, 2011 at 11:12 AM, Serguey Zefirov wrote: > GHC cannot decide what instance of FuncVars to use. The signature of > funcVars is: >    funcVars :: FuncVars cpu => CPUFunc cpu -> [String] > > This does not take any arguments that allow cpu to be determined. For >

Re: [Haskell-cafe] Reactive Programming in Machine Learning

2011-07-22 Thread bob zhang
Thank your for kind help :-) 于 11-7-22 下午3:28, Edward Amsden 写道: I did a survey of functional reactive programming, though there's no reference to machine learning: http://blog.edwardamsden.com/2011/05/survey-of-functional-reactive.html On Fri, Jul 22, 2011 at 2:30 PM, bob zhang wrote: Hi all

[Haskell-cafe] Wrong Answer in SPOJ 6044. Minimum Diameter Circle

2011-07-22 Thread mukesh tiwari
Hello all This is my first post to Haskell-cafe so i am not aware of protocols here and pardon me for my stupidity . I am trying to solve this problem [ https://www.spoj.pl/problems/QCJ4 ] but getting wrong answer . I implemented the algorithm by Pr. Chrystal described here [ http://www.personal.

Re: [Haskell-cafe] Reactive Programming in Machine Learning

2011-07-22 Thread Edward Amsden
I did a survey of functional reactive programming, though there's no reference to machine learning: http://blog.edwardamsden.com/2011/05/survey-of-functional-reactive.html On Fri, Jul 22, 2011 at 2:30 PM, bob zhang wrote: > Hi all, > I am doing a survey on combining Functional Reactive Programmi

[Haskell-cafe] file splitter with enumerator package

2011-07-22 Thread Eric Rasmussen
Hi everyone, A friend of mine recently asked if I knew of a utility to split a large file (4gb in his case) into arbitrarily-sized files on Windows. Although there are a number of file-splitting utilities, the catch was it couldn't break in the middle of a line. When the standard "why don't you us

[Haskell-cafe] Reactive Programming in Machine Learning

2011-07-22 Thread bob zhang
Hi all, I am doing a survey on combining Functional Reactive Programming and Machine Learning. Has anyone did relevant research on this topic? Any discussion or link is appreciable. Best,bob ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://w

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread aditya siram
I just had a problem closely related to this on StackOverflow [1] which was explained beautifully by cammcann. The problem is that because "type CPUFunc cpu" is located inside the definition of the class "CPU" it creates the illusion that they are somehow tied together where "CPUFunc" is somehow i

[Haskell-cafe] Haskell Parallel Digest 4

2011-07-22 Thread Nicolas Wu
Parallel Haskell Digest === Edition 4 2011-07-22 http://www.well-typed.com/blog/55 Hello Haskellers! It's time for the fourth edition of the Parallel Haskell Digest, bringing you a summary of the news and discussions of parallelism and concurrency in Haskell. The digest is ma

Re: [Haskell-cafe] Grammar hacker in Haskell

2011-07-22 Thread Stephen Tetley
On 22 July 2011 16:32, Johannes Waldmann wrote: > Stephen Tetley gmail.com> writes: > >> "Compilers: Principles, Techniques, and Tools" by Aho et al. though >> the presentation in this book is quite formal. > > you make that sound like a bad thing ... Well - not intentionally, and for the cognos

Re: [Haskell-cafe] Grammar hacker in Haskell

2011-07-22 Thread Johannes Waldmann
Stephen Tetley gmail.com> writes: > "Compilers: Principles, Techniques, and Tools" by Aho et al. though > the presentation in this book is quite formal. you make that sound like a bad thing ... even the publisher seems to think so, and came up with a slogan that indeed must be the most counte

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Dan Doel
On Fri, Jul 22, 2011 at 11:12 AM, Serguey Zefirov wrote: > - > {-# LANGUAGE GADTs, TypeFamilies #-} > > class CPU cpu where >        type CPUFunc cpu > > data Expr cpu where >      

Re: [Haskell-cafe] ANNOUNCE: Haskell in the Cloud (http://quid2.org)

2011-07-22 Thread Sean Leather
On Fri, Jul 22, 2011 at 12:00, Pasqualino "Titto" Assini wrote: > Enter Quid2 [1]: the half baked, barely tested, totally > unsafe and spectacularly unoptimised Haskell in the Cloud system. > Challenging... https://plus.google.com/104222093009939197511/posts/MpgUUayq78o Sean _

Re: [Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Felipe Almeida Lessa
On Fri, Jul 22, 2011 at 12:12 PM, Serguey Zefirov wrote: > Why does GHC complains on the code below ? (I'll explain in a second a > requirement to do just so) I don't why =(. But you can workaround by using class CPU cpu where data CPUFunc cpu Note that you don't need the class constrain

[Haskell-cafe] Simple GADTs, type families and type classes combination with type error.

2011-07-22 Thread Serguey Zefirov
Why does GHC complains on the code below ? (I'll explain in a second a requirement to do just so) I get errors with ghc 6.12.1 and 7.0.2. - {-# LANGUAGE GADTs, TypeFamilies #-} cla

Re: [Haskell-cafe] Cloud Haskell

2011-07-22 Thread Tom Murphy
As described in "Towards Haskell in the Cloud": http://research.microsoft.com/en-us/um/people/simonpj/papers/parallel/ Tom On Jul 22, 2011 11:01 AM, "Antoine Latter" wrote: > On Fri, Jul 22, 2011 at 8:25 AM, Tom Murphy wrote: >> Is anyone using Cloud Haskell yet? I'm really excited by the possib

Re: [Haskell-cafe] Cloud Haskell

2011-07-22 Thread Antoine Latter
On Fri, Jul 22, 2011 at 8:25 AM, Tom Murphy wrote: > Is anyone using Cloud Haskell yet? I'm really excited by the possibilities. > Do you have a link to what you mean by "Cloud Haskell"? > Tom > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.

Re: [Haskell-cafe] ANNOUNCE: Haskell in the Cloud (http://quid2.org)

2011-07-22 Thread David Barbour
Any relationship to distributed haskell? http://www.macs.hw.ac.uk/~dsg/gdh/ On Fri, Jul 22, 2011 at 3:00 AM, Pasqualino "Titto" Assini < tittoass...@gmail.com> wrote: > Fellow Haskeller, > > Has your strongly typed, quick checked, formally verified, Oleg blessed, > higher order monadic code bec

Re: [Haskell-cafe] Introspection

2011-07-22 Thread Sharadha Raghunathan
Thanks. Let me try this. I appreciate all the help. And how do I compute a LR parser graph using haskell? Sent from my iPhone On Jul 22, 2011, at 6:41 AM, Felipe Almeida Lessa wrote: > On Fri, Jul 22, 2011 at 10:31 AM, Stephen Tetley > wrote: >> As Haskell is statically typed, if y.length <

Re: [Haskell-cafe] Introspection

2011-07-22 Thread Felipe Almeida Lessa
On Fri, Jul 22, 2011 at 10:31 AM, Stephen Tetley wrote: > As Haskell is statically typed, if y.length < 100, y is still of type Big... You could achieve this kind of thing with smart constructors and GADTs. I don't know how useful it is, though =). data Sized t a where Small :: a -> Sized Sma

Re: [Haskell-cafe] Introspection

2011-07-22 Thread Stephen Tetley
As Haskell is statically typed, if y.length < 100, y is still of type Big... On 22 July 2011 10:18, Patrick Browne wrote: > 2) Assert the type of a variable > e.g. if y.length > 100 then y is of type big. ___ Haskell-Cafe mailing list Haskell-Cafe@has

Re: [Haskell-cafe] Grammar hacker in Haskell

2011-07-22 Thread Stephen Tetley
The algorithms are "common practice" and a web search should provide lecture notes detailing them - you will likely have to translate to Haskell yourself. If you have a university affiliation, I'd go to the library and check books on compiler construction. The classic is the "Dragon Book" - "Compi

[Haskell-cafe] Cloud Haskell

2011-07-22 Thread Tom Murphy
Is anyone using Cloud Haskell yet? I'm really excited by the possibilities. Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Introspection

2011-07-22 Thread Sharadha Raghunathan
But here we need to get the grammar from users. How can I do that? Or how can input the grammar in my code?? Sent from my iPhone On Jul 22, 2011, at 5:04 AM, Yves Parès wrote: > You can do that using the Typeable class and possibly the Dynamic type. > (Data.Typeable and Data.Dynamic in base)

Re: [Haskell-cafe] Introspection

2011-07-22 Thread Yves Parès
You can do that using the Typeable class and possibly the Dynamic type. (Data.Typeable and Data.Dynamic in base) When you have: foo :: (Typeable a, Num a) => a -> a foo x = case (cast x :: Maybe Int) of Just x' -> x + 12 _ -> x foo will accept every instance of Num but will add 12 to it

[Haskell-cafe] ANNOUNCE: Haskell in the Cloud (http://quid2.org)

2011-07-22 Thread Pasqualino "Titto" Assini
Fellow Haskeller, Has your strongly typed, quick checked, formally verified, Oleg blessed, higher order monadic code become a little bit too predictable? Are you feeling a bit bored, emotionally drained and disillusioned with perfection? Longing for the days when Men were Men (and Women were Wo

[Haskell-cafe] Grammar hacker in Haskell

2011-07-22 Thread sharadha Raghunathan
Hi all, I am new to Haskell, I need to write a grammar hacker in Haskell; that would find the first set of grammar, follow set of grammar, determine if it is in LL or not and generate a LR table. Can someone help me with the same? Any reply would be much appreciated. -- Sharadha Raghunat

Re: [Haskell-cafe] Introspection

2011-07-22 Thread Patrick Browne
On 22/07/2011 10:18, Patrick Browne should have wrote: > 2) Assert the class of a variable > e.g. if y.length > 100 then y is of class big. > > Regards, > Pat > This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be

[Haskell-cafe] Introspection

2011-07-22 Thread Patrick Browne
Is it possible to access type information and perform either of the following in a Haskell program? 1) Find the type/class of a variable e.g. a type predicate: is y of-type A, or is y of-Class A 2) Assert the type of a variable e.g. if y.length > 100 then y is of type big. Regards, Pat This m

Re: [Haskell-cafe] Please help me spot where space leak occur.

2011-07-22 Thread Olexander Kozlov
Jason, thank you for your help. The hint for using -s option is very valuable. It is good to see people answering questions about Haskell here on haskell-cafe. This is really matter. I hope I will be helpfull some day too :) As for the question I didn't mention in my psot that Fn can be of arbitr