snowleopard / build

Build Systems à la Carte
MIT License
242 stars 18 forks source link

Revive higher-rank polymorphism #5

Closed snowleopard closed 6 years ago

snowleopard commented 6 years ago

This PR brings back higher-rank polymorphism both for Task and Tasks:

This allows us to get rid of mostly identical applicative and monadic variants of tracing strategies.

snowleopard commented 6 years ago

@ndmitchell @simonpj I'd like to hear your thoughts on this.

snowleopard commented 6 years ago

P.S. I'm also working on a couple of other approaches, so perhaps a better one will be found. This one is finished though, so it's worth considering it as a possible design point.

ndmitchell commented 6 years ago

I like it. The wrap is tedious, but occurs infrequently and doesn't really obscure the point where it does arise. Suggest we go with it, at least for now.

snowleopard commented 6 years ago

@ndmitchell Thanks! I think we need unwrapping only when we are extracting a Task from Tasks, which doesn't happen too often.

snowleopard commented 6 years ago

Merged. There is an alternative approach suggested by @simonpj: use newtype Task and add a lift function to convert between Task Applicative and Task Monad, etc. I'll explore this in a separate branch.