mikeizbicki / subhask

Type safe interface for working in subcategories of Hask
BSD 3-Clause "New" or "Revised" License
418 stars 43 forks source link

added (!~) and (%~); fusion for UVector #57

Closed Drezil closed 8 years ago

Drezil commented 8 years ago

I added (!~) and (%~) to IxContainer with default-implementation via imap.

Added streaming/recycling-framework - but GHC only inlines monomorphic functions so there has to be a specialized version of stream/unstream and clone/new with the rules according to the concrete functions.

This is ugly, but works for now.

Addition of (//) for setting multiple elements will be in a seperate pull-request and will be implemented via repeated calls to (!~) for Vectors (O(k) with k <= n) and some kind of sort+imap for the default implementation (O(n)).

Drezil commented 8 years ago

note: core-example of the generated code is in the commit-msg of https://github.com/mikeizbicki/subhask/pull/57/commits/619baeeee974b74f59a4fa342e6714b4571aa67a

mikeizbicki commented 8 years ago

Nice job getting this to work! I'm very pleased :)

It would be really nice if the test suite could automatically verify things are getting fused, but I have no idea how to make that happen in a reasonable way.

(And sorry for the delay in reviewing this. My sister got married last week so I've been away.)