Skip to content

Commit

Permalink
SimplifyL4.hs: Streamline / improve the mapM-ing in simplifyHcBodyBsr
Browse files Browse the repository at this point in the history
Co-authored-by: johsi-k <johsi.k@gmail.com>
  • Loading branch information
ym-han and johsi-k committed Aug 28, 2023
1 parent 22fc2bd commit 1993573
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions lib/haskell/natural4/src/LS/XPile/LogicalEnglish/SimplifyL4.hs
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,10 @@ simpheadRPC exprsl exprsr =

simplifyHcBodyBsr :: L4.BoolStructR -> SimpL4 (BoolPropn L4AtomicP)
simplifyHcBodyBsr = \case
AA.Leaf rp ->
simplifybodyRP rp
AA.All _ propns -> do
props <- mapM simplifyHcBodyBsr propns
return $ And props
AA.Any _ propns -> do
props <- mapM simplifyHcBodyBsr propns
return $ Or props
AA.Not propn -> do
prop <- simplifyHcBodyBsr propn
return $ Not prop
AA.Leaf rp -> simplifybodyRP rp
AA.All _ propns -> And <$> mapM simplifyHcBodyBsr propns
AA.Any _ propns -> Or <$> mapM simplifyHcBodyBsr propns
AA.Not propn -> Not <$> simplifyHcBodyBsr propn
{- ^ where a 'L4 propn' = BoolStructR = BoolStruct _lbl RelationalPredicate.
Note that a BoolStructR is NOT a 'RPBoolStructR' --- a RPBoolStructR is one of the data constructors for the RelationalPredicate sum type
-}
Expand Down

0 comments on commit 1993573

Please sign in to comment.