[Haskell-cafe] Testing Implementation vs Model - Records or Type Classes?

2011-04-08 Thread Heinrich Apfelmus
*implementation* to be used in production code. Of course, I would like to use QuickCheck to test that the implementation gives the same results as the model. My problem is: how to organize this with the minimum amount of boilerplate? It appears that I can use *multiparameter type classes* to solve

Re: [Haskell-cafe] Testing Implementation vs Model - Records or Type Classes?

2011-04-08 Thread Twan van Laarhoven
On 08/04/11 11:54, Heinrich Apfelmus wrote: Hello, I'm writing a small Haskell library for functional reactive programming. The core of the library consists of two data types and several primitives. However, I have programmed this core *twice*: once as a *model* that displays the intended

Re: [Haskell-cafe] Testing Implementation vs Model - Records or Type Classes?

2011-04-08 Thread wren ng thornton
On 4/8/11 8:55 AM, Twan van Laarhoven wrote: -- this class is useful beyond this FRP library, -- you might already be able to find it on hackage somewhere class Functor f = Filterable f where filter :: (a - Bool) - f a - f a -- filter p . fmap f == fmap f . filter (p . f) -- filter (const True)

Re: Deriviable type classes

2011-02-10 Thread José Pedro Magalhães
Hi, 2011/2/10 Yitzchak Gale g...@sefer.org Simon Peyton-Jones wrote: Generic Defaults... will replace... the Derivable type classes stuff... in GHC 7.2 or 7.4... Please yell if you are a secret user of derivable type classes, so this change would discombobulate you. Could you give us

Deriviable type classes

2011-02-09 Thread Simon Peyton-Jones
Friends Just a heads-up. Pedro is working on implementing Generic Defaults, as described in his Haskell Symposium 2010 paper www.dreixel.net/research/pdf/gdmh_nocolor.pdf It will replace (and improve on) the Derivable type classes stuff in GHC at the moment, which was originally presented

Re: Deriviable type classes

2011-02-09 Thread José Pedro Magalhães
Hi, 2011/2/9 Simon Peyton-Jones simo...@microsoft.com Friends Just a heads-up. Pedro is working on implementing Generic Defaults, as described in his Haskell Symposium 2010 paper www.dreixel.net/research/pdf/gdmh_nocolor.pdf It will replace (and improve on) the Derivable type classes

RE: Deriviable type classes

2011-02-09 Thread Simon Peyton-Jones
] Sent: 09 February 2011 12:20 To: Simon Peyton-Jones Cc: GHC users Subject: Re: Deriviable type classes Hi, 2011/2/9 Simon Peyton-Jones simo...@microsoft.commailto:simo...@microsoft.com Friends Just a heads-up. Pedro is working on implementing Generic Defaults, as described in his Haskell Symposium

Re: Deriviable type classes

2011-02-09 Thread Sean Leather
2011/2/9 Simon Peyton-Jones: Friends Just a heads-up. Pedro is working on implementing Generic Defaults, as described in his Haskell Symposium 2010 paper www.dreixel.net/research/pdf/gdmh_nocolor.pdf It will replace (and improve on) the Derivable type classes stuff in GHC at the moment

Re: Deriviable type classes

2011-02-09 Thread Yitzchak Gale
Simon Peyton-Jones wrote: Generic Defaults... will replace... the Derivable type classes stuff... in GHC 7.2 or 7.4... Please yell if you are a secret user of derivable type classes, so this change would discombobulate you. Could you give us a preview of the parts of the syntax spectrum

Re: [GHC] #4809: MonoLocalBinds and type classes cause infinite loop

2010-12-17 Thread GHC
#4809: MonoLocalBinds and type classes cause infinite loop --+- Reporter: JeremyShaw | Owner: Type: bug | Status: closed

Re: [GHC] #4809: MonoLocalBinds and type classes cause infinite loop

2010-12-16 Thread GHC
#4809: MonoLocalBinds and type classes cause infinite loop --+- Reporter: JeremyShaw | Owner: Type: bug | Status: closed

Re: [GHC] #4809: MonoLocalBinds and type classes cause infinite loop

2010-12-15 Thread GHC
#4809: MonoLocalBinds and type classes cause infinite loop --+- Reporter: JeremyShaw | Owner: Type: bug | Status: closed

Re: [GHC] #4809: MonoLocalBinds and type classes cause infinite loop

2010-12-14 Thread GHC
#4809: MonoLocalBinds and type classes cause infinite loop --+- Reporter: JeremyShaw | Owner: Type: bug | Status: closed

Re: [GHC] #4809: MonoLocalBinds and type classes cause infinite loop

2010-12-13 Thread GHC
#4809: MonoLocalBinds and type classes cause infinite loop -+-- Reporter: JeremyShaw|Owner: Type: bug | Status: merge

Re: [GHC] #4809: MonoLocalBinds and type classes cause infinite loop

2010-12-05 Thread GHC
#4809: MonoLocalBinds and type classes cause infinite loop -+-- Reporter: JeremyShaw|Owner: Type: bug | Status: new

Re: [Haskell-cafe] OverloadedStrings mixed with type classes leads toboilerplate type signatures

2010-12-05 Thread Claus Reinke
ghci :set -XOverloadedStrings ghci $name ate a banana. % [(name, Johan)] Johan ate a banana. class Context a where lookup :: a - T.Text - T.Text instance Context [(T.Text, T.Text)] where lookup xs k = fromMaybe (error $ KeyError: ++ show k) (P.lookup k xs)

Re: [GHC] #4809: MonoLocalBinds and type classes cause infinite loop

2010-12-04 Thread GHC
#4809: MonoLocalBinds and type classes cause infinite loop -+-- Reporter: JeremyShaw| Owner: Type: bug | Status: new

[Haskell-cafe] OverloadedStrings mixed with type classes leads to boilerplate type signatures

2010-12-04 Thread Johan Tibell
Hi, I'm trying to generalize my string substitution library (http://hackage.haskell.org/package/template) to allow users to provide different kinds of key/value mappings (e.g. functions and association lists) for filling in the placeholders in a template. Here are two examples I'd like to work:

Re: [GHC] #4809: MonoLocalBinds and type classes cause infinite loop

2010-12-01 Thread GHC
#4809: MonoLocalBinds and type classes cause infinite loop -+-- Reporter: JeremyShaw| Owner: Type: bug | Status: new

Re: [GHC] #4809: MonoLocalBinds and type classes cause infinite loop

2010-12-01 Thread GHC
#4809: MonoLocalBinds and type classes cause infinite loop -+-- Reporter: JeremyShaw| Owner: Type: bug | Status: new

[GHC] #4809: MonoLocalBinds and type classes cause infinite loop

2010-11-30 Thread GHC
#4809: MonoLocalBinds and type classes cause infinite loop -+-- Reporter: JeremyShaw| Owner: Type: bug | Status: new

Re: [GHC] #4809: MonoLocalBinds and type classes cause infinite loop

2010-11-30 Thread GHC
#4809: MonoLocalBinds and type classes cause infinite loop -+-- Reporter: JeremyShaw| Owner: Type: bug | Status: new

Re: [Haskell-cafe] Re: Decoupling type classes (e.g. Applicative)?

2010-11-08 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/3/10 21:30 , Maciej Piechotka wrote: On Tue, 2010-11-02 at 21:57 -0400, Brandon S Allbery KF8NH wrote: On 10/29/10 09:35 , Dominique Devriese wrote: * Only introduce a dependency from type class A to type class B if all functions in type

Re: [Haskell-cafe] Re: Decoupling type classes (e.g. Applicative)?

2010-11-04 Thread Henning Thielemann
Sönke Hahn schrieb: I have been thinking for a while that it might be worth defining a Prelude2, which corrects the known problems with the Prelude. Over time, people could migrate to using Prelude2. It would probably take years to be widely adopted, but at least there would be light at the

[Haskell-cafe] Re: Decoupling type classes (e.g. Applicative)?

2010-11-03 Thread Maciej Piechotka
On Tue, 2010-11-02 at 21:57 -0400, Brandon S Allbery KF8NH wrote: On 10/29/10 09:35 , Dominique Devriese wrote: * Only introduce a dependency from type class A to type class B if all functions in type class B can be implemented in terms of the functions in type class A or if type class

Re: [Haskell-cafe] Decoupling type classes (e.g. Applicative)?

2010-11-02 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/29/10 09:35 , Dominique Devriese wrote: * Only introduce a dependency from type class A to type class B if all functions in type class B can be implemented in terms of the functions in type class A or if type class A is empty. Er? Eq a

[Haskell-cafe] Decoupling type classes (e.g. Applicative)?

2010-10-29 Thread Dominique Devriese
Hi all, I have a problem with the design of the Applicative type class, and I'm interested to know people's opinion about this. Currently, the Functor and Applicative type class are defined like this: class Functor f where fmap:: (a - b) - f a - f b class Functor f =

Re: [Haskell-cafe] Decoupling type classes (e.g. Applicative)?

2010-10-29 Thread Ozgur Akgun
On 29 October 2010 14:35, Dominique Devriese dominique.devri...@cs.kuleuven.be wrote: I have a problem with the design of the Applicative type class Sorry for going a bit off-topic, but every-time I see someone complaining about such things, I remember this proposal:

[Haskell-cafe] Re: Decoupling type classes (e.g. Applicative)?

2010-10-29 Thread DavidA
to the point, I guess I would say that another design principle (perhaps a looser version of your first) is - don't put things together in a type class if they can be understood as separate concepts Unfortunately it is very hard, if not impossible, to get existing type classes changed, due

Re: [Haskell-cafe] Re: Decoupling type classes (e.g. Applicative)?

2010-10-29 Thread Sönke Hahn
I have been thinking for a while that it might be worth defining a Prelude2, which corrects the known problems with the Prelude. Over time, people could migrate to using Prelude2. It would probably take years to be widely adopted, but at least there would be light at the end of the tunnel.

Re: [Haskell-cafe] Restricted type classes

2010-09-10 Thread wren ng thornton
On 9/10/10 12:47 AM, David Menendez wrote: It seems like you could use a similar argument to show that fmap id /= id. Specifically, xs and map id xs are equivalent lists, but they occupy different locations in memory. By replacing xs with map id xs, you can come arbitrarily close to doubling a

Re: [Haskell-cafe] Restricted type classes

2010-09-10 Thread Dan Doel
On Wednesday 08 September 2010 11:17:43 pm wren ng thornton wrote: -- | Proof that impure is not p...@e fmap f (impure a) == fmap f (E a a) == E (f a) a /= E (f a) (f a) == impure (f a) I don't believe your proof. The type of E is as follows: E :: a - b - E

Re: [Haskell-cafe] Restricted type classes

2010-09-09 Thread wren ng thornton
On 9/9/10 1:04 AM, David Menendez wrote: Fascinating. I figured there might be a counter-example involving seq, but this is pretty subtle. In particular, would it be fair to say that in Haskell-without-seq, E (f a) a and E (f a) (f a) are indistinguishable? Yes, I think that without

Re: [Haskell-cafe] Restricted type classes

2010-09-09 Thread David Menendez
On Thu, Sep 9, 2010 at 11:33 PM, wren ng thornton w...@freegeek.org wrote: On 9/9/10 1:04 AM, David Menendez wrote: Fascinating. I figured there might be a counter-example involving seq, but this is pretty subtle. In particular, would it be fair to say that in Haskell-without-seq, E (f a) a

Re: [Haskell-cafe] Restricted type classes

2010-09-08 Thread wren ng thornton
On 9/7/10 12:33 AM, Ivan Lazar Miljenovic wrote: On 7 September 2010 14:24, wren ng thorntonw...@freegeek.org wrote: On 9/7/10 12:04 AM, Ivan Lazar Miljenovic wrote: Not quite sure what you mean by a mis-match Just that they're not the same thing. For example, ZipList supports pure but it

Re: [Haskell-cafe] Restricted type classes

2010-09-08 Thread wren ng thornton
On 9/7/10 7:26 AM, Neil Brown wrote: On 07/09/10 05:24, wren ng thornton wrote: Just that they're not the same thing. For example, ZipList supports pure but it has no meaningful instance of singleton since every ZipList is infinite. I don't believe that every ZipList is infinite (if this

Re: [Haskell-cafe] Restricted type classes

2010-09-08 Thread Ivan Lazar Miljenovic
On 9 September 2010 12:10, wren ng thornton w...@freegeek.org wrote: I think the shape of the classes for singletons, insert, coinsert, and union still needs some work. For instance, the definitions I've given earlier were assuming a (multi)set-like or sequence-like container, but we can also

Re: [Haskell-cafe] Restricted type classes

2010-09-08 Thread wren ng thornton
On 9/7/10 4:21 AM, Daniel Fischer wrote: On Tuesday 07 September 2010 05:22:55, David Menendez wrote: In fact, I think *every* appropriately-typed function satisfies that law. Does anyone know of a counter-example? -- | Multiply the *Hask* category by its number of objects. data E a

Re: [Haskell-cafe] Restricted type classes

2010-09-08 Thread David Menendez
On Wed, Sep 8, 2010 at 11:17 PM, wren ng thornton w...@freegeek.org wrote: On 9/7/10 4:21 AM, Daniel Fischer wrote: On Tuesday 07 September 2010 05:22:55, David Menendez wrote: In fact, I think *every* appropriately-typed function satisfies that law. Does anyone know of a counter-example?  

Re: [Haskell-cafe] Restricted type classes

2010-09-07 Thread Daniel Fischer
On Tuesday 07 September 2010 05:22:55, David Menendez wrote: On Mon, Sep 6, 2010 at 10:22 PM, wren ng thornton w...@freegeek.org wrote: On 9/6/10 1:33 PM, David Menendez wrote: For that matter, can you even describe what pure is intended to do without reference to*  or join? As already

Re: [Haskell-cafe] Restricted type classes

2010-09-07 Thread John Lato
2010/9/7 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com 2010/9/7 Gábor Lehel illiss...@gmail.com: *That said*, I actually have nothing at all against splitting the 'a - f a' method out into a separate class if you think it's useful, whether you call it Pointed or something else. (And

Re: [Haskell-cafe] Restricted type classes

2010-09-07 Thread John Lato
From: Stephen Tetley stephen.tet...@gmail.com On 6 September 2010 20:18, John Lato jwl...@gmail.com wrote: Can you give an example of a Functor that doesn't have pure? I think it's Pointed Functors which are useful; not Functor by itself. Strictly speaking is Pair one? The current

Re: [Haskell-cafe] Restricted type classes

2010-09-07 Thread Neil Brown
On 07/09/10 05:24, wren ng thornton wrote: that other class would (most likely) be a subclass of pointed functors. In any case, it does mean there's something of a mismatch between singleton vs return/pure/point/unit. Not quite sure what you mean by a mis-match Of course, I'd expect

Re: [Haskell-cafe] Pointed (was: Re: Restricted type classes)

2010-09-07 Thread Sebastian Fischer
On Sep 7, 2010, at 5:23 AM, wren ng thornton wrote: In particular, one of the primary complaints against the Monad class is precisely the fact that it *fails* to mention the Functor class as a (transitive) dependency. Why should we believe that making unit independent from fmap will fare

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread wren ng thornton
On 9/5/10 10:19 AM, Ivan Lazar Miljenovic wrote: Hmmm is there any reason for Functor to be a superclass of Pointed? I understand Functor and Pointed being superclasses of Applicative (which in turn is a superclass of Monad), but can't see any relation between Pointed and Functor...

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread Ivan Lazar Miljenovic
On 6 September 2010 16:15, wren ng thornton w...@freegeek.org wrote: On 9/5/10 10:19 AM, Ivan Lazar Miljenovic wrote: Hmmm is there any reason for Functor to be a superclass of Pointed?  I understand Functor and Pointed being superclasses of Applicative (which in turn is a superclass of

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread John Lato
class. Why make things more complicated for little or no benefit? Not every member, but I would argue that type classes for containers should be much more fine-grained than anything I have seen proposed so far. I'm thinking of the collections provided by the .Net framework, i.e. a base ICollection

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread John Lato
Message: 20 Date: Sat, 04 Sep 2010 03:40:49 -0400 From: wren ng thornton w...@freegeek.org Subject: Re: [Haskell-cafe] Restricted type classes To: Haskell Cafe haskell-cafe@haskell.org Message-ID: 4c81f801@freegeek.org Content-Type: text/plain; charset=UTF-8; format=flowed On 9/3/10

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread Gábor Lehel
On Mon, Sep 6, 2010 at 5:11 PM, John Lato jwl...@gmail.com wrote: Message: 20 Date: Sat, 04 Sep 2010 03:40:49 -0400 From: wren ng thornton w...@freegeek.org Subject: Re: [Haskell-cafe] Restricted type classes To: Haskell Cafe haskell-cafe@haskell.org Message-ID: 4c81f801@freegeek.org

Re: [Haskell-cafe] container-classes (was: Restricted type classes)

2010-09-06 Thread John Lato
I'd like to make one more argument in favor of my preference for more splitting of type classes. IMO it's beneficial to split up classes to minimize unnecessary dependencies. That is, while e.g. Monoid is very useful for containers, many container methods won't need it, e.g. elem or filter

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread David Menendez
On Mon, Sep 6, 2010 at 7:51 AM, John Lato jwl...@gmail.com wrote: On Sun, Sep 5, 2010 at 7:18 PM, David Menendez d...@zednenem.com wrote: On Sun, Sep 5, 2010 at 8:40 AM, John Lato jwl...@gmail.com wrote: On Sat, Sep 4, 2010 at 12:34 PM, David Menendez d...@zednenem.com wrote: On

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread John Lato
On Mon, Sep 6, 2010 at 12:33 PM, David Menendez d...@zednenem.com wrote: On Mon, Sep 6, 2010 at 7:51 AM, John Lato jwl...@gmail.com wrote: On Sun, Sep 5, 2010 at 7:18 PM, David Menendez d...@zednenem.com wrote: On Sun, Sep 5, 2010 at 8:40 AM, John Lato jwl...@gmail.com wrote: On

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread Stephen Tetley
On 6 September 2010 20:18, John Lato jwl...@gmail.com wrote: Can you give an example of a Functor that doesn't have pure?  I think it's Pointed Functors which are useful; not Functor by itself. Strictly speaking is Pair one? The current implementation tacks on monoid. Best wishes Stephen

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread wren ng thornton
On 9/6/10 2:35 AM, Ivan Lazar Miljenovic wrote: Well, if we consider what this does, pure is equivalent to singleton for container types. The actual definition of pure (or any other aspect of Pointed) doesn't require Functor; however there are properties for types that are instances of Functor

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread wren ng thornton
On 9/6/10 1:33 PM, David Menendez wrote: For that matter, can you even describe what pure is intended to do without reference to* or join? As already stated: fmap f . pure = pure . f -- Live well, ~wren ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread David Menendez
On Mon, Sep 6, 2010 at 10:22 PM, wren ng thornton w...@freegeek.org wrote: On 9/6/10 1:33 PM, David Menendez wrote: For that matter, can you even describe what pure is intended to do without reference to*  or join? As already stated: fmap f . pure = pure . f That's pretty general. For

[Haskell-cafe] Pointed (was: Re: Restricted type classes)

2010-09-06 Thread wren ng thornton
On 9/6/10 11:50 AM, Gábor Lehel wrote: On Mon, Sep 6, 2010 at 5:11 PM, John Latojwl...@gmail.com wrote: But please don't make Pointed depend on Functor - we've already seen that it won't work for Bloom filters. I think most people have been using Pointed merely as shorthand for Pointed

Re: [Haskell-cafe] container-classes (was: Restricted type classes)

2010-09-06 Thread Ivan Lazar Miljenovic
On 7 September 2010 02:53, John Lato jwl...@gmail.com wrote: I'd like to make one more argument in favor of my preference for more splitting of type classes.  IMO it's beneficial to split up classes to minimize unnecessary dependencies.  That is, while e.g. Monoid is very useful for containers

Re: [Haskell-cafe] container-classes (was: Restricted type classes)

2010-09-06 Thread wren ng thornton
On 9/6/10 12:53 PM, John Lato wrote: I'd like to make one more argument in favor of my preference for more splitting of type classes. FWIW, I agree that more splitting is generally good. This is one of the problems I have with the various proposals for a ListLike class. They conflate

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread Ivan Lazar Miljenovic
2010/9/7 Gábor Lehel illiss...@gmail.com: *That said*, I actually have nothing at all against splitting the 'a - f a' method out into a separate class if you think it's useful, whether you call it Pointed or something else. (And `class (Pointed f, Functor f) = PointedFunctor f` is sort of

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread Ivan Lazar Miljenovic
On 7 September 2010 12:18, wren ng thornton w...@freegeek.org wrote: On 9/6/10 2:35 AM, Ivan Lazar Miljenovic wrote: Well, if we consider what this does, pure is equivalent to singleton for container types.  The actual definition of pure (or any other aspect of Pointed) doesn't require

Re: [Haskell-cafe] Pointed (was: Re: Restricted type classes)

2010-09-06 Thread Ivan Lazar Miljenovic
On 7 September 2010 13:23, wren ng thornton w...@freegeek.org wrote: On 9/6/10 11:50 AM, Gábor Lehel wrote: On Mon, Sep 6, 2010 at 5:11 PM, John Latojwl...@gmail.com  wrote: But please don't make Pointed depend on Functor - we've already seen that it won't work for Bloom filters. I think

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread wren ng thornton
On 9/7/10 12:04 AM, Ivan Lazar Miljenovic wrote: Perhaps this just means that union/insert should be part of some other class. That is part of the plan (I'm tentatively calling the class with the insert method Buildable or Extendable); this means that if a type is an instance of Monoid (for

Re: [Haskell-cafe] Restricted type classes

2010-09-06 Thread Ivan Lazar Miljenovic
On 7 September 2010 14:24, wren ng thornton w...@freegeek.org wrote: On 9/7/10 12:04 AM, Ivan Lazar Miljenovic wrote: Perhaps this just means that union/insert should be part of some other class. That is part of the plan (I'm tentatively calling the class with the insert method Buildable or

Re: [Haskell-cafe] Restricted type classes

2010-09-05 Thread John Lato
On Fri, Sep 3, 2010 at 12:01 PM, C. McCann c...@uptoisomorphism.net wrote: On Fri, Sep 3, 2010 at 11:47 AM, John Lato jwl...@gmail.com wrote: On Fri, Sep 3, 2010 at 1:29 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 3 September 2010 22:23, John Lato jwl...@gmail.com wrote:

Re: [Haskell-cafe] Restricted type classes

2010-09-05 Thread John Lato
On Sat, Sep 4, 2010 at 12:34 PM, David Menendez d...@zednenem.com wrote: On Fri, Sep 3, 2010 at 8:23 AM, John Lato jwl...@gmail.com wrote: +1 for using the proper constraints, and especially for bringing over Pointed (and anything else that applies). What's the argument for Pointed? Are

Re: [Haskell-cafe] Restricted type classes

2010-09-05 Thread Ivan Lazar Miljenovic
On 5 September 2010 22:40, John Lato jwl...@gmail.com wrote: Having Pointed is categorically the right thing to do, which is why I argue for its inclusion.  Also, I think it would be prudent to avoid a situation with the possibility of turning into a rehash of the Functor/Applicative/Monad

Re: [Haskell-cafe] Restricted type classes

2010-09-05 Thread John Lato
On Sun, Sep 5, 2010 at 7:47 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 5 September 2010 22:40, John Lato jwl...@gmail.com wrote: Having Pointed is categorically the right thing to do, which is why I argue for its inclusion. Also, I think it would be prudent to avoid a

Re: [Haskell-cafe] Restricted type classes

2010-09-05 Thread Sebastian Fischer
Just because we don't have a use now doesn't mean it might not be useful in the future. I am suspicious about complicating a design for potential future benefits. However, difference lists provide an example of a type that support Pointed more naturally than Applicative: the dlist package

Re: [Haskell-cafe] Restricted type classes

2010-09-05 Thread Ivan Lazar Miljenovic
On 6 September 2010 00:11, Sebastian Fischer s...@informatik.uni-kiel.de wrote: Just because we don't have a use now doesn't mean it might not be useful in the future. I am suspicious about complicating a design for potential future benefits. However, difference lists provide an example of a

Re: [Haskell-cafe] Restricted type classes

2010-09-05 Thread David Menendez
On Sun, Sep 5, 2010 at 8:40 AM, John Lato jwl...@gmail.com wrote: On Sat, Sep 4, 2010 at 12:34 PM, David Menendez d...@zednenem.com wrote: On Fri, Sep 3, 2010 at 8:23 AM, John Lato jwl...@gmail.com wrote: +1 for using the proper constraints, and especially for bringing over Pointed (and

Re: [Haskell-cafe] Restricted type classes

2010-09-05 Thread David Menendez
On Sun, Sep 5, 2010 at 8:47 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: I _can_ think of a data type that could conceivably be an instance of Pointed but not Applicative: a BloomFilter (though there's not really any point in having a BloomFilter with only one value that I can

Re: [Haskell-cafe] Restricted type classes

2010-09-05 Thread Ivan Lazar Miljenovic
On 6 September 2010 04:25, David Menendez d...@zednenem.com wrote: On Sun, Sep 5, 2010 at 8:47 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: I _can_ think of a data type that could conceivably be an instance of Pointed but not Applicative: a BloomFilter (though there's not really

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread wren ng thornton
On 9/3/10 12:16 AM, Ivan Lazar Miljenovic wrote: 1) How should I name the kind * versions? For example, the kind * version of Functor is currently called Mappable with a class method of rigidMap. What should I call the kind * version of Foldable and its corresponding methods? Is there a valid

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread Ivan Lazar Miljenovic
On 4 September 2010 17:40, wren ng thornton w...@freegeek.org wrote: On 9/3/10 12:16 AM, Ivan Lazar Miljenovic wrote: 1) How should I name the kind * versions?  For example, the kind * version of Functor is currently called Mappable with a class method of rigidMap.  What should I call the

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread wren ng thornton
On 9/4/10 3:50 AM, Ivan Lazar Miljenovic wrote: On 4 September 2010 17:40, wren ng thorntonw...@freegeek.org wrote: So, in the interest of generality, perhaps you should just pick a letter or a short prefix and use that for each of the classes. In my blog posts I called them 0-monads,

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread Ivan Lazar Miljenovic
On 4 September 2010 18:27, wren ng thornton w...@freegeek.org wrote: On 9/4/10 3:50 AM, Ivan Lazar Miljenovic wrote: On 4 September 2010 17:40, wren ng thorntonw...@freegeek.org  wrote: So, in the interest of generality, perhaps you should just pick a letter or a short prefix and use that

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread Stephen Tetley
On 4 September 2010 08:50, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: 3) Am I wasting my time with this? Not at all. Many people want a good containers API, and many people want a cleaned up version of the categorical classes which isn't quite as involved as category-extras. Go

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread Ivan Lazar Miljenovic
On 4 September 2010 18:54, Stephen Tetley stephen.tet...@gmail.com wrote: Supposing classes is the way to go, I think there's still a lot of design work to be done on what the classes should be rather than how they are implemented. The current design space (ListLike and your Data.Containers)

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread Stephen Tetley
On 4 September 2010 09:57, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Where exactly can I find these observations on the analogies between data structures and numerical representations? Chris Okasaki - Chapter 9 of Purely Functional Data Structures. Ralf Hinze's slides Number

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread Ben Millwood
I have only one thing to add to this discussion: On Fri, Sep 3, 2010 at 5:16 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: 2b) Is it OK to promote functions that use a class to being class methods?  When I was discussing this in #haskell several people mentioned that defining

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread David Menendez
On Fri, Sep 3, 2010 at 8:23 AM, John Lato jwl...@gmail.com wrote: Do you have a kind * implementation of Foldable?  I'd be interested in seeing it, because I was unable to create a usable implementation (based upon the RMonad scheme) on my last attempt. I always figured it would look something

Re: [Haskell-cafe] Restricted type classes

2010-09-04 Thread Ivan Lazar Miljenovic
On 5 September 2010 03:34, David Menendez d...@zednenem.com wrote: On Fri, Sep 3, 2010 at 8:23 AM, John Lato jwl...@gmail.com wrote: Do you have a kind * implementation of Foldable?  I'd be interested in seeing it, because I was unable to create a usable implementation (based upon the RMonad

Re: [Haskell-cafe] Restricted type classes

2010-09-03 Thread John Lato
From: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com When I released the first version of container-classes (which I hacked on during AusHac), some people said I should split out the various folding, etc. into duplicates of the current Foldable class, etc. rather than having large

Re: [Haskell-cafe] Restricted type classes

2010-09-03 Thread Tobias Brandt
On 3 September 2010 06:16, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: 2c) Should I keep the classes as-is, or should I explicitly put in the constraints mentioned in the Typeclassopedia (e.g. make Applicative an explicit superclass of Monad, and define return = pure for

Re: [Haskell-cafe] Restricted type classes

2010-09-03 Thread C. McCann
On Fri, Sep 3, 2010 at 11:47 AM, John Lato jwl...@gmail.com wrote: On Fri, Sep 3, 2010 at 1:29 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 3 September 2010 22:23, John Lato jwl...@gmail.com wrote: Do you have a kind * implementation of Foldable?  I'd be interested in

[Haskell-cafe] Restricted type classes

2010-09-02 Thread Ivan Lazar Miljenovic
When I released the first version of container-classes (which I hacked on during AusHac), some people said I should split out the various folding, etc. into duplicates of the current Foldable class, etc. rather than having large monolithic classes. I've been working on this (see my more recent

[Haskell-cafe] (automatic) type classes context inference

2010-08-28 Thread João Paulo
Hello everyone, I am developing a toolset in which I have several (multiparameter) type classes; It is often the case that I can only define a data-type X as an instance of one such class (say A), if X is an instance of another class (say B); The thing is that, while it is hard for me

Re: [Haskell-cafe] type classes and logic

2010-08-28 Thread Patrick Browne
Daniel Fischer wrote: class BEING human = HUMAN human where Sub-classing is logical implication BEING(human) = HUMAN(human) All types t that make BEING(t) = true also make HUMAN(t)=true No, it's the other way round. Every HUMAN is also a BEING, hence HUMAN(t) = BEING(t) Could I say

Re: [Haskell-cafe] type classes and logic

2010-08-28 Thread Sebastian Fischer
Daniel Fischer wrote: class BEING human = HUMAN human where Sub-classing is logical implication BEING(human) = HUMAN(human) All types t that make BEING(t) = true also make HUMAN(t)=true No, it's the other way round. Every HUMAN is also a BEING, hence HUMAN(t) = BEING(t) Could I say that

Re: [Haskell-cafe] type classes and logic

2010-08-28 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/28/10 06:17 , Patrick Browne wrote: In the light of the above examples how should I interpret the class-to-subclass relation as logical implication? Is it a) If BEING then HUMAN (sufficient condition): BEING = HUMAN b) HUMAN is true only if

Re: [Haskell-cafe] (automatic) type classes context inference

2010-08-28 Thread Carter Schonwald
i believe that a valid idiom is to define a class C that has no functions, but requires any instance to also be of type classes A and B, so that you can write: C a = blah rather than (A a,B a)= blah, though I don't know how often such is used in practice the same idea should apply more

Re: [Haskell-cafe] (automatic) type classes context inference

2010-08-28 Thread Evan Laforge
On Sat, Aug 28, 2010 at 12:22 PM, Carter Schonwald carter.schonw...@gmail.com wrote:  i believe that a valid idiom is to define a class C that has no  functions, but requires  any instance   to also be of type classes A and B, so that you can write: C a = blah rather than (A a,B a)= blah

[Haskell-cafe] type classes and logic

2010-08-27 Thread Patrick Browne
Hi, I am trying to understand type classes and sub-classes in purely logical terms From the literature I gather that: 1)a type class is a predicate over types (using type variables) 2)type sub-classing is a logical implication between these predicates. But I feel that 1) and 2) does not give

Re: [Haskell-cafe] type classes and logic

2010-08-27 Thread Daniel Fischer
make HUMAN(t)=true No, it's the other way round. Every HUMAN is also a BEING, hence HUMAN(t) = BEING(t) Admittedly, the notation for subclasses in Haskell is backwards. The corresponding situation for Java interfaces (which are roughly analogous to type classes) would be interface BEING

Re: [Haskell-cafe] type classes and logic

2010-08-27 Thread Sebastian Fischer
? That depends whether you ask a compiler or a programmer. The compiler is satisfied if you respect the types. But type classes often come with additional laws on the operations that programmers have come to expect. For example, every implementation of the function == of the Eq class should

Re: [Haskell-cafe] type classes and logic

2010-08-27 Thread Patrick Browne
Sebastian, Thanks for your very useful reply. Does the EQ example below not talk about inhabited types as proofs. Thanks, Pat Sebastian Fischer wrote: If we find a value for a type that is a proof that a type exists (it is inhabited) that is a member of the class I don't understand the

Re: [Haskell-cafe] Removing polymorphism from type classes (viz. Functor) (Again)

2010-08-15 Thread Ivan Lazar Miljenovic
Alexey Karakulov ankaraku...@gmail.com writes: (Ord b) must be deduced from (Functor (Set b)) but it doesn't. I don't know whether it's my mistake somewhere or ghc problem. I've come across this problem as well; the best solution I've seen so far is the one taken by Ganesh in his rmonad

Re: [Haskell-cafe] Removing polymorphism from type classes (viz. Functor) (Again)

2010-08-15 Thread Stephen Tetley
On 15 August 2010 08:50, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Yeah, I'm working on something like this at the moment, but I'm currently stuck on naming: if I want to have Functor for kind * - *, what's a good name for a type class for kind *? Conor McBride has suggested

Re: [Haskell-cafe] Removing polymorphism from type classes (viz. Functor) (Again)

2010-08-15 Thread Alexey Karakulov
On Sun, Aug 15, 2010 at 10:50 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Yeah, I'm working on something like this at the moment, but I'm currently stuck on naming: if I want to have Functor for kind * - *, what's a good name for a type class for kind *? I was thinking about

<    1   2   3   4   5   6   7   >