@@ -18,33 +18,36 @@ import Language.PureScript.Docs.RenderedCode
18import Language.PureScript.Docs.Utils.MonoidExtras
18import Language.PureScript.Docs.Utils.MonoidExtras
20renderDeclaration :: Declaration -> RenderedCode
20renderDeclaration :: Declaration -> RenderedCode
21−renderDeclaration Declaration{..} =
21+renderDeclaration = renderDeclarationWithOptions defaultRenderTypeOptions
23+renderDeclarationWithOptions :: RenderTypeOptions -> Declaration -> RenderedCode
24+renderDeclarationWithOptions opts Declaration{..} =
22 mintersperse sp $ case declInfo of
25 mintersperse sp $ case declInfo of
23 ValueDeclaration ty ->
26 ValueDeclaration ty ->
24 [ ident declTitle
27 [ ident declTitle
25 , syntax "::"
28 , syntax "::"
26− , renderType ty
29+ , renderType' ty
28 DataDeclaration dtype args ->
31 DataDeclaration dtype args ->
29 [ keyword (show dtype)
32 [ keyword (show dtype)
30− , renderType (typeApp declTitle args)
33+ , renderType' (typeApp declTitle args)
32 ExternDataDeclaration kind' ->
35 ExternDataDeclaration kind' ->
33 [ keywordData
36 [ keywordData
34− , renderType (P.TypeConstructor (notQualified declTitle))
37+ , renderType' (P.TypeConstructor (notQualified declTitle))
35 , syntax "::"
38 , syntax "::"
36 , renderKind kind'
39 , renderKind kind'
38 TypeSynonymDeclaration args ty ->
41 TypeSynonymDeclaration args ty ->
39 [ keywordType
42 [ keywordType
40− , renderType (typeApp declTitle args)
43+ , renderType' (typeApp declTitle args)
41 , syntax "="
44 , syntax "="
42− , renderType ty
45+ , renderType' ty
44 TypeClassDeclaration args implies ->
47 TypeClassDeclaration args implies ->
45 [ keywordClass ]
48 [ keywordClass ]
46 ++ maybe [] (:[]) superclasses
49 ++ maybe [] (:[]) superclasses
47− ++ [renderType (typeApp declTitle args)]
50+ ++ [renderType' (typeApp declTitle args)]
48 ++ if any (isTypeClassMember . cdeclInfo) declChildren
51 ++ if any (isTypeClassMember . cdeclInfo) declChildren
49 then [keywordWhere]
52 then [keywordWhere]
@@ -59,16 +62,21 @@ renderDeclaration Declaration{..} =
60 isTypeClassMember (ChildTypeClassMember _) = True
63 isTypeClassMember (ChildTypeClassMember _) = True
61 isTypeClassMember _ = False
64 isTypeClassMember _ = False
66+ renderType' = renderTypeWithOptions opts
63renderChildDeclaration :: ChildDeclaration -> RenderedCode
68renderChildDeclaration :: ChildDeclaration -> RenderedCode
64−renderChildDeclaration ChildDeclaration{..} =
69+renderChildDeclaration = renderChildDeclarationWithOptions defaultRenderTypeOptions
71+renderChildDeclarationWithOptions :: RenderTypeOptions -> ChildDeclaration -> RenderedCode
72+renderChildDeclarationWithOptions opts ChildDeclaration{..} =
65 mintersperse sp $ case cdeclInfo of
73 mintersperse sp $ case cdeclInfo of
66 ChildInstance constraints ty ->
74 ChildInstance constraints ty ->
67 [ keywordInstance
75 [ keywordInstance
68 , ident cdeclTitle
76 , ident cdeclTitle
69 , syntax "::"
77 , syntax "::"
70 ] ++ maybe [] (:[]) constraints'
78 ] ++ maybe [] (:[]) constraints'
71− ++ [ renderType ty ]
79+ ++ [ renderType' ty ]
73 constraints'
81 constraints'
74 | null constraints = Nothing
82 | null constraints = Nothing
@@ -80,7 +88,7 @@ renderChildDeclaration ChildDeclaration{..} =
80 renderedConstraints = mintersperse (syntax "," <> sp)
88 renderedConstraints = mintersperse (syntax "," <> sp)
81 (map renderConstraint constraints)
89 (map renderConstraint constraints)
82 ChildDataConstructor args ->
90 ChildDataConstructor args ->
83− [ renderType typeApp' ]
91+ [ renderType' typeApp' ]
85 typeApp' = foldl P.TypeApp ctor' args
93 typeApp' = foldl P.TypeApp ctor' args
86 ctor' = P.TypeConstructor (notQualified cdeclTitle)
94 ctor' = P.TypeConstructor (notQualified cdeclTitle)
@@ -88,8 +96,10 @@ renderChildDeclaration ChildDeclaration{..} =
88 ChildTypeClassMember ty ->
96 ChildTypeClassMember ty ->
89 [ ident cdeclTitle
97 [ ident cdeclTitle
90 , syntax "::"
98 , syntax "::"
91− , renderType ty
99+ , renderType' ty
102+ renderType' = renderTypeWithOptions opts
94renderConstraint :: (P.Qualified P.ProperName, [P.Type]) -> RenderedCode
104renderConstraint :: (P.Qualified P.ProperName, [P.Type]) -> RenderedCode
95renderConstraint (pn, tys) =
105renderConstraint (pn, tys) =