[Haskell-cafe] Generalising Categories - categories of tuples
vogt.adam at gmail.com
Wed Feb 17 04:53:26 UTC 2016
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
On Tue, Feb 16, 2016 at 12:21 AM, Clinton Mead <clintonmead at gmail.com>
> 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:
> 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.
> Clinton Mead
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe