[Haskell-cafe] Re: Suggestions for an MSc Project?

2010-07-05 Thread John Smith
Thanks! A lot of good ideas, although a GUI or database framework look like the most promising possibilities at the moment. I like the email/wiki idea, although it may not meet the University's academic requirements. (Would probably just be an email client running on top of a Wiki.) It may also r

Re: [Haskell-cafe] More experiments with ATs

2010-07-05 Thread wren ng thornton
Andrew Coppin wrote: Brent Yorgey wrote: On Sun, Jul 04, 2010 at 10:31:34AM +0100, Andrew Coppin wrote: I have literally no idea what a type family is. I understand ATs (I think!), but TFs make no sense to me. ATs are just TFs which happen to be associated with a particular class. So

Re: [Haskell-cafe] Re: Rewriting a famous library and using the same name: pros and cons

2010-07-05 Thread wren ng thornton
Ivan Lazar Miljenovic wrote: Stephen Tetley writes: On 3 July 2010 14:00, Ivan Lazar Miljenovic wrote: So this argument isn't valid ;-) I think it was Hugs compliant as least for some revisions - I seem to remember looking at it before I switched to GHC. Actually, how would you call it i

Re: [Haskell-cafe] Re: Rewriting a famous library and using the same name: pros and cons

2010-07-05 Thread wren ng thornton
Ivan Lazar Miljenovic wrote: Stephen Tetley writes: I think it was Hugs compliant as least for some revisions - I seem to remember looking at it before I switched to GHC. People still use Hugs? :p MPJ uses it for teaching Haskell because it's a lot easier to install than GHC. I've heard t

[Haskell-cafe] Canonical Graphviz code

2010-07-05 Thread Ivan Miljenovic
Graphviz (http://graphviz.org/) has the option to convert provided Dot code for visualising a graph into a canonical form. For example, take the sample Dot code: | digraph foo { | a [color=blue]; | subgraph cluster_bar { | a [label="hi!"] | b [color=blue, label="bye!"

[Haskell-cafe] emacs tags

2010-07-05 Thread Michael Mossey
(I asked this question on the logical email list to ask, haskell-mode, but got no reply, so I'm hoping someone here might know the answer.) I tried to use tags with emacs. I ran :etags in ghci, then tried to use C-c M-. inside Emacs to find the definition of a symbol. It reported "no source inf

[Haskell-cafe] Re: Transformers versus monadLib versus...

2010-07-05 Thread Ertugrul Soeylemez
Gregory Crosswhite wrote: > What is the current state of opinion regarding transformers versus > monadLib versus mmtl versus ... etc.? Transformers seems to be the > "blessed" replacement for mtl, so when is it worthwhile to use the > other libraries instead? > > (It hadn't even occurred to me t

Re: [Haskell-cafe] Re: Is my code too complicated?

2010-07-05 Thread Ben Millwood
On Mon, Jul 5, 2010 at 2:41 PM, Ertugrul Soeylemez wrote: > Yes, there is some performance loss because of wrapping/unwrapping, but > I think this loss is neglible for most applications.  And I'd ask > anyway.  This is a discussion thread after all. =) > Pretty much all monad transformers are imp

[Haskell-cafe] ANNOUNCE: ghc-gc-tune: a tool for analyzing the impact of GC flags

2010-07-05 Thread Don Stewart
Inspired by a comment by Simon Marlow on Stack Overflow, about the time and space tradeoffs we make with garbage collection, particularly with a generational GCs, I wrote a small program, ghc-gc-tune, to traverse the garbage collector variable space, to see the relationship between settings and pr

[Haskell-cafe] Transformers versus monadLib versus...

2010-07-05 Thread Gregory Crosswhite
Hey everyone, What is the current state of opinion regarding transformers versus monadLib versus mmtl versus ... etc.? Transformers seems to be the "blessed" replacement for mtl, so when is it worthwhile to use the other libraries instead? (It hadn't even occurred to me to look closely at packa

Re: [Haskell-cafe] [C Binding] Turning the mutable to immutable?

2010-07-05 Thread Jake McArthur
On 07/05/2010 04:48 PM, Yves Parès wrote: 3) Is there another library on hackage that handles images in a functional way? (I mean not /all in IO/) Check out graphics-drawingcombinators. - Jake ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org ht

[Haskell-cafe] Transformers versus monadLib versus...

2010-07-05 Thread Gregory Crosswhite
Hey everyone, What is the current state regarding transformers versus monadLib versus mmtl versus ... etc.? Transformers seems to be the "blessed" replacement for mtl, so when is it worthwhile to use the other libraries instead? It hadn't even occurred to me to look closely at packages other tha

[Haskell-cafe] [C Binding] Turning the mutable to immutable?

2010-07-05 Thread Yves Parès
Hello, I don't know if some of you are familiar with the SFML library (stands for Simple and Fast Multimedia Library) --> http://sfml-dev.org As SDL, SFML is a 2D graphics library, but conversely to SDL it provides a hardware-accelerated drawing, through OpenGL. Well, I'm currently writing its Has

Re: [Haskell-cafe] Subtype polymorphism in Haskell

2010-07-05 Thread Yves Parès
> > data A_GADT where A_GADT :: A t => t -> A_GADT > By the way, is there an extension that enables A_GADT to be automatically declared as an instance of class A? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listi

Re: [Haskell-cafe] Re: Suggestions for an MSc Project?

2010-07-05 Thread Jason Dagit
On Mon, Jul 5, 2010 at 1:39 AM, John Smith wrote: > None of the frameworks in > http://www.haskell.org/haskellwiki/Applications_and_libraries/GUI_libraries#High-levelappear > to have a working build in > http://hackage.haskell.org/packages/archive/pkg-list.html#cat:gui, except > wxFruit. Is ther

Re: [Haskell-cafe] More experiments with ATs

2010-07-05 Thread Andrew Coppin
Brent Yorgey wrote: On Sun, Jul 04, 2010 at 10:31:34AM +0100, Andrew Coppin wrote: I have literally no idea what a type family is. I understand ATs (I think!), but TFs make no sense to me. ATs are just TFs which happen to be associated with a particular class. So if you understand AT

Re: [Haskell-cafe] Re: Is my code too complicated?

2010-07-05 Thread Felipe Lessa
On Mon, Jul 5, 2010 at 10:29 AM, Ertugrul Soeylemez wrote: > It happened once to me that I forgot that MVars don't have a queue.  A > database thread would take values out of the MVar as commands and > execute them, but I used the same thread to put a command into the MVar > (for later execution).

Re: [Haskell-cafe] Criteria for determining if a recursive function can be implemented in constant memory

2010-07-05 Thread Andrew Coppin
Tillmann Rendel wrote: Hi Steffen, Steffen Schuldenzucker wrote: Given the definition of a recursive function f in, say, haskell, determine if f can be implemented in O(1) memory. Constant functions are implementable in O(1) memory, but interpreters for turing-complete languages are not, so

Re: [Haskell-cafe] Getting started

2010-07-05 Thread Mark Lentczner
On Jul 5, 2010, at 7:50 AM, Mrwibbly wrote: > This adds the data to an empty database but I can't seem to call newRecord > again and add another record to the existing database. The issue is that you need to use the new database returned by newRecord in subsequent executions of your main loop. I

Re: [Haskell-cafe] Getting started

2010-07-05 Thread aditya siram
And here's a more sane version of recordSale: recordSale' :: Title -> [Record] -> [Record] recordSale' title sales = case (Prelude.lookup title sales) of Nothing -> error "This record does not exist" Just x -> [addSale (title,x)] ++ (filter (\a -> (getTitle a) /= title) sales) -deech On

Re: [Haskell-cafe] Getting started

2010-07-05 Thread aditya siram
Yes there are a few more problems. Instead of point out each one here is some modified code that does compile. Compare it to what you have and let me know if you have questions: type Title = String type Artist = String type Sold = Int type Record = (Title, (Artist, Sold)) testDatabase :: [Record]

Re: [Haskell-cafe] Getting started

2010-07-05 Thread Mrwibbly
I changed that line to say type Sales = Sales Record. But unfortunately it still fails to compile. Do you have any idea why this might be the case? -Jack aditya siram-2 wrote: > > You said it didn't compile. I somehow missed that , sorry. > -deech > > On Mon, Jul 5, 2010 at 11:06 AM, aditya s

Re: [Haskell-cafe] Getting started

2010-07-05 Thread aditya siram
You said it didn't compile. I somehow missed that , sorry. -deech On Mon, Jul 5, 2010 at 11:06 AM, aditya siram wrote: > Does this code compile? The line  "type Sales = Sales Record" for > instance is wrong - it should be "data Sales = Sales Record". > Additionally "recordSale" returns an Int, no

Re: [Haskell-cafe] Getting started

2010-07-05 Thread aditya siram
Does this code compile? The line "type Sales = Sales Record" for instance is wrong - it should be "data Sales = Sales Record". Additionally "recordSale" returns an Int, not [Sales]. -deech On Mon, Jul 5, 2010 at 10:50 AM, Mrwibbly wrote: > > This really helped, but now I am trying to add a new

Re: [Haskell-cafe] Getting started

2010-07-05 Thread Mrwibbly
This really helped, but now I am trying to add a new track to the database using a menu but it won't compile. I have tried a lot of different things but to no avail. When I get rid of the menu I am able to run, for example, newRecord "This Charming Man" "The Smiths" 1 [] This adds the data to a

Re: [Haskell-cafe] Subtype polymorphism in Haskell

2010-07-05 Thread Tillmann Rendel
Simon Courtenage wrote: I am porting a C++ program to Haskell. My current task is to take a class hierarchy and produce something equivalent in Haskell, but I don't seem to be able to get a grip on how type classes and instances contribute to the solution. They probably do not contribute a

Re: [Haskell-cafe] More experiments with ATs

2010-07-05 Thread Brent Yorgey
On Sun, Jul 04, 2010 at 10:31:34AM +0100, Andrew Coppin wrote: > > I have literally no idea what a type family is. I understand ATs (I think!), > but TFs make no sense to me. ATs are just TFs which happen to be associated with a particular class. So if you understand ATs then you understand TF

[Haskell-cafe] Re: Is my code too complicated?

2010-07-05 Thread Ertugrul Soeylemez
Stephen Tetley wrote: > On 5 July 2010 11:30, Ertugrul Soeylemez wrote: > > > That's what monad transformers are good for.  Why reinvent the > > wheel? > > The post was chiming in with Felipe Lessa's comment upthread that > avoiding transfomers can have performance benefits. > > Whether the form

Re: [Haskell-cafe] Subtype polymorphism in Haskell

2010-07-05 Thread aditya siram
Does this work for you? data A a = A (Int,Int) data B data C class A_Class a where do_x :: a -> Int instance A_Class (A B) where do_x (A (a,b)) = a + b instance A_Class (A C) where do_x (A (a,b)) = a - b -- > do_x ((A (1,2)) :: A B) -- 3 -- > do_x ((A (1,2)) :: A C) -- -1 -deech On Mon,

[Haskell-cafe] Re: Is my code too complicated?

2010-07-05 Thread Ertugrul Soeylemez
Felipe Lessa wrote: > On Mon, Jul 5, 2010 at 6:12 AM, Ertugrul Soeylemez wrote: > > Felipe Lessa wrote: > > > >> On Sat, Jul 3, 2010 at 9:25 AM, Ertugrul Soeylemez wrote: > >>> Haskell provides a lot of low level glue like laziness, currying > >>> and other very helpful language features.  But

Re: [Haskell-cafe] Subtype polymorphism in Haskell

2010-07-05 Thread Daniel Fischer
On Monday 05 July 2010 15:22:43, Simon Courtenage wrote: > Hi, > > I am porting a C++ program to Haskell. My current task is to take a > class hierarchy and produce something equivalent in Haskell, but I don't > seem to be able to get a grip on how type classes and instances > contribute to the so

Re: [Haskell-cafe] Subtype polymorphism in Haskell

2010-07-05 Thread Miguel Mitrofanov
My guess is that it's class B : public A and class C : public A In this case it seems perfect to use type classes: class A t where do_x :: t -> Integer -> Integer -> Integer data B = ... instance A B where do_x b x y = ... data C = ... instance A C where do_x c x y = ... If you want some genera

Re: [Haskell-cafe] Re: Is my code too complicated?

2010-07-05 Thread Stephen Tetley
On 5 July 2010 11:30, Ertugrul Soeylemez wrote: > That's what monad transformers are good for.  Why reinvent the wheel? Hi Ertugrul The post was chiming in with Felipe Lessa's comment upthread that avoiding transfomers can have performance benefits. Whether the formulation I gave is particular

[Haskell-cafe] Subtype polymorphism in Haskell

2010-07-05 Thread Simon Courtenage
Hi, I am porting a C++ program to Haskell. My current task is to take a class hierarchy and produce something equivalent in Haskell, but I don't seem to be able to get a grip on how type classes and instances contribute to the solution. Can anyone enlighten me? Roughly, the class hierarchy in C

Re: [Haskell-cafe] Criteria for determining if a recursive function can be implemented in constant memory

2010-07-05 Thread Tillmann Rendel
Hi Steffen, Steffen Schuldenzucker wrote: since a little discussion with my tutor I am wondering how the following problem can be solved and if it is decidable: Given the definition of a recursive function f in, say, haskell, determine if f can be implemented in O(1) memory. Constant functi

Fwd: [Haskell-cafe] Re: Is my code too complicated?

2010-07-05 Thread Alberto G. Corona
Very often the type system assures safety to a point where some coding is done trough trial and error: -I think that this composition is right, let´s try it-... -oh, some missing type here, Let´s put it here and here-...-go on-... -The typechecker say t´s OK. I run it and, well it works. Later wh

[Haskell-cafe] Criteria for determining if a recursive function can be implemented in constant memory

2010-07-05 Thread Steffen Schuldenzucker
Dear Cafe, since a little discussion with my tutor I am wondering how the following problem can be solved and if it is decidable: Given the definition of a recursive function f in, say, haskell, determine if f can be implemented in O(1) memory. First I thought the solution would be "check

Re: [Haskell-cafe] Re: Is my code too complicated?

2010-07-05 Thread Felipe Lessa
On Mon, Jul 5, 2010 at 6:12 AM, Ertugrul Soeylemez wrote: > Felipe Lessa wrote: > >> On Sat, Jul 3, 2010 at 9:25 AM, Ertugrul Soeylemez wrote: >> > Haskell provides a lot of low level glue like laziness, currying and >> > other very helpful language features.  But what is different in >> > Haske

Re: [Haskell-cafe] How easy is it to hire Haskell programmers

2010-07-05 Thread Sean Leather
On Fri, Jul 2, 2010 at 15:43, Edward Kmett wrote: > I've had a fairly easy time of hiring Haskell programmers. > Does this mean your company actively uses Haskell in projects? Would you be willing/able to describe this work in more detail for the curious? Sean ___

[Haskell-cafe] Re: Is my code too complicated?

2010-07-05 Thread Ertugrul Soeylemez
Stephen Tetley wrote: > On 5 July 2010 10:39, Yves Parès wrote: > > > Then what is your alternative? How do you replace monad > > transformers? > > Possibly more a case of doing without rather than replacing them with > something else, you would amalgamate all the monadic effects you want > into

Re: [Haskell-cafe] Is my code too complicated?

2010-07-05 Thread Stephen Tetley
On 5 July 2010 10:39, Yves Parès wrote: > Then what is your alternative? How do you replace monad transformers? Possibly more a case of doing without rather than replacing them with something else, you would amalgamate all the monadic effects you want into one monad. E.g. State and Environment

Re: [Haskell-cafe] Is my code too complicated?

2010-07-05 Thread Yves Parès
> > About monad transformers, I don't really like to use them because they > can get hairy in some cases, and because they have poor performance in > other cases. > Then what is your alternative? How do you replace monad transformers? ___ Haskell-Cafe ma

[Haskell-cafe] Re: Is my code too complicated?

2010-07-05 Thread Ertugrul Soeylemez
Felipe Lessa wrote: > On Sat, Jul 3, 2010 at 9:25 AM, Ertugrul Soeylemez wrote: > > Haskell provides a lot of low level glue like laziness, currying and > > other very helpful language features.  But what is different in > > Haskell is that it doesn't seem to provide any high level glue like > >

Re: [Haskell-cafe] music-related problem

2010-07-05 Thread Michael Mossey
erik flister wrote: > Michael Mossey wrote: Regarding my use of Rational, it's because I'm representing *notated* durations or positions in time, which are always fractions of integers. Suppose I give the command to my program to play via midi everything from bar 1 beat 1 t

[Haskell-cafe] Re: Suggestions for an MSc Project?

2010-07-05 Thread John Smith
None of the frameworks in http://www.haskell.org/haskellwiki/Applications_and_libraries/GUI_libraries#High-level appear to have a working build in http://hackage.haskell.org/packages/archive/pkg-list.html#cat:gui, except wxFruit. Is there a need that isn't being met for "high-level" GUI libraries