- match (new_vars++vars)
- (map shift_con_pat eqns_for_this_con)
- (map shift_con_pat shadows_for_this_con) `thenDs` \ match_result ->
-
- returnDs (
- (data_con, new_vars, match_result)
- : rest_of_alts
- )
- where
- splitByCon :: [EquationInfo] -> ([EquationInfo], [EquationInfo])
- splitByCon [] = ([],[])
- splitByCon (info@(EqnInfo (pat : _) _) : rest)
- = case pat of
- ConPat n _ _ | n == data_con -> (info:rest_yes, rest_no)
- WildPat _ -> (info:rest_yes, info:rest_no)
- -- WildPats will be in the shadows only,
- -- and they go into both groups
- other_pat -> (rest_yes, info:rest_no)
- where
- (rest_yes, rest_no) = splitByCon rest