mirage / functoria

A DSL to invoke otherworldly functors
ISC License
63 stars 21 forks source link

sub-devices (module type being extended) #169

Open hannesm opened 5 years ago

hannesm commented 5 years ago

given that we now have Mirage_kv.RO and Mirage_kv.RW, where the latter extends the former, I'm curious how to map this onto functoria devices. What I'd like to express without copy & pasting code is e.g. "whenever a kv_ro device is expected, a kv_rw can be passed as well". Is this possible? I couldn't get it to work (see https://github.com/mirage/mirage/pull/975/commits/d0065ced820c6f0bfd608687dbaef8824d0f1091 where I duplicated direct_kv_r{w} to get something that compiles).

Drup commented 5 years ago

we could have something like

type +_ kv
type ro = [`Read] kv
type rw = [`Read | `Write] kv