You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The free applicatives I've seen have been based on the binary-operator notion of Applicative. But we can also think in terms of idiom brackets. The simplest one is slow in general:
-- A vinyl recorddataArgs:: (*->*) -> [*] ->*whereNil::Argsf '[]Cons::fa->Argsfas->Argsf (a ':as)
-- A free ApplicativedataExprfa=forall (ts:: [*]).Expr (ArgsIdentityts->a) (Argsfts)
It's slow to consume because it will allocate lots of initial segments. That's easily fixed:
@ElvishJerricco's blog post on sorting Traversable containers inspired this, BTW. Using
dataMonoxawhereMono::x->Monoxx-- Just a length-indexed vectortypeListx=Expr (Monox)
gets you a List x applicative you can traverse with and then sort. Rebuilding the container separately seems much easier than stirring everything together with the standard version. I have no idea if there are other potential applications of the idiom bracket representation, but maybe.
The free applicatives I've seen have been based on the binary-operator notion of
Applicative
. But we can also think in terms of idiom brackets. The simplest one is slow in general:It's slow to consume because it will allocate lots of initial segments. That's easily fixed:
It's also slow on construction, of course. I imagine a difference list would do the trick if you don't need reflection.
The text was updated successfully, but these errors were encountered: