Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Synth a = Synth {}
- runSynth :: Int -> Type -> Synth a -> TcM [a]
- type Rule = String
- rule :: Rule -> Type -> Synth a -> Synth a
- (=>>) :: Type -> Type -> Type
- newtype Gamma = Gamma {}
- inGamma :: Prop -> Synth a -> Synth a
- getGamma :: Synth [Prop]
- newtype Delta = Delta {}
- pushDelta :: Prop -> Synth ()
- delDelta :: Prop -> Synth ()
- getDelta :: Synth [Prop]
- setDelta :: [Prop] -> Synth ()
- guardUsed :: SName -> Synth ()
- newtype Omega = Omega {}
- takeOmegaOr :: Synth a -> (Prop -> Synth a) -> Synth a
- inOmega :: Prop -> Synth a -> Synth a
- extendOmega :: [Prop] -> Synth a -> Synth a
- data RestrictTag
- addRestriction :: RestrictTag -> Synth a -> Synth a
- guardRestricted :: RestrictTag -> Synth ()
- guardNotRestricted :: RestrictTag -> Synth ()
- getConstraints :: Synth [Ct]
- setConstraints :: [Ct] -> Synth ()
- newWantedWithLoc :: CtLoc -> PredType -> TcM CtEvidence
- solveConstraintsWithEq :: Type -> Type -> Synth ()
- fresh :: Synth SName
- guardWith :: String -> Bool -> Synth ()
- forMFairConj :: MonadLogic m => [t] -> (t -> m a) -> m [a]
- liftTcM :: TcM a -> Synth a
- t4 :: (a, b, c, d) -> d
- type Depth = Int
- type SName = OccNameStr
- type Prop = (SName, Type)
Synth
Synthesis monad
Handles threading of state, propagation of reading state, backtracking, constraint solving, and friends
Instances
MonadFail Synth # | |
Defined in Synthesizer.Monad | |
MonadIO Synth # | |
Defined in Synthesizer.Monad | |
Alternative Synth # | |
Applicative Synth # | |
Functor Synth # | |
Monad Synth # | |
MonadLogic Synth # | |
MonadState (Int, Delta, [Ct]) Synth # | |
MonadReader (Depth, [RestrictTag], Gamma, Omega) Synth # | |
runSynth :: Int -> Type -> Synth a -> TcM [a] #
Run a synthesis computation.
Receives the amount of results to observe, the type of the recursive call (small hack while I don't have the module info), and the synthesis computation
Rules
rule :: Rule -> Type -> Synth a -> Synth a #
Run computation where the current rule is being applied to the given type
This is used to track the depth of the proof, and for logging
(=>>) :: Type -> Type -> Type #
From two types (a,b) create a new type (a => b) for usage with rule
Used for representing e.g. left focus => synth goal
Gamma
Unrestricted hypothesis (Γ)
Instances
Show Gamma # | |
Eq Gamma # | |
Show ([RestrictTag], Gamma, Omega) # | |
Defined in Synthesizer.Monad | |
MonadReader (Depth, [RestrictTag], Gamma, Omega) Synth # | |
Delta
Linear hypothesis (not left asynchronous) (Δ)
Omega
Ordered (linear?) hypothesis (Ω)
Instances
Show Omega # | |
Eq Omega # | |
Show ([RestrictTag], Gamma, Omega) # | |
Defined in Synthesizer.Monad | |
MonadReader (Depth, [RestrictTag], Gamma, Omega) Synth # | |
takeOmegaOr :: Synth a -> (Prop -> Synth a) -> Synth a #
Take a proposition from the omega context: * If one exists, pass it to the 2nd argument (computation using proposition) * If none does, run the 1st argument (computation without proposition from omega)
In case a proposition is taken from omega, the computation run won't have it in the omega context anymore
extendOmega :: [Prop] -> Synth a -> Synth a #
Extend a computation with additional propositions in omega
Restrictions
data RestrictTag #
Restrictions to conduct synthesis
ConstructTy Type | Restriction on Constructing Type |
DeconstructTy Type | Restriction on Deonstructing Type |
DecideLeftBangR Type Type | Restriction on "Deciding-Left-Bang" on X to synthesize Y |
Instances
Show RestrictTag # | |
Defined in Synthesizer.Monad showsPrec :: Int -> RestrictTag -> ShowS # show :: RestrictTag -> String # showList :: [RestrictTag] -> ShowS # | |
Eq RestrictTag # | |
Defined in Synthesizer.Monad (==) :: RestrictTag -> RestrictTag -> Bool # (/=) :: RestrictTag -> RestrictTag -> Bool # | |
Show ([RestrictTag], Gamma, Omega) # | |
Defined in Synthesizer.Monad | |
MonadReader (Depth, [RestrictTag], Gamma, Omega) Synth # | |
addRestriction :: RestrictTag -> Synth a -> Synth a #
Run a computation with an additional restriction
guardRestricted :: RestrictTag -> Synth () #
Guard that a certain restriction exists
i.e. if the given restriction is already in place, the computation suceeds,
otherwise, the given restriction isn't in place, and the computation fails
with empty
guardNotRestricted :: RestrictTag -> Synth () #
Guard that a certain restriction hasn't been applied
i.e. if the given restriction doesn't exist, the computation suceeds,
otherwise, the given restriction is already in place, and the computation fails
with empty
Constraints (WIP)
getConstraints :: Synth [Ct] #
setConstraints :: [Ct] -> Synth () #
newWantedWithLoc :: CtLoc -> PredType -> TcM CtEvidence #
solveConstraintsWithEq :: Type -> Type -> Synth () #
Add a constraint to the list of constraints and solve it Failing if the constraints can't be solved with this addition
Names
Utilities
guardWith :: String -> Bool -> Synth () #
Like guard
but emit given string as failure message upon failure
forMFairConj :: MonadLogic m => [t] -> (t -> m a) -> m [a] #