-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mapProgramT #16
Comments
From what I learned in #14, I thought that it would be possible to also write the functions
without pattern matching on |
The same ideas from #14 can be used to write mapProgramT :: Monad m => (forall a. instr1 a -> instr2 a)
-> ProgramT instr1 m b -> ProgramT instr2 m b
mapProgramT f p = do
v <- lift $ viewT p
case v of
Return a -> return a
i :>>= k -> singleton (f i) >>= mapProgramT f . k If I were to export the constructors, then this would kind of the defeat the purpose of the library. (Though I'm willing to compromise for the sake of efficiency). Relying on |
In PR #15, I've added a function that makes it possible to map over the instruction type that
ProgramT
is parameterized over.The text was updated successfully, but these errors were encountered: