Skip to content

ExpHP/funky

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

It smells a bit funky in here...

This is (for now) just ExpHP's personal project reimplementing some of the ideas in frunk, attempting to explore the design space a bit more.

This probably won't ever be published. Instead, I hope to use what I learn here to contribute ideas to another similar project (probably frunk?).

Features

(note: examples are most likely broken by the time you read this)

Reified indices, to improve ergonomics of working with multiple HLists in parallel

let list_a = hlist![A1, A2, A3];
let list_b = hlist![B1, B2, B3];

// Find the indices for sculpting
let sculptor = list_a.sculptor_of::<HList![A3, A1], _>();

// Apply them to both lists.
let (hlist_pat![A3, A1], hlist_pat![A2]) = list_a.sculpt_at(sculptor);
let (hlist_pat![B3, B1], hlist_pat![B2]) = list_b.sculpt_at(sculptor);

// Notice that the type of `list_b.sculpt_at(sculptor)` is always
// immediately known, without any help from type inference;
// the following does not produce a "Type annotations needed" error.
assert_eq!(list_b.sculpt_at(sculptor), list_b.sculpt_at(sculptor));

Coproduct subsetting (sculpt) and supersetting (embed)

sculpt can turn Coprod![A, B, C, D, E] into Either<Coprod![C, A, E]>, Coprod![B, D]>.
embed can turn Coprod![C, A, E] into Coprod![A, B, C, D, E].

(actually wait a second, isn't embed just a special case of sculpt where the remainder is void?)
(ehhhhhhh I'll do something about that later)

Documentation that very profusely apologies about the index type parameters

Yes, the indices on the type-directed lookup methods really do have to be type parameters.

No, they can't be turned into associated types. Try it, I dare you.

Usage

Don't.

If you just wanna try it out for kicks, you should use a git dependency with a rev tag: (this repo has no tags yet)

[dependencies]
funky = { rev = "777777777777", git = "https://github.com/ExpHP/funky" }

License

Licensed under either of

at your option.

Contribution

Wait, what?! You want to contribute... to this?!

Well... alrighty, then. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

do you smell that?

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages