Collection size as a type

5 views
Skip to first unread message

Andrey Ilinykh

unread,
Sep 26, 2017, 2:40:12 AM9/26/17
to Shapeless Dev
Hello everybody!
I have a simple problem.

I want to create a bunch of operations on some collection of objects.  The size of collection is know at compilation time.
I would like something like this

trai MyCollection[N <: Nat]

def join[N: <: Nat, M: <: Nat](c1: MyCollection[N], c2: MyCollection[M]): MyCollection[N + M]= ...

or 
def dot(N: <: Nat, M: <: Nat](c1: MyCollection[N], c2: MyCollection[M]): MyCollection[N + M -2]= ...

Of course, N + M doesn't compile. 
is the any way to describe the result type as arithmetic expression of parameters type?



Thank you,
  Andrey

Miles Sabin

unread,
Sep 26, 2017, 4:00:09 AM9/26/17
to shapel...@googlegroups.com
Hi Andrey,

This mailing list is deprecated in favour of shapeless's gitter channel,

https://gitter.im/milessabin/shapeless

You'll find lots of people there who are able to help out with
questions like this.

Yours,


Miles
> --
> You received this message because you are subscribed to the Google Groups
> "Shapeless Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to shapeless-de...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Miles Sabin
tel: +44 7813 944 528
skype: milessabin
gtalk: mi...@milessabin.com
http://milessabin.com/blog
http://twitter.com/milessabin
Reply all
Reply to author
Forward
0 new messages