We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
forgive :: (Given a => result) -> (a -> result) forgive f a = give a f
I find it useful for this kind of coding style:
type Pure xx a = Given (a -> IO xx) newtype Managed a where Managed :: (forall xx. Pure xx a => IO xx) -> Managed a implPure :: forall xx a. Pure xx a => a -> IO xx implPure = given instance Functor Managed where fmap :: forall a a'. (a -> a') -> (Managed a -> Managed a') fmap f (Managed ma) = Managed ma' where ma' :: forall xx. Pure xx a' => IO xx ma' = ma `forgive` \a -> implPure @xx (f a) instance Applicative Managed where pure :: a -> Managed a pure x = Managed (given x) (<*>) :: forall a b. Managed (a -> b) -> Managed a -> Managed b Managed mf <*> Managed ma = Managed mb where mb :: forall zz. Pure zz b => IO zz mb = mf @zz `forgive` \f -> ma @zz `forgive` \(a :: a) -> implPure @zz @b (f a)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I find it useful for this kind of coding style:
The text was updated successfully, but these errors were encountered: