hana icon indicating copy to clipboard operation
hana copied to clipboard

Official support for views

Open ldionne opened this issue 9 years ago • 6 comments

The goal of this PR is to officially support views, which are only experimental right now.

Still left to do:

  • [x] Move view types out of the experimental namespace, perhaps into detail
  • [ ] ~~Consider providing access to the flattened methods & al.~~ (not at first)
  • [x] Test nested views
  • [ ] Add examples
  • [ ] Document views in the tutorial (requires some rewording of the sections on containers and on algorithms)
  • [ ] ~~Provide operators~~ (not at first)
  • [x] Provide a non-dummy implementation of hana::equal (thanks @ricejasonf)
  • [x] Provide a non-dummy implementation of hana::ap (thanks @ricejasonf)
  • [ ] ~~Consider providing a filtered_view~~ (not at first)

ldionne avatar Sep 28 '16 21:09 ldionne

I have a PR for equal, and I'd like to do ap as well. It appears that detail::cartesian_product_indices provides an interface that should make that easy to implement. A cartesian_product view looks pretty easy with that as well.

ricejasonf avatar Jul 01 '17 19:07 ricejasonf

I'm striking a few things that I marked as being required to ship this PR. Given my lack of time to work on Hana (very sadly), I'm going to go for a minimal implementation for the sake of shipping this. This PR is important and it has been sitting around for way too long.

ldionne avatar Dec 02 '17 02:12 ldionne

I didn't actually do ap yet, but it should be trivial now.

I could help with tests too if that is welcome.

ricejasonf avatar Dec 02 '17 03:12 ricejasonf

I think the tests for ap are okay, what I'm mostly concerned about is tests for the rest of the functionality. For example, filter should work currently because view_tag implements MonadPlus, but I'm fairly confident it won't work properly (either compilation error or dangling reference) based on looking at how single_view is implemented.

So yeah, I'd welcome help on making the tests more robust. I'm happy to tackle the documentation side.

ldionne avatar Dec 02 '17 03:12 ldionne

Are we going to make the views Sequence or is that some kind of violation?

(can't remember if I already asked this)

ricejasonf avatar Jan 03 '18 19:01 ricejasonf

They can't be Sequences because there's no way to make them from a pack of elements. In other words, they don't have storage like a Container, and Sequence requires that (actually Sequence might be better named Container, since it reflects element ownership).

ldionne avatar Jan 04 '18 17:01 ldionne