Skip to content

Conversation

isovector
Copy link
Collaborator

@isovector isovector commented Oct 24, 2020

This PR introduces applicative idioms, by way of the following tactic combinator:

------------------------------------------------------------------------------
-- | Attempt to run the given tactic in "idiom bracket" mode. For example, if
-- the current goal is
--
--    (_ :: [r])
--
-- then @idiom apply@ will remove the applicative context, resulting in a hole:
--
--    (_ :: r)
--
-- and then use @apply@ to solve it. Let's say this results in:
--
--    (f (_ :: a) (_ :: b))
--
-- Finally, @idiom@ lifts this back into the original applicative:
--
--    (f <$> (_ :: [a]) <*> (_ :: [b]))
--
-- Idiom will fail fast if the current goal doesn't have an applicative
-- instance.
idiom :: TacticsM () -> TacticsM ()

Currently WIP because it doesn't ensure an applicative instance exists.

@isovector
Copy link
Collaborator Author

@wz1000 do you know how I can lookup whether an Applicative instance exists for a given type in HLS?

@isovector isovector mentioned this pull request Oct 27, 2020
7 tasks
isovector added a commit that referenced this pull request Oct 27, 2020
Due to an oversight in how we handle polymorphic class methods (fixed in #537), having an applicative context introduces (*>) into scope, which causes an exponential explosion in the search space. On fast machines it seems like we can get through this test before the timeout, but on CI it's flakey.
@pepeiborra pepeiborra force-pushed the master branch 2 times, most recently from 66ada8c to d4f5d43 Compare December 29, 2020 13:34
@isovector isovector closed this Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant