[Haskell-cafe] Generalising Categories - categories of tuples

adam vogt vogt.adam at gmail.com
Wed Feb 17 04:53:26 UTC 2016


Hi Clinton,

HList has some functions that help with defining something similar: <
https://gist.github.com/aavogt/50d5313c99b7224b62dd>. It might be possible
to use less classes to define the replicate/zip/map functions needed (by
using more GADTs and type families instead) and end up being allowed to
define an instance Control.Category.Category HF.

Your code will be shorter if you make instance heads more general and use
equality constraints (~). I mean that the following instance (from my
paste) gets selected as long as the first argument to ($) is a function,
and no type families are needed:

instance (a ~ a', b ~ b') => Dollar (a -> b) a' b'
 where f $ x = f x

Regards,
Adam


On Tue, Feb 16, 2016 at 12:21 AM, Clinton Mead <clintonmead at gmail.com>
wrote:

> Hi All
>
> I've been doing some work on generalising categories, basically so the
> composition operator (.) works for not just functions, but things like
> tuples of functions, whilst still retaining type inference.
> Control.Category is a bit too restrictive for such instances.
>
> You can see the details in my blog post here:
>
>
> https://clintonmeadprogramming.wordpress.com/2016/02/16/generalising-categories/
>
> Any comments appreciated, I hope people find it interesting. Also, a quick
> plug, I'm looking for work, so if there's any Haskell (and/or functional
> programing) work around Sydney, Australia going I'd be interested. :-)
>
> If people really think this is useful, tell me, and I'll try to put it up
> as a package. Alternatively, if it's already been done, I'd appreciate a
> pointer in that direction.
>
> Regards,
>
> Clinton Mead
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160216/65040183/attachment.html>


More information about the Haskell-Cafe mailing list