Skip to content
Merged
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
11 changes: 10 additions & 1 deletion src/Constrained/TheKnot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,16 @@ deriving instance Eq (ProdW as b)

deriving instance Show (ProdW as b)

instance Syntax ProdW
instance Syntax ProdW where
prettySymbol ProdW _ _ = Nothing
prettySymbol ProdFstW (t :> Nil) p = parensIf (p > 10) <$> prettySelect 0 t
prettySymbol ProdSndW (t :> Nil) p = parensIf (p > 10) <$> prettySelect 1 t

prettySelect :: Int -> TermD deps t -> Maybe (Doc ann)
prettySelect i (App f (t :> Nil))
| Just ProdSndW <- getWitness f = prettySelect (i + 1) t
| Just ToGenericW <- getWitness f = Just $ "sel @" <> pretty i <+> pretty t
prettySelect _ _ = Nothing

instance Semantics ProdW where
semantics ProdW = Prod
Expand Down