Closed garyb closed 5 years ago
All the Control.*.Indexed stuff looks great. I haven't had the time to try it for purescript-leffe or Hyper, but looks reasonable.
The Indexed
type is not obvious to me. Is it for running an indexed computation with a regular monad?
Also, should there be instances for the regular hierarchy of Functor, Apply, Applicative, and Bind, for Indexed
?
Yeah Indexed
is for defining things like the old IxAff
/ IxEff
, where you want a "phantom indexed monad" kinda thing:
newtype IxAff eff i o a = IxAff (Indexed (Aff eff) i o a)
derive newtype instance ixFunctorIndexed ∷ IxFunctor (IxAff eff)
derive newtype instance ixApplyIndexed ∷ IxApply (IxAff eff)
derive newtype instance ixApplicativeIndexed ∷ IxApplicative (IxAff eff)
derive newtype instance ixBindIndexed ∷ IxBind (IxAff eff)
derive newtype instance ixMonadIndexed ∷ IxMonad (IxAff eff)
So yes, lifting a non-indexed monad into being indexed. Which may not be entirely useless, as you could still track things in the types there, to ensure a connection is closed or whatever... or... I don't know, maybe it is useless :smile:
Maybe we should include the indexed state transformer in here too, since that's what Middleware
and Leffe
both are, isn't it?
Maybe we should include the indexed state transformer in here too, since that's what
Middleware
andLeffe
both are, isn't it?
Also rolling my own IxStateT
. Seems like it would be good to have here.
/cc @owickstrom well, I got there eventually...
Data.Indexed
is theIxM
type I mentioned in #11How does this all look? I think you're the primary user of the library right now, so don't know who else is out there that might have opinions on it :smile:
I think
Indexed
provides enough stuff that it won't be too annoying to have all of the intermediate classes, since everything can bederive newtype instance
'd.