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
NB the traversal needs to be applicative not just pure
The text was updated successfully, but these errors were encountered:
data TransformationParts = TransformationParts { partTerm :: ExpQ, ... } defaultTransformationParts = TransformationParts {partTerm = [|\case {}|], ...} data Transformations ext1 ext2 f = Transformations { transformTerm :: forall primTy primVal. Term' ext1 primTy primVal -> f (Term' ext2 primTy primVal), ... } makeTransformTerm :: ExpQ -> ExpQ -> ExpQ makeTransformTerm self lam = do defaults <- ... -- e.g. match [p|Lam t|] (normalB [|Lam <$> transformTerm t|]) [] LamCaseE matches <- lam pure $ LamCaseE $ matches ++ filter (not mentioned in matches) defaults makeTransformations :: TransformationParts -> ExpQ makeTransformations (TransformationParts {..}) = [| fix \self -> Transformations { transformTerm = $(makeTransformTerm [|self|] partTerm), ... } |] ------ module Juvix.Core.IR.Unify where import qualified Juvix.Core.IR.Types as IR import qualified Juvix.Core.IR.Types.Base as IR data T deriving Data -- TODO also abbreviate this bit obviously IR.extendTerm "Term" [] [t|T|] \_ _ -> IR.defaultExtTerm IR.extendElim "Elim" [] [t|T|] \_ _ -> IR.defaultExtElim IR.extendValue "Value" [] [t|T|] \_ _ -> IR.defaultExtValue { IR.typeValueX = [("VMetaVar", [[t|MetaVar|]])] } IR.extendNeutral "Neutral" [] [t|T|] \_ _ -> IR.defaultExtNeutral -- etc etc toValue :: Value primTy primVal -> Maybe (IR.Value primTy primVal) toNeutral :: Neutral primTy primVal -> Maybe (IR.Neutral primTy primVal) Transformations {transformValue = toValue, transformNeutral = toNeutral, {- ... -} } = $(IR.makeTransformations $ IR.defaultTransformationParts { IR.transformValue = [|\case VMetaVar α -> Nothing |] } )
Sorry, something went wrong.
No branches or pull requests
NB the traversal needs to be applicative not just pure
The text was updated successfully, but these errors were encountered: