[feature-proposal] Natural transformation type class with covariance support

48 views
Skip to first unread message

Alois Cochard

unread,
Jul 2, 2012, 3:51:36 PM7/2/12
to shapel...@googlegroups.com
Hi hackers without shape,

Here is a proposal for a variant of the natural transformation typeclass that support covariance,

In short it make possible to support 'Some' instead of only 'Option' when doing type 'transformation', here is the implementation:

Of course this apply to any type constructor that have sub-type.

It's quite usefull for me when designing DSL, let me know what you think of that.

Cheers,

Alois Cochard

Alois Cochard

unread,
Jul 2, 2012, 4:02:47 PM7/2/12
to shapel...@googlegroups.com
Sorry I posted a link to wrong commit!

Miles Sabin

unread,
Jul 3, 2012, 4:08:16 AM7/3/12
to shapel...@googlegroups.com
On Mon, Jul 2, 2012 at 9:02 PM, Alois Cochard <alois....@gmail.com> wrote:
> Sorry I posted a link to wrong commit!
>
> Here is the good one ->
> https://github.com/aloiscochard/shapeless/commit/96ed0c38e29f4eb27a05c84949666132ab87b7e6

I have the same general comments here as on NatTRel.

I'm also not completely convinced that we need any additional support
for variance beyond the fact that HLists are themselves already
covariant. Could you show us an example of something that works with
smoothly with CoNatTRel and awkwardly with NatTRel?

Cheers,


Miles

--
Miles Sabin
tel: +44 7813 944 528
skype: milessabin
gtalk: mi...@milessabin.com
g+: http://www.milessabin.com
http://twitter.com/milessabin

Alois Cochard

unread,
Aug 4, 2012, 6:08:53 AM8/4/12
to shapel...@googlegroups.com
Hi Miles,

If I created that variation, it's because (as a simple example) I wasn't able to give a HList with a TC of Some to function that accept TC of Option:

Even if HList are covariant, I need the TC constrain to be too, otherwise I don't see how it's possible to cover this use-case?

Cheers,

Alois 
Reply all
Reply to author
Forward
0 new messages