Hi café, a quick question. Is there a somewhat standard class like this: class Something c where unit :: c () () pair :: c x y -> c u v -> c (x, u) (y, v) ? I'm using it heavily in my current project, but I don't want to repeat somebody else's work, and it seems general enough to be defined somewhere; but my quick search on Hackage didn't reveal anything. I know about arrows; this, however, is something more general, and it's instances aren't always arrows.
On Tue, May 8, 2012 at 2:36 PM, MigMit <miguelimo38@yandex.ru> wrote:
Hi café, a quick question.
Is there a somewhat standard class like this:
class Something c where unit :: c () () pair :: c x y -> c u v -> c (x, u) (y, v)
?
I'm using it heavily in my current project, but I don't want to repeat somebody else's work, and it seems general enough to be defined somewhere; but my quick search on Hackage didn't reveal anything.
I know about arrows; this, however, is something more general, and it's instances aren't always arrows.
Are you aware of generalized arrows [1]? It's still a lot more than your Something, though. [1] http://www.cs.berkeley.edu/~megacz/garrows/ -- Felipe.
On 8 May 2012, at 21:42, Felipe Almeida Lessa wrote:
On Tue, May 8, 2012 at 2:36 PM, MigMit <miguelimo38@yandex.ru> wrote:
Hi café, a quick question.
Is there a somewhat standard class like this:
class Something c where unit :: c () () pair :: c x y -> c u v -> c (x, u) (y, v)
?
I'm using it heavily in my current project, but I don't want to repeat somebody else's work, and it seems general enough to be defined somewhere; but my quick search on Hackage didn't reveal anything.
I know about arrows; this, however, is something more general, and it's instances aren't always arrows.
Are you aware of generalized arrows [1]? It's still a lot more than your Something, though.
I've heard of them, but some instances of my Something class aren't categories either, which rules out GArrows too.
On 09/05/12 03:49, MigMit wrote:
On 8 May 2012, at 21:42, Felipe Almeida Lessa wrote:
On Tue, May 8, 2012 at 2:36 PM, MigMit <miguelimo38@yandex.ru> wrote:
Hi café, a quick question.
Is there a somewhat standard class like this:
class Something c where unit :: c () () pair :: c x y -> c u v -> c (x, u) (y, v)
?
I'm using it heavily in my current project, but I don't want to repeat somebody else's work, and it seems general enough to be defined somewhere; but my quick search on Hackage didn't reveal anything.
I know about arrows; this, however, is something more general, and it's instances aren't always arrows. Are you aware of generalized arrows [1]? It's still a lot more than your Something, though. I've heard of them, but some instances of my Something class aren't categories either, which rules out GArrows too.
Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe data-lens has something similar (Tensor):
http://hackage.haskell.org/packages/archive/data-lens/2.10.0/doc/html/Contro... -- Tony Morris http://tmorris.net/
FullBinaryTreeRelation? :P On Tue, May 8, 2012 at 1:36 PM, MigMit <miguelimo38@yandex.ru> wrote:
Hi café, a quick question.
Is there a somewhat standard class like this:
class Something c where unit :: c () () pair :: c x y -> c u v -> c (x, u) (y, v)
?
I'm using it heavily in my current project, but I don't want to repeat somebody else's work, and it seems general enough to be defined somewhere; but my quick search on Hackage didn't reveal anything.
I know about arrows; this, however, is something more general, and it's instances aren't always arrows. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
To expand on that, this class basically allows you to prove your relation cholds pointwise across arbitrary binary trees, represented by nested tuples and terminated by ()s. If individual instances of the class had additional ways of constructing values (i.e., proving the relation for the two type parameters), then your trees could contain other types. For example, if you had another type data Iso a b = Iso (a -> b) (b -> a) -- the functions must be inverses you could write an instance of Something for Iso and build a proof that ((), (a, ((), b)) is isomorphic to ((), (c, ((), d)) given Iso a c and Iso b dusing your class. I'm not sure I'd bundle the two parts together, but I'd call your pairmethod (or the class it lives in) something like congruent or ProductsRespectThisRelation :) Dan On Tue, May 8, 2012 at 3:15 PM, Daniel Peebles <pumpkingod@gmail.com> wrote:
FullBinaryTreeRelation? :P
On Tue, May 8, 2012 at 1:36 PM, MigMit <miguelimo38@yandex.ru> wrote:
Hi café, a quick question.
Is there a somewhat standard class like this:
class Something c where unit :: c () () pair :: c x y -> c u v -> c (x, u) (y, v)
?
I'm using it heavily in my current project, but I don't want to repeat somebody else's work, and it seems general enough to be defined somewhere; but my quick search on Hackage didn't reveal anything.
I know about arrows; this, however, is something more general, and it's instances aren't always arrows. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
That's an interesting idea, thanks. Отправлено с iPad 08.05.2012, в 23:31, Daniel Peebles <pumpkingod@gmail.com> написал(а):
To expand on that, this class basically allows you to prove your relation c holds pointwise across arbitrary binary trees, represented by nested tuples and terminated by ()s. If individual instances of the class had additional ways of constructing values (i.e., proving the relation for the two type parameters), then your trees could contain other types.
For example, if you had another type
data Iso a b = Iso (a -> b) (b -> a) -- the functions must be inverses
you could write an instance of Something for Iso and build a proof that ((), (a, ((), b)) is isomorphic to ((), (c, ((), d)) given Iso a c and Iso b d using your class.
I'm not sure I'd bundle the two parts together, but I'd call your pair method (or the class it lives in) something like congruent or ProductsRespectThisRelation :)
Dan
On Tue, May 8, 2012 at 3:15 PM, Daniel Peebles <pumpkingod@gmail.com> wrote: FullBinaryTreeRelation? :P
On Tue, May 8, 2012 at 1:36 PM, MigMit <miguelimo38@yandex.ru> wrote: Hi café, a quick question.
Is there a somewhat standard class like this:
class Something c where unit :: c () () pair :: c x y -> c u v -> c (x, u) (y, v)
?
I'm using it heavily in my current project, but I don't want to repeat somebody else's work, and it seems general enough to be defined somewhere; but my quick search on Hackage didn't reveal anything.
I know about arrows; this, however, is something more general, and it's instances aren't always arrows. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (4)
-
Daniel Peebles -
Felipe Almeida Lessa -
MigMit -
Tony Morris