Re: [Haskell-cafe] Categories (cont.)

2013-05-11 Thread wren ng thornton
On 5/8/13 12:14 PM, Conal Elliott wrote: Hi Wren, Have you taken this constrained categories experiment further, particularly for adding products? As I mentioned in a haskell-cafe note yesterday, I tried and got a frightening proliferation of constraints when defining method defaults and

Re: [Haskell-cafe] Categories (cont.)

2013-05-08 Thread Conal Elliott
Hi Wren, Have you taken this constrained categories experiment further, particularly for adding products? As I mentioned in a haskell-cafe note yesterday, I tried and got a frightening proliferation of constraints when defining method defaults and utility functions (e.g., left- or

Re: [Haskell-cafe] Categories (cont.)

2012-12-21 Thread Tillmann Rendel
Hi, Christopher Howard wrote: instance Category ... The Category class is rather restricted: Restriction 1: You cannot choose what the objects of the category are. Instead, the objects are always all Haskell types. You cannot choose anything at all about the objects. Restriction 2: You

Re: [Haskell-cafe] Categories (cont.)

2012-12-21 Thread Chris Smith
It would definitely be nice to be able to work with a partial Category class, where for example the objects could be constrained to belong to a class. One could then restrict a Category to a type level representation of the natural numbers or any other desired set. Kind polymorphism should make

Re: [Haskell-cafe] Categories (cont.)

2012-12-21 Thread Jay Sulzberger
On Fri, 21 Dec 2012, Chris Smith cdsm...@gmail.com wrote: It would definitely be nice to be able to work with a partial Category class, where for example the objects could be constrained to belong to a class. One could then restrict a Category to a type level representation of the natural

Re: [Haskell-cafe] Categories (cont.)

2012-12-21 Thread wren ng thornton
On 12/20/12 7:07 PM, Christopher Howard wrote: On 12/20/2012 03:59 AM, wren ng thornton wrote: In order to fake this theory in Haskell we can do: newtype MonoidCategory a i j = MC a instance Monoid a = Category (MonoidCategory a) where id = MC mempty MC f

Re: [Haskell-cafe] Categories (cont.)

2012-12-21 Thread wren ng thornton
On 12/21/12 2:35 PM, Chris Smith wrote: It would definitely be nice to be able to work with a partial Category class, where for example the objects could be constrained to belong to a class. One could then restrict a Category to a type level representation of the natural numbers or any other

[Haskell-cafe] Categories (cont.)

2012-12-20 Thread Christopher Howard
I've perhaps been trying everyones patiences with my noobish CT questions, but if you'll bear with me a little longer: I happened to notice that there is in fact a Category class in Haskell base, in Control.Category: quote: class Category cat where A class for categories. id and (.)

Re: [Haskell-cafe] Categories (cont.)

2012-12-20 Thread Petr P
Hi Christopher, a data type can be an instance of Category only if it has kind * - * - *. It must have 2 type parameters so that you could have types like 'cat a a'. Some simple examples: import Prelude hiding (id, (.)) import Control.Category import Data.Monoid -- See

Re: [Haskell-cafe] Categories (cont.)

2012-12-20 Thread wren ng thornton
On 12/20/12 6:42 AM, Christopher Howard wrote: code: instance Category Integer where id = 1 (.) = (*) -- and instance Category [a] where id = [] (.) = (++) --- But these lead to kind mis-matches. As mentioned in my other email (just posted) the kind mismatch is

Re: [Haskell-cafe] Categories (cont.)

2012-12-20 Thread Jay Sulzberger
On Thu, 20 Dec 2012, Christopher Howard christopher.how...@frigidcode.com wrote: I've perhaps been trying everyones patiences with my noobish CT questions, but if you'll bear with me a little longer: I happened to notice that there is in fact a Category class in Haskell base, in

Re: [Haskell-cafe] Categories (cont.)

2012-12-20 Thread Christopher Howard
On 12/20/2012 03:59 AM, wren ng thornton wrote: On 12/20/12 6:42 AM, Christopher Howard wrote: As mentioned in my other email (just posted) the kind mismatch is because categories are actually monoid-oids[1] not monoids. That is: class Monoid (a :: *) where mempty :: a

Re: [Haskell-cafe] Categories (cont.)

2012-12-20 Thread ok
I've perhaps been trying everyones patiences with my noobish CT questions, but if you'll bear with me a little longer: I happened to notice that there is in fact a Category class in Haskell base, in Control.Category: quote: class Category cat where A class for categories. id and

Re: [Haskell-cafe] Categories (cont.)

2012-12-20 Thread Jay Sulzberger
On Thu, 20 Dec 2012, Christopher Howard christopher.how...@frigidcode.com wrote: On 12/20/2012 03:59 AM, wren ng thornton wrote: On 12/20/12 6:42 AM, Christopher Howard wrote: As mentioned in my other email (just posted) the kind mismatch is because categories are actually monoid-oids[1]

Re: [Haskell-cafe] Categories (cont.)

2012-12-20 Thread Gershom Bazerman
On 12/20/12 10:05 PM, Jay Sulzberger wrote: What does the code for going backwards looks like? That is, suppose we have an instance of Category with only one object. What is the Haskell code for the function which takes the category instance and produces a monoid thing, like your integers with

Re: [Haskell-cafe] Categories (cont.)

2012-12-20 Thread Jay Sulzberger
On Thu, 20 Dec 2012, Gershom Bazerman gersh...@gmail.com wrote: On 12/20/12 10:05 PM, Jay Sulzberger wrote: What does the code for going backwards looks like? That is, suppose we have an instance of Category with only one object. What is the Haskell code for the function which takes the