Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Ivan Lazar Miljenovic
"Kevin Quick" writes: > I was trying to put them on the inside. Essentially I was trying to > use the 'a' portion of the LNode as a type that would provide methods > from which I could reconstruct the shape of the Graph. Or to put it > another way, I had a collection of data and I wanted to be a

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Kevin Quick
On Sat, 01 May 2010 15:42:09 -0700, Ivan Lazar Miljenovic wrote: instance Graph GrB where -- instance (Cls a) => Graph GrB where -- error: ambiguous constraint, must mention type a -- instance (Cls a) => forall a. Graph GrB where -- error: malformed instance header -- instance (Cls a) Graph

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Ivan Lazar Miljenovic
"Kevin Quick" writes: > Yes, I was hoping to use FGL directly (or it's replacement as I've > scanned some of the recent Cafe discussions and seen that Ivan in > particular is undertaking this). FGL isn't really set up for this kind of "the data type _must_ be restricted" approach. > The key here

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Kevin Quick
On Sat, 01 May 2010 01:01:47 -0700, Sebastian Fischer wrote: On May 1, 2010, at 8:08 AM, Ivan Lazar Miljenovic wrote: * I can't redefine the Graph methods to introduce the (Cls a) constraint [reasonable] Not sure if you can. I think Kevin means that he cannot change the signature of the

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Kevin Quick
On Fri, 30 Apr 2010 23:30:21 -0700, Jason Dagit wrote: On Fri, Apr 30, 2010 at 11:08 PM, Ivan Lazar Miljenovic < ivan.miljeno...@gmail.com> wrote: You're putting the constraint in the wrong places: put the "(Cls a) => " in the actual functions where you need it. I need to use Cls methods in

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Ivan Lazar Miljenovic
Jason Dagit writes: > On Sat, May 1, 2010 at 12:49 AM, Ivan Lazar Miljenovic < > I thought we were discussing how expressive the Graph typeclass is, not > whether I made a sensible implementation. I mean, I could pretty easily fix > that "problem", but I think that's not the important topic. Fo

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Ivan Lazar Miljenovic
Sebastian Fischer writes: >> Furthermore, as I said earlier, >> it doesn't make sense to constrain the label type just to make an >> instance of a type class. >> >> (Now, if we had other functions in there which _might_ depend on the >> label types, this _would_ make sense; as it stands however,

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Jason Dagit
On Sat, May 1, 2010 at 12:49 AM, Ivan Lazar Miljenovic < ivan.miljeno...@gmail.com> wrote: > Jason Dagit writes: > > > On Sat, May 1, 2010 at 12:23 AM, Ivan Lazar Miljenovic < > > ivan.miljeno...@gmail.com> wrote: > > > >> Hmmm this is an interesting way of doing it, but I would argue that >

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Sebastian Fischer
On May 1, 2010, at 8:08 AM, Ivan Lazar Miljenovic wrote: * I can't redefine the Graph methods to introduce the (Cls a) constraint [reasonable] Not sure if you can. I think Kevin means that he cannot change the signature of the methods in the Graph class because those are defined in the FG

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Sebastian Fischer
Furthermore, as I said earlier, it doesn't make sense to constrain the label type just to make an instance of a type class. (Now, if we had other functions in there which _might_ depend on the label types, this _would_ make sense; as it stands however, it doesn't.) You'll notice that my empty

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Ivan Lazar Miljenovic
Jason Dagit writes: > On Sat, May 1, 2010 at 12:23 AM, Ivan Lazar Miljenovic < > ivan.miljeno...@gmail.com> wrote: > >> Hmmm this is an interesting way of doing it, but I would argue that >> it's pointless: the fact that you're using MPTCs doesn't give you >> anything extra that the original

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Jason Dagit
On Sat, May 1, 2010 at 12:23 AM, Ivan Lazar Miljenovic < ivan.miljeno...@gmail.com> wrote: > Hmmm this is an interesting way of doing it, but I would argue that > it's pointless: the fact that you're using MPTCs doesn't give you > anything extra that the original class. Furthermore, as I said

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Ivan Lazar Miljenovic
Hmmm this is an interesting way of doing it, but I would argue that it's pointless: the fact that you're using MPTCs doesn't give you anything extra that the original class. Furthermore, as I said earlier, it doesn't make sense to constrain the label type just to make an instance of a type cla

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Jason Dagit
On Fri, Apr 30, 2010 at 11:53 PM, Ivan Lazar Miljenovic < ivan.miljeno...@gmail.com> wrote: > Jason Dagit writes: > > > On Fri, Apr 30, 2010 at 11:08 PM, Ivan Lazar Miljenovic < > > ivan.miljeno...@gmail.com> wrote: > >> > >> > >> You're putting the constraint in the wrong places: put the "(Cls a

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Ivan Miljenovic
Sorry for the useless noise, I realised just after I sent this that that is what Jason said initially :s On 1 May 2010 17:02, Ivan Lazar Miljenovic wrote: > "Brandon S. Allbery KF8NH" writes: > >> On May 1, 2010, at 02:38 , Jason Dagit wrote: >>> Why wasn't the Graph class designed this way?  My

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Ivan Lazar Miljenovic
"Brandon S. Allbery KF8NH" writes: > On May 1, 2010, at 02:38 , Jason Dagit wrote: >> Why wasn't the Graph class designed this way? My guess: It was >> probably a decision that predated multiparameter type classes. > > > Or a specific decision was made to stick to Haskell'98 compatibility. I w

Re: [Haskell-cafe] FGL instance constraint

2010-04-30 Thread Ivan Lazar Miljenovic
Jason Dagit writes: > On Fri, Apr 30, 2010 at 11:30 PM, Jason Dagit wrote: > Looking over this real quick, I think the Graph class should be changed to > mention a and b: > > class Graph (gr a b) where ... Won't work: you need to specify that gr has kind * -> * -> *; this is exactly the same a

Re: [Haskell-cafe] FGL instance constraint

2010-04-30 Thread Ivan Lazar Miljenovic
Jason Dagit writes: > On Fri, Apr 30, 2010 at 11:08 PM, Ivan Lazar Miljenovic < > ivan.miljeno...@gmail.com> wrote: >> >> >> You're putting the constraint in the wrong places: put the "(Cls a) => " >> in the actual functions where you need it. >> > > That's solid advice in general, but it's still

Re: [Haskell-cafe] FGL instance constraint

2010-04-30 Thread Brandon S. Allbery KF8NH
On May 1, 2010, at 02:38 , Jason Dagit wrote: Why wasn't the Graph class designed this way? My guess: It was probably a decision that predated multiparameter type classes. Or a specific decision was made to stick to Haskell'98 compatibility. -- brandon s. allbery [solaris,freebsd,perl,pugs

Re: [Haskell-cafe] FGL instance constraint

2010-04-30 Thread Jason Dagit
On Fri, Apr 30, 2010 at 11:30 PM, Jason Dagit wrote: > > > On Fri, Apr 30, 2010 at 11:08 PM, Ivan Lazar Miljenovic < > ivan.miljeno...@gmail.com> wrote: >> >> >> You're putting the constraint in the wrong places: put the "(Cls a) => " >> in the actual functions where you need it. >> > > That's so

Re: [Haskell-cafe] FGL instance constraint

2010-04-30 Thread Jason Dagit
On Fri, Apr 30, 2010 at 11:08 PM, Ivan Lazar Miljenovic < ivan.miljeno...@gmail.com> wrote: > > > You're putting the constraint in the wrong places: put the "(Cls a) => " > in the actual functions where you need it. > That's solid advice in general, but it's still not going to work here if any of

Re: [Haskell-cafe] FGL instance constraint

2010-04-30 Thread Ivan Lazar Miljenovic
"Kevin Quick" writes: > I need help understanding how to express the following: > > >> data (Cls a) => B a = B [a] I think this only works if you have a forall in there. > >> data GrB a b = GrB (B a) > >> instance Graph GrB where ... > > In the methods for the instance specification, I need

[Haskell-cafe] FGL instance constraint

2010-04-30 Thread Kevin Quick
I need help understanding how to express the following: data (Cls a) => B a = B [a] data GrB a b = GrB (B a) instance Graph GrB where ... In the methods for the instance specification, I need to perform Cls a operations on a. * As shown, the compiler complains that it cannot dedu