fused-effects icon indicating copy to clipboard operation
fused-effects copied to clipboard

Add examples of carrier composition

Open robrix opened this issue 6 years ago • 4 comments

In 0.3, carrier composition is simpler, faster, and more convenient than in earlier versions. We should add at least one example of defining a carrier by composing other carriers together.

This is closely related to but (IMO) distinct from #9, which is about the simpler case of defining a carrier using a single underlying carrier; e.g. FreshC being defined using StateC.

robrix avatar Mar 20 '19 15:03 robrix

Bumped to 0.3.0.1; 0.3 is ready to go and this needn’t delay it.

robrix avatar Mar 28 '19 19:03 robrix

I'd be happy to provide an example of this, do you have one in mind?

mitchellwrosen avatar Apr 11 '19 15:04 mitchellwrosen

@mitchellwrosen: Oh, thank you! Nothing off the top of my head; but e.g. I’ve written typechecking effects with a ReaderC for the context + WriterC to collect constraints. I think the example could just show off the mechanical parts of that, tho we should probably also (separately) document why you might abstract underlying effects behind some other effect.

I guess one classic example might be implementing State behaviour using the composition of ReaderC & WriterC.

robrix avatar Apr 11 '19 18:04 robrix