Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- substCTy :: TCvSubst -> CType -> CType
- newSubgoal :: Judgement -> Rule
- runTactic :: Context -> Judgement -> TacticsM () -> Either [TacticError] RunTacticResults
- assoc23 :: (a, b, c) -> (a, (b, c))
- tracePrim :: String -> Trace
- tracing :: Functor m => String -> TacticT jdg (Synthesized ext) err s m a -> TacticT jdg (Synthesized ext) err s m a
- markRecursion :: Functor m => TacticT jdg (Synthesized ext) err s m a -> TacticT jdg (Synthesized ext) err s m a
- mappingExtract :: Functor m => (ext -> ext) -> TacticT jdg ext err s m a -> TacticT jdg ext err s m a
- scoreSolution :: Synthesized (LHsExpr GhcPs) -> Judgement -> [Judgement] -> (Penalize Int, Reward Bool, Penalize Int, Penalize Int, Reward Int, Penalize Int, Penalize Int)
- solutionSize :: LHsExpr GhcPs -> Int
- newtype Penalize a = Penalize a
- newtype Reward a = Reward a
- tryUnifyUnivarsButNotSkolems :: Set TyVar -> CType -> CType -> Maybe TCvSubst
- updateSubst :: TCvSubst -> TacticState -> TacticState
- unify :: CType -> CType -> RuleM ()
- attemptWhen :: TacticsM a -> TacticsM a -> Bool -> TacticsM a
- methodHypothesis :: PredType -> Maybe [HyInfo CType]
- peek :: (ext -> TacticT jdg ext err s m ()) -> TacticT jdg ext err s m ()
- requireConcreteHole :: TacticsM a -> TacticsM a
- try' :: Functor m => TacticT jdg ext err s m () -> TacticT jdg ext err s m ()
Documentation
newSubgoal :: Judgement -> Rule Source #
Produce a subgoal that must be solved before we can solve the original goal.
:: Context | |
-> Judgement | |
-> TacticsM () | Tactic to use |
-> Either [TacticError] RunTacticResults |
Attempt to generate a term of the right type using in-scope bindings, and a given tactic.
tracing :: Functor m => String -> TacticT jdg (Synthesized ext) err s m a -> TacticT jdg (Synthesized ext) err s m a Source #
Mark that a tactic used the given string in its extract derivation. Mainly used for debugging the search when things go terribly wrong.
markRecursion :: Functor m => TacticT jdg (Synthesized ext) err s m a -> TacticT jdg (Synthesized ext) err s m a Source #
Mark that a tactic performed recursion. Doing so incurs a small penalty in the score.
mappingExtract :: Functor m => (ext -> ext) -> TacticT jdg ext err s m a -> TacticT jdg ext err s m a Source #
Map a function over the extract created by a tactic.
scoreSolution :: Synthesized (LHsExpr GhcPs) -> Judgement -> [Judgement] -> (Penalize Int, Reward Bool, Penalize Int, Penalize Int, Reward Int, Penalize Int, Penalize Int) Source #
Given the results of running a tactic, score the solutions by desirability.
NOTE: This function is completely unprincipled and was just hacked together to produce the right test results.
solutionSize :: LHsExpr GhcPs -> Int Source #
Compute the number of LHsExpr
nodes; used as a rough metric for code
size.
Penalize a |
Instances
Eq a => Eq (Penalize a) Source # | |
Ord a => Ord (Penalize a) Source # | |
Show a => Show (Penalize a) Source # | |
Reward a |
tryUnifyUnivarsButNotSkolems :: Set TyVar -> CType -> CType -> Maybe TCvSubst Source #
Like tcUnifyTy
, but takes a list of skolems to prevent unification of.
updateSubst :: TCvSubst -> TacticState -> TacticState Source #
Attempt to unify two types.
attemptWhen :: TacticsM a -> TacticsM a -> Bool -> TacticsM a Source #
Prefer the first tactic to the second, if the bool is true. Otherwise, just run the second tactic.
This is useful when you have a clever pruning solution that isn't always applicable.
methodHypothesis :: PredType -> Maybe [HyInfo CType] Source #
Get the class methods of a PredType
, correctly dealing with
instantiation of quantified class types.
peek :: (ext -> TacticT jdg ext err s m ()) -> TacticT jdg ext err s m () Source #
Mystical time-traveling combinator for inspecting the extracts produced by a tactic. We can use it to guard that extracts match certain predicates, for example.
Note, that this thing is WEIRD. To illustrate:
@
peek f
blah
@
Here, f
can inspect the extract _produced by blah
,_ which means the
causality appears to go backwards.
peek
should be exposed directly by refinery
in the next release.
requireConcreteHole :: TacticsM a -> TacticsM a Source #
Run the given tactic iff the current hole contains no univars. Skolems and already decided univars are OK though.
try' :: Functor m => TacticT jdg ext err s m () -> TacticT jdg ext err s m () Source #
The try
that comes in refinery 0.3 causes unnecessary backtracking and
balloons the search space. This thing just tries it, but doesn't backtrack
if it fails.
NOTE(sandy): But there's a bug! Or at least, something not understood here.
Using this everywhere breaks te tests, and neither I nor TOTBWF are sure
why. Prefer try
if you can, and only try this as a last resort.
TODO(sandy): Remove this when we upgrade to 0.4