Skip to content

RFC/To-think-about: are these usages of Gen.justT potentially problematic? #980

New issue

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions primer/gen/Primer/Gen/Core/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ genSyns ty = do
(e, _) <- genSyn
pure (Hole () e, TEmptyHole ())
genSpine :: WT (Maybe (GenT WT (ExprG, TypeG)))
genSpine = fmap (fmap Gen.justT) genSpineHeadFirst
genSpine = fmap (fmap justT) genSpineHeadFirst
genSpineHeadFirst :: WT (Maybe (GenT WT (Maybe (ExprG, TypeG))))
-- todo: maybe add some lets in as post-processing? I could even add them to the locals for generation in the head
genSpineHeadFirst = do
Expand Down Expand Up @@ -453,7 +453,7 @@ genChk ty = do
else Just $ do
(tc, td) <- Gen.element adts
let t = mkTAppCon tc (TEmptyHole () <$ typeDefParameters td)
(e, brs) <- Gen.justT $ do
(e, brs) <- justT $ do
(e, eTy) <- genSyns t -- NB: this could return something only consistent with t, e.g. if t=List ?, could get eT=? Nat
vcs' <- instantiateValCons eTy
fmap (e,) <$> case vcs' of
Expand Down